Analyzers
Talk to fellow users of Intel Analyzer tools (Intel VTune™ Profiler, Intel Advisor)
5058 Discussions

redhat9 5.14.0 kernal header changes break sepdk build

CFR
New Contributor II
533 Views

There seems to be some recent changes in Redhat 9 that cause the problems when building the sampling drivers.  (I'm using 2024.1 but others are impacted as well).

Specifically, somewhere between 5.14.0-362.24.1 and 5.14.0-427.18.1 RedHat changed the header file:

/lib/modules/5.14.0-427.20.1.el9_4.x86_64/build/include/linux/device/class.h

to use the version of class_create:

struct class * __must_check class_create(const char *name);

as opposed to the previous version which was:

#define class_create(owner, name)             \
({                                          \
	static struct lock_class_key __key;   \
        __class_create(owner, name, &__key);  \
})

There are ifdefs in the sepdk source to handle this for newer kernels, but they don't work for the 5.14.0 (the RedHat 9 version):

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
  pmu_class = class_create(SOCPERF_DRIVER_NAME);
#else
  pmu_class = class_create(THIS_MODULE, SOCPERF_DRIVER_NAME);
#endif

The work around seems to be to edit:

...sepdk/src/socperf/src/socperfdrv.c
...sepdk/src/socperf/src/lwpmudrv.c
...sepdk/src/socperf/src/pax/pax.c
...sepdk/src/socperf/src/socwatch/socwatch_driver/src/sw_file_ops.c

and remove the "THIS_MODULE, " from the 2 argument version.

1 Solution
yuzhang3_intel
Moderator
463 Views

The issue is with driver build errors where class_create macro definition has been changed since Linux kernel 6.4 as you mentioned.
-#define class_create(owner, name) \
+#define class_create(name) \
 
We already fixed our drivers for 6.4 or later kernels but RH 9.4 kernel 5.14.0 has the changed back ported. Currently, there is no better way to detect it easily. We need to explore more.

 

View solution in original post

0 Kudos
3 Replies
yuzhang3_intel
Moderator
507 Views

Did you verify if the workaround can work?

0 Kudos
CFR
New Contributor II
478 Views

The drivers build with out error and installing the result seems to be working for us.

I don't really understand the details of the driver code, so it would be nice to have Intel verify that this is a proper/complete work around.

yuzhang3_intel
Moderator
464 Views

The issue is with driver build errors where class_create macro definition has been changed since Linux kernel 6.4 as you mentioned.
-#define class_create(owner, name) \
+#define class_create(name) \
 
We already fixed our drivers for 6.4 or later kernels but RH 9.4 kernel 5.14.0 has the changed back ported. Currently, there is no better way to detect it easily. We need to explore more.

 

0 Kudos
Reply