Re: [PATCH 5/5] x86/sysfs: Add PPIN in sysfs under cpu topology

From: Luck, Tony
Date: Thu Jan 20 2022 - 13:02:09 EST


On Thu, Jan 20, 2022 at 02:35:51PM +0100, Borislav Petkov wrote:
> On Fri, Jan 07, 2022 at 02:54:42PM -0800, Tony Luck wrote:
> > +#define topology_ppin(cpu) (cpu_data(cpu).ppin)
>
> That looks unused. No need to add it.


It "looks" unused, But thanks to the obscurity of CPP macros using ## to
concatenate tokens it is needed.

This harmless looking line:

define_id_show_func(ppin, "%llx");

is transmogrified by this:

#define define_id_show_func(name, fmt) \
static ssize_t name##_show(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
return sysfs_emit(buf, fmt "\n", topology_##name(dev->id)); \
^^^^^^^^^^^^^^^

This becomes topology_ppin
}


Will fix the other stuff and rebase to latest so part 4 applies.

Thanks for the review.

-Tony