Unload linux/kernel.h
Subsystems (7)
v3 cover Unload linux/kernel.h
kernel.h hosts declarations that can be placed better.
No major changes since v2. For testing details, see v2.
v1: https://lore.kernel.org/all/[email protected]/
v2: https://lore.kernel.org/all/[email protected]/
v3:
- rename linux/tracing.h to linux/trace_printk.h (Steven);
- cleanup headers better (Andy);
Yury Norov (NVIDIA) (4):
kernel.h: drop STACK_MAGIC macro
moduleparam: include required headers explicitly
kernel.h: move VERIFY_OCTAL_PERMISSIONS() to sysfs.h
tracing: move tracing declarations from kernel.h to a dedicated header
Documentation/filesystems/sysfs.rst | 2 +- .../drm/i915/gt/selftest_ring_submission.c | 1 + drivers/gpu/drm/i915/i915_selftest.h | 2 + include/linux/kernel.h | 210 +----------------- include/linux/moduleparam.h | 7 +- include/linux/sysfs.h | 13 ++ include/linux/trace_printk.h | 205 +++++++++++++++++ 7 files changed, 229 insertions(+), 211 deletions(-) create mode 100644 include/linux/trace_printk.h
Signature · 1 line
2.43.0
PATCH v3 1/4 kernel.h: drop STACK_MAGIC macro
The macro was introduced in 1994, v1.0.4, for stacks protection. Since that, people found better ways to protect stacks, and now the macro is only used by i915 selftests. Move it to a local header and drop from the kernel.h.
--- drivers/gpu/drm/i915/gt/selftest_ring_submission.c | 1 + drivers/gpu/drm/i915/i915_selftest.h | 2 ++ include/linux/kernel.h | 2 -- 3 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gt/selftest_ring_submission.c +1 -0
@@ -3,6 +3,7 @@* Copyright © 2020 Intel Corporation */ +#include "i915_selftest.h" #include "intel_engine_pm.h" #include "selftests/igt_flush_test.h"
drivers/gpu/drm/i915/i915_selftest.h +2 -0
@@ -26,6 +26,8 @@#include <linux/types.h> +#define STACK_MAGIC 0xdeadbeef +struct pci_dev ;struct drm_i915_private ;
include/linux/kernel.h +0 -2
@@ -40,8 +40,6 @@#include <uapi/linux/kernel.h> -#define STACK_MAGIC 0xdeadbeef -struct completion ;struct user ;
Signature · 1 line
2.43.0
Re: [PATCH v3 1/4] kernel.h: drop STACK_MAGIC macro
Hi Yuri,
Quoted 10 lines · Yury Norov (NVIDIA)
The macro was introduced in 1994, v1.0.4, for stacks protection. Since that, people found better ways to protect stacks, and now the macro is only used by i915 selftests. Move it to a local header and drop from the
kernel.h.Reviewed-by Andy Shevchenko <[email protected]>Acked-by Randy Dunlap <[email protected]>Acked-by Jani Nikula <[email protected]>Reviewed-by Christophe Leroy (CS GROUP) <[email protected]>Signed-off-by Yury Norov (NVIDIA) <[email protected]>
Thanks,
Andi
Re: [PATCH v3 1/4] kernel.h: drop STACK_MAGIC macro
In reply to Yury Norov (NVIDIA)Quoted 58 lines · Yury Norov (NVIDIA)
The macro was introduced in 1994, v1.0.4, for stacks protection. Since that, people found better ways to protect stacks, and now the macro is only used by i915 selftests. Move it to a local header and drop from the
kernel.h.Reviewed-by Andy Shevchenko <[email protected]>Acked-by Randy Dunlap <[email protected]>Acked-by Jani Nikula <[email protected]>Reviewed-by Christophe Leroy (CS GROUP) <[email protected]>Signed-off-by Yury Norov (NVIDIA) <[email protected]>--- drivers/gpu/drm/i915/gt/selftest_ring_submission.c | 1 + drivers/gpu/drm/i915/i915_selftest.h | 2 ++ include/linux/kernel.h | 2 -- 3 files changed, 3 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/gt/selftest_ring_submission.c +1
-0@@ -3,6 +3,7 @@* Copyright © 2020 Intel Corporation */ +#include "i915_selftest.h" #include "intel_engine_pm.h" #include "selftests/igt_flush_test.h" drivers/gpu/drm/i915/i915_selftest.h +2
-0@@ -26,6 +26,8 @@#include <linux/types.h> +#define STACK_MAGIC 0xdeadbeef +struct pci_dev ;struct drm_i915_private ;include/linux/kernel.h +0
-2@@ -40,8 +40,6 @@#include <uapi/linux/kernel.h> -#define STACK_MAGIC 0xdeadbeef -struct completion ;struct user ;Signature · 1 line
2.43.0
Signature · 1 line
Aaron Tomlin
PATCH v3 2/4 moduleparam: include required headers explicitly
In reply to Yury Norov (NVIDIA)The following patch drops moduleparam.h dependency on kernel.h. In preparation to it, list all the required headers explicitly.
--- include/linux/moduleparam.h | 5 +++++ 1 file changed, 5 insertions(+)
include/linux/moduleparam.h +5 -0
@@ -2,9 +2,14 @@#ifndef _LINUX_MODULE_PARAMS_H#define _LINUX_MODULE_PARAMS_H/* (C) Copyright 2001, 2002 Rusty Russell IBM Corporation */ + +#include <linux/array_size.h> +#include <linux/build_bug.h> +#include <linux/compiler.h> #include <linux/init.h> #include <linux/stringify.h> #include <linux/kernel.h> +#include <linux/types.h> /* * The maximum module name length, including the NUL byte.
Signature · 1 line
2.43.0
PATCH v3 3/4 kernel.h: move VERIFY_OCTAL_PERMISSIONS() to sysfs.h
In reply to Yury Norov (NVIDIA)The macro is related to sysfs, but is defined in kernel.h. Move it to the proper header, and unload the generic kernel.h.
Now that the macro is removed from kernel.h, linux/moduleparam.h is decoupled, and kernel.h inclusion can be removed.
--- Documentation/filesystems/sysfs.rst | 2 +- include/linux/kernel.h | 12 ------------ include/linux/moduleparam.h | 2 +- include/linux/sysfs.h | 13 +++++++++++++ 4 files changed, 15 insertions(+), 14 deletions(-)
Documentation/filesystems/sysfs.rst +1 -1
@@ -120,7 +120,7 @@ is equivalent to doing:: .store = store_foo, }; -Note as stated in include/linux/kernel.h "OTHER_WRITABLE? Generally +Note as stated in include/linux/sysfs.h "OTHER_WRITABLE? Generally considered a bad idea." so trying to set a sysfs file writable for everyone will fail reverting to RO mode for "Others".
include/linux/kernel.h +0 -12
@@ -389,16 +389,4 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }# define REBUILD_DUE_TO_DYNAMIC_FTRACE #endif -/* Permissions on a sysfs file: you didn't miss the 0 prefix did you? */ -#define VERIFY_OCTAL_PERMISSIONS (perms) \ - (BUILD_BUG_ON_ZERO((perms) < 0) + \ - BUILD_BUG_ON_ZERO((perms) > 0777) + \ -/* USER_READABLE >= GROUP_READABLE >= OTHER_READABLE */ \ -BUILD_BUG_ON_ZERO ((((perms) >>6 ) &4 ) < (((perms) >>3 ) &4 )) + \ -BUILD_BUG_ON_ZERO ((((perms) >>3 ) &4 ) < ((perms) &4 )) + \ -/* USER_WRITABLE >= GROUP_WRITABLE */ \ -BUILD_BUG_ON_ZERO ((((perms) >>6 ) &2 ) < (((perms) >>3 ) &2 )) + \ -/* OTHER_WRITABLE? Generally considered a bad idea. */ \ -BUILD_BUG_ON_ZERO ((perms) &2 ) + \ - (perms))#endif
include/linux/moduleparam.h +1 -1
@@ -8,7 +8,7 @@#include <linux/compiler.h> #include <linux/init.h> #include <linux/stringify.h> -#include <linux/kernel.h> +#include <linux/sysfs.h> #include <linux/types.h> /*
include/linux/sysfs.h +13 -0
@@ -798,4 +798,17 @@ static inline void sysfs_put(struct kernfs_node *kn) kernfs_put(kn); } +/* Permissions on a sysfs file: you didn't miss the 0 prefix did you? */ +#define VERIFY_OCTAL_PERMISSIONS (perms) \ + (BUILD_BUG_ON_ZERO((perms) < 0) + \ + BUILD_BUG_ON_ZERO((perms) > 0777) + \ +/* USER_READABLE >= GROUP_READABLE >= OTHER_READABLE */ \ +BUILD_BUG_ON_ZERO ((((perms) >>6 ) &4 ) < (((perms) >>3 ) &4 )) + \ +BUILD_BUG_ON_ZERO ((((perms) >>3 ) &4 ) < ((perms) &4 )) + \ +/* USER_WRITABLE >= GROUP_WRITABLE */ \ +BUILD_BUG_ON_ZERO ((((perms) >>6 ) &2 ) < (((perms) >>3 ) &2 )) + \ +/* OTHER_WRITABLE? Generally considered a bad idea. */ \ +BUILD_BUG_ON_ZERO ((perms) &2 ) + \ + (perms)) + #endif /* _SYSFS_H_ */
Signature · 1 line
2.43.0
PATCH v3 4/4 tracing: move tracing declarations from kernel.h to a dedicated header
In reply to Yury Norov (NVIDIA)Tracing is a half of the kernel.h in terms of LOCs, although it's a self-consistent part. It is intended for quick debugging purposes and isn't used by the normal tracing utilities.
Move it to a separate header. If someone needs to just throw a trace_printk() in their driver, they will not have to pull all the heavy tracing machinery.
This is a pure move, except for removing a few 'extern's.
--- include/linux/kernel.h | 196 +-------------------------------- include/linux/trace_printk.h | 205 +++++++++++++++++++++++++++++++++++ 2 files changed, 206 insertions(+), 195 deletions(-) create mode 100644 include/linux/trace_printk.h
include/linux/kernel.h +1 -195
@@ -32,7 +32,7 @@#include <linux/build_bug.h> #include <linux/sprintf.h> #include <linux/static_call_types.h> -#include <linux/instruction_pointer.h> +#include <linux/trace_printk.h> #include <linux/util_macros.h> #include <linux/wordpart.h>
@@ -190,200 +190,6 @@ enum system_states { };extern enum system_states system_state; -/* -* General tracing related utility functions - trace_printk(), -* tracing_on/tracing_off and tracing_start()/tracing_stop -* -* Use tracing_on/tracing_off when you want to quickly turn on or off -* tracing. It simply enables or disables the recording of the trace events. -* This also corresponds to the user space /sys/kernel/tracing/tracing_on -* file, which gives a means for the kernel and userspace to interact. -* Place a tracing_off() in the kernel where you want tracing to end. -* From user space, examine the trace, and then echo 1 > tracing_on -* to continue tracing. -* -* tracing_stop/tracing_start has slightly more overhead. It is used -* by things like suspend to ram where disabling the recording of the -* trace is not enough, but tracing must actually stop because things -* like calling smp_processor_id() may crash the system. -* -* Most likely, you want to use tracing_on/tracing_off. -*/ - -enum ftrace_dump_mode { -DUMP_NONE , -DUMP_ALL , -DUMP_ORIG , -DUMP_PARAM , -}; - -#ifdef CONFIG_TRACING -void tracing_on (void ); -void tracing_off (void ); -int tracing_is_on (void ); -void tracing_snapshot (void ); -void tracing_snapshot_alloc (void ); - -extern void tracing_start (void ); -extern void tracing_stop (void ); - -static inline __printf(1, 2) -void ____trace_printk_check_format(const char *fmt, ...) -{ -} -#define __trace_printk_check_format(fmt, args...) \ -do { \ -if (0 ) \ - ____trace_printk_check_format(fmt, ##args); \ -}while (0 ) - -/** -* trace_printk - printf formatting in the ftrace buffer -* @fmt: the printf format for printing -* -* Note: __trace_printk is an internal function for trace_printk() and -* the @ip is passed in via the trace_printk() macro. -* -* This function allows a kernel developer to debug fast path sections -* that printk is not appropriate for. By scattering in various -* printk like tracing in the code, a developer can quickly see -* where problems are occurring. -* -* This is intended as a debugging tool for the developer only. -* Please refrain from leaving trace_printks scattered around in -* your code. (Extra memory is used for special buffers that are -* allocated when trace_printk() is used.) -* -* A little optimization trick is done here. If there's only one -* argument, there's no need to scan the string for printf formats. -* The trace_puts() will suffice. But how can we take advantage of -* using trace_puts() when trace_printk() has only one argument? -* By stringifying the args and checking the size we can tell -* whether or not there are args. __stringify((__VA_ARGS__)) will -* turn into "()\0" with a size of 3 when there are no args, anything -* else will be bigger. All we need to do is define a string to this, -* and then take its size and compare to 3. If it's bigger, use -* do_trace_printk() otherwise, optimize it to trace_puts(). Then just -* let gcc optimize the rest. - */ - -#define trace_printk (fmt, ...) \ -do { \ - char _______STR[] = __stringify((__VA_ARGS__)); \ - if (sizeof(_______STR) > 3) \ - do_trace_printk(fmt, ##__VA_ARGS__); \ - else \ - trace_puts(fmt); \ -} while (0) - -#define do_trace_printk(fmt, args...) \ -do { \ - static const char *trace_printk_fmt __used \ - __section("__trace_printk_fmt") = \ - __builtin_constant_p(fmt) ? fmt : NULL; \ - \ - __trace_printk_check_format(fmt, ##args); \ - \ - if (__builtin_constant_p(fmt)) \ - __trace_bprintk(_THIS_IP_, trace_printk_fmt, ##args); \ - else \ - __trace_printk(_THIS_IP_, fmt, ##args); \ -} while (0) - -extern __printf(2, 3) -int __trace_bprintk(unsigned long ip, const char *fmt, ...); - -extern __printf(2, 3) -int __trace_printk(unsigned long ip, const char *fmt, ...); - -/** -* trace_puts - write a string into the ftrace buffer -* @str: the string to record -* -* Note: __trace_bputs is an internal function for trace_puts and -* the @ip is passed in via the trace_puts macro. -* -* This is similar to trace_printk() but is made for those really fast -* paths that a developer wants the least amount of "Heisenbug" effects, -* where the processing of the print format is still too much. -* -* This function allows a kernel developer to debug fast path sections -* that printk is not appropriate for. By scattering in various -* printk like tracing in the code, a developer can quickly see -* where problems are occurring. -* -* This is intended as a debugging tool for the developer only. -* Please refrain from leaving trace_puts scattered around in -* your code. (Extra memory is used for special buffers that are -* allocated when trace_puts() is used.) -* -* Returns: 0 if nothing was written, positive # if string was. -* (1 when __trace_bputs is used, strlen(str) when __trace_puts is used) -*/ - -#define trace_puts (str) ({ \ - static const char *trace_printk_fmt __used \ - __section("__trace_printk_fmt") = \ - __builtin_constant_p(str) ? str : NULL; \ - \ - if (__builtin_constant_p(str)) \ - __trace_bputs(_THIS_IP_, trace_printk_fmt); \ - else \ - __trace_puts(_THIS_IP_, str, strlen(str)); \ -}) -extern int __trace_bputs (unsigned long ip,const char *str); -extern int __trace_puts (unsigned long ip,const char *str,int size); - -extern void trace_dump_stack (int skip); - -/* -* The double __builtin_constant_p is because gcc will give us an error -* if we try to allocate the static variable to fmt if it is not a -* constant. Even with the outer if statement. -*/ -#define ftrace_vprintk (fmt, vargs) \ -do { \ - if (__builtin_constant_p(fmt)) { \ - static const char *trace_printk_fmt __used \ - __section("__trace_printk_fmt") = \ - __builtin_constant_p(fmt) ? fmt : NULL; \ - \ - __ftrace_vbprintk(_THIS_IP_, trace_printk_fmt, vargs); \ - } else \ - __ftrace_vprintk(_THIS_IP_, fmt, vargs); \ -} while (0) - -extern __printf(2, 0) int -__ftrace_vbprintk(unsigned long ip, const char *fmt, va_list ap); - -extern __printf(2, 0) int -__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); - -extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode); -#else -static inline void tracing_start(void) { } -static inline void tracing_stop(void) { } -static inline void trace_dump_stack(int skip) { } - -static inline void tracing_on(void) { } -static inline void tracing_off(void) { } -static inline int tracing_is_on(void) { return 0; } -static inline void tracing_snapshot(void) { } -static inline void tracing_snapshot_alloc(void) { } - -static inline __printf(1, 2) -int trace_printk(const char *fmt, ...) -{ - return 0; -} -static __printf(1, 0) inline int -ftrace_vprintk(const char *fmt, va_list ap) -{ - return 0; -} -static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } -#endif /* CONFIG_TRACING */ -/* Rebuild everything on CONFIG_DYNAMIC_FTRACE */ #ifdef CONFIG_DYNAMIC_FTRACE # define REBUILD_DUE_TO_DYNAMIC_FTRACE
include/linux/trace_printk.h new file +205 -0
205 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH v3 4/4] tracing: move tracing declarations from kernel.h to a dedicated header
Quoted 9 lines · Yury Norov (NVIDIA)
Tracing is a half of the
kernel.hin terms of LOCs, although it's a self-consistent part. It is intended for quick debugging purposes and isn't used by the normal tracing utilities.Move it to a separate header. If someone needs to just throw a
trace_printk()in their driver, they will not have to pull all the heavy tracing machinery.This is a pure move, except for removing a few 'extern's.
Signature · 2 lines
With Best Regards, Andy Shevchenko
kernel test robot
build botRe: [PATCH v3 4/4] tracing: move tracing declarations from kernel.h to a dedicated header
In reply to Yury Norov (NVIDIA)kernel test robot noticed the following build errors:
Hi Yury,
kernel test robot noticed the following build errors:
[auto build test ERROR on drm-i915/for-linux-next]
[also build test ERROR on drm-i915/for-linux-next-fixes driver-core/driver-core-testing driver-core/driver-core-next driver-core/driver-core-linus linus/master v6.18 next-20251205] [cannot apply to mcgrof/modules-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Yury-Norov-NVIDIA/kernel-h-drop-STACK_MAGIC-macro/20251206-015505 base: https://gitlab.freedesktop.org/drm/i915/kernel.git for-linux-next patch link: https://lore.kernel.org/r/20251205175237.242022-5-yury.norov%40gmail.com patch subject: [PATCH v3 4/4] tracing: move tracing declarations from kernel.h to a dedicated header config: x86_64-rhel-9.4-ltp (https://download.01.org/0day-ci/archive/20251206/[email protected]/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251206/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from include/linux/string.h:382,
from include/linux/trace_printk.h:9,
from include/linux/kernel.h:35,
from arch/x86/purgatory/purgatory.c:12:
>> include/linux/fortify-string.h:626:63: error: expected identifier or '(' before '{' token
626 | p_size_field, q_size_field, op) ({ \
| ^
include/linux/fortify-string.h:694:27: note: in expansion of macro '__fortify_memcpy_chk'
694 | #define memmove(p, q, s) __fortify_memcpy_chk(p, q, s, \
| ^~~~~~~~~~~~~~~~~~~~
arch/x86/purgatory/../boot/string.h:11:7: note: in expansion of macro 'memmove'
11 | void *memmove(void *dst, const void *src, size_t len);
| ^~~~~~~
>> include/linux/fortify-string.h:258:9: error: expected identifier or '(' before '__builtin_choose_expr'
258 | __builtin_choose_expr(__is_constexpr(__builtin_strlen(p)), \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/purgatory/../boot/string.h:23:15: note: in expansion of macro 'strlen'
23 | extern size_t strlen(const char *s);
| ^~~~~~vim +626 include/linux/fortify-string.h
a28a6e860c6cf23 Francis Laniel 2021-02-25 618
239d87327dcd361 Kees Cook 2024-12-12 619 /*
239d87327dcd361 Kees Cook 2024-12-12 620 * To work around what seems to be an optimizer bug, the macro arguments
239d87327dcd361 Kees Cook 2024-12-12 621 * need to have const copies or the values end up changed by the time they
239d87327dcd361 Kees Cook 2024-12-12 622 * reach fortify_warn_once(). See commit 6f7630b1b5bc ("fortify: Capture
239d87327dcd361 Kees Cook 2024-12-12 623 * __bos() results in const temp vars") for more details.
239d87327dcd361 Kees Cook 2024-12-12 624 */
f68f2ff91512c19 Kees Cook 2021-04-20 625 #define __fortify_memcpy_chk(p, q, size, p_size, q_size, \
f68f2ff91512c19 Kees Cook 2021-04-20 @626 p_size_field, q_size_field, op) ({ \
6f7630b1b5bc672 Kees Cook 2022-10-28 627 const size_t __fortify_size = (size_t)(size); \
6f7630b1b5bc672 Kees Cook 2022-10-28 628 const size_t __p_size = (p_size); \
6f7630b1b5bc672 Kees Cook 2022-10-28 629 const size_t __q_size = (q_size); \
6f7630b1b5bc672 Kees Cook 2022-10-28 630 const size_t __p_size_field = (p_size_field); \
6f7630b1b5bc672 Kees Cook 2022-10-28 631 const size_t __q_size_field = (q_size_field); \
239d87327dcd361 Kees Cook 2024-12-12 632 /* Keep a mutable version of the size for the final copy. */ \
239d87327dcd361 Kees Cook 2024-12-12 633 size_t __copy_size = __fortify_size; \
26f812ba75890c4 Kees Cook 2024-04-29 634 fortify_warn_once(fortify_memcpy_chk(__fortify_size, __p_size, \
6f7630b1b5bc672 Kees Cook 2022-10-28 635 __q_size, __p_size_field, \
475ddf1fce1ec48 Kees Cook 2023-04-07 636 __q_size_field, FORTIFY_FUNC_ ##op), \
54d9469bc515dc5 Kees Cook 2021-06-24 637 #op ": detected field-spanning write (size %zu) of single %s (size %zu)\n", \
54d9469bc515dc5 Kees Cook 2021-06-24 638 __fortify_size, \
5097a69d676f7e5 Alexey Dobriyan 2023-09-16 639 "field \"" #p "\" at " FILE_LINE, \
6f7630b1b5bc672 Kees Cook 2022-10-28 640 __p_size_field); \
239d87327dcd361 Kees Cook 2024-12-12 641 /* Hide only the run-time size from value range tracking to */ \
239d87327dcd361 Kees Cook 2024-12-12 642 /* silence compile-time false positive bounds warnings. */ \
239d87327dcd361 Kees Cook 2024-12-12 643 if (!__builtin_constant_p(__copy_size)) \
239d87327dcd361 Kees Cook 2024-12-12 644 OPTIMIZER_HIDE_VAR(__copy_size); \
239d87327dcd361 Kees Cook 2024-12-12 645 __underlying_##op(p, q, __copy_size); \
f68f2ff91512c19 Kees Cook 2021-04-20 646 })
f68f2ff91512c19 Kees Cook 2021-04-20 647 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH v3 4/4] tracing: move tracing declarations from kernel.h to a dedicated header
In reply to Yury Norov (NVIDIA)kernel test robot noticed the following build errors:
Hi Yury,
kernel test robot noticed the following build errors:
[auto build test ERROR on drm-i915/for-linux-next]
[also build test ERROR on drm-i915/for-linux-next-fixes driver-core/driver-core-testing driver-core/driver-core-next driver-core/driver-core-linus linus/master v6.18 next-20251205] [cannot apply to mcgrof/modules-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Yury-Norov-NVIDIA/kernel-h-drop-STACK_MAGIC-macro/20251206-015505 base: https://gitlab.freedesktop.org/drm/i915/kernel.git for-linux-next patch link: https://lore.kernel.org/r/20251205175237.242022-5-yury.norov%40gmail.com patch subject: [PATCH v3 4/4] tracing: move tracing declarations from kernel.h to a dedicated header config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20251207/[email protected]/config) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) rustc: rustc 1.88.0 (6b00bc388 2025-06-23) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251207/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from arch/x86/purgatory/purgatory.c:18:
>> arch/x86/purgatory/../boot/string.h:11:7: error: expected identifier or '('
11 | void *memmove(void *dst, const void *src, size_t len);
| ^
include/linux/fortify-string.h:694:27: note: expanded from macro 'memmove'
694 | #define memmove(p, q, s) __fortify_memcpy_chk(p, q, s, \
| ^
include/linux/fortify-string.h:626:42: note: expanded from macro '__fortify_memcpy_chk'
626 | p_size_field, q_size_field, op) ({ \
| ^
In file included from arch/x86/purgatory/purgatory.c:18:
>> arch/x86/purgatory/../boot/string.h:11:7: error: expected ')'
include/linux/fortify-string.h:694:27: note: expanded from macro 'memmove'
694 | #define memmove(p, q, s) __fortify_memcpy_chk(p, q, s, \
| ^
include/linux/fortify-string.h:626:42: note: expanded from macro '__fortify_memcpy_chk'
626 | p_size_field, q_size_field, op) ({ \
| ^
arch/x86/purgatory/../boot/string.h:11:7: note: to match this '('
include/linux/fortify-string.h:694:27: note: expanded from macro 'memmove'
694 | #define memmove(p, q, s) __fortify_memcpy_chk(p, q, s, \
| ^
include/linux/fortify-string.h:626:41: note: expanded from macro '__fortify_memcpy_chk'
626 | p_size_field, q_size_field, op) ({ \
| ^
In file included from arch/x86/purgatory/purgatory.c:18:
arch/x86/purgatory/../boot/string.h:23:15: error: expected identifier or '('
23 | extern size_t strlen(const char *s);
| ^
include/linux/fortify-string.h:258:2: note: expanded from macro 'strlen'
258 | __builtin_choose_expr(__is_constexpr(__builtin_strlen(p)), \
| ^3 errors generated.
vim +11 arch/x86/purgatory/../boot/string.h
c041b5ad8640dd Vivek Goyal 2014-03-18 9
c041b5ad8640dd Vivek Goyal 2014-03-18 10 void *memcpy(void *dst, const void *src, size_t len); bc7aaf52f96367 Kees Cook 2021-11-19 @11 void *memmove(void *dst, const void *src, size_t len); c041b5ad8640dd Vivek Goyal 2014-03-18 12 void *memset(void *dst, int c, size_t len); fb4cac573ef6dc Vivek Goyal 2014-03-18 13 int memcmp(const void *s1, const void *s2, size_t len); bc7aaf52f96367 Kees Cook 2021-11-19 14 int bcmp(const void *s1, const void *s2, size_t len);
c041b5ad8640dd Vivek Goyal 2014-03-18 15
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [PATCH v3 4/4] tracing: move tracing declarations from kernel.h to a dedicated header
In reply to Yury Norov (NVIDIA)Quoted 10 lines · On Fri, 5 Dec 2025 12:52:35 -0500 "Yury Norov (NVIDIA)"…
Tracing is a half of the
kernel.hin terms of LOCs, although it's a self-consistent part. It is intended for quick debugging purposes and isn't used by the normal tracing utilities.Move it to a separate header. If someone needs to just throw a
trace_printk()in their driver, they will not have to pull all the heavy tracing machinery.This is a pure move, except for removing a few 'extern's.
This one blows up my x86_64 allmodconfig, gcc-15.2.0:
In file included from ./include/linux/string.h:386,
from ./include/linux/trace_printk.h:9,
from ./include/linux/kernel.h:34,
from arch/x86/purgatory/purgatory.c:12:./include/linux/fortify-string.h:626:63: error: expected identifier or '(' before '{' token
626 | p_size_field, q_size_field, op) ({ \
| ^./include/linux/fortify-string.h:694:27: note: in expansion of macro '__fortify_memcpy_chk'
694 | #define memmove(p, q, s) __fortify_memcpy_chk(p, q, s, \
| ^~~~~~~~~~~~~~~~~~~~
arch/x86/purgatory/../boot/string.h:11:7: note: in expansion of macro 'memmove'
11 | void *memmove(void *dst, const void *src, size_t len);
| ^~~~~~~
./include/linux/fortify-string.h:258:9: error: expected identifier or '(' before '__builtin_choose_expr'
258 | __builtin_choose_expr(__is_constexpr(__builtin_strlen(p)), \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/purgatory/../boot/string.h:23:15: note: in expansion of macro 'strlen'
23 | extern size_t strlen(const char *s);
| ^~~~~~make[4]: *** [scripts/Makefile.build:287: arch/x86/purgatory/purgatory.o] Error 1 make[3]: *** [scripts/Makefile.build:556: arch/x86/purgatory] Error 2 make[2]: *** [scripts/Makefile.build:556: arch/x86] Error 2
make[1]: *** [/usr/src/25/Makefile:2054: .] Error 2
make: *** [Makefile:248: __sub-make] Error 2
Re: [PATCH v3 4/4] tracing: move tracing declarations from kernel.h to a dedicated header
Quoted 6 lines · Andrew Morton
Quoted 4 lines · On Fri, 5 Dec 2025 12:52:35 -0500 "Yury Norov (NVIDIA)"…
Tracing is a half of the
kernel.hin terms of LOCs, although it's a self-consistent part. It is intended for quick debugging purposes and isn't used by the normal tracing utilities.
Quoted 8 lines
Quoted 6 lines
Move it to a separate header. If someone needs to just throw a
trace_printk()in their driver, they will not have to pull all the heavy tracing machinery.This is a pure move, except for removing a few 'extern's.
This one blows up my
x86_64allmodconfig, gcc-15.2.0:
Thanks, Andrew. I'll take a look.
Randy Dunlap
reviewerRe: [PATCH v3 4/4] tracing: move tracing declarations from kernel.h to a dedicated header
In reply to Andrew Morton[adding Kees]
Quoted 6 lines · Andrew Morton
Quoted 4 lines · On Fri, 5 Dec 2025 12:52:35 -0500 "Yury Norov (NVIDIA)"…
Tracing is a half of the
kernel.hin terms of LOCs, although it's a self-consistent part. It is intended for quick debugging purposes and isn't used by the normal tracing utilities.
Quoted 6 lines
Quoted 6 lines
Move it to a separate header. If someone needs to just throw a
trace_printk()in their driver, they will not have to pull all the heavy tracing machinery.This is a pure move, except for removing a few 'extern's.
Hm, for a pure move, this shouldn't be necessary. Anyway, not using FORTIFY in purgatory.o fixes this build error.
Or maybe there's a better answer.
--- arch/x86/purgatory/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/purgatory/Makefile +1 -1
@@ -62,7 +62,7 @@ PURGATORY_CFLAGS_REMOVE += $(CC_FLAGS_C endif CFLAGS_REMOVE_purgatory.o += $(PURGATORY_CFLAGS_REMOVE) -CFLAGS_purgatory.o += $(PURGATORY_CFLAGS) +CFLAGS_purgatory.o += $(PURGATORY_CFLAGS) -D__NO_FORTIFY CFLAGS_REMOVE_sha256.o += $(PURGATORY_CFLAGS_REMOVE) CFLAGS_sha256.o += $(PURGATORY_CFLAGS)
Quoted 28 lines
This one blows up my
x86_64allmodconfig, gcc-15.2.0:In file included from
./include/linux/string.h:386,from ./include/linux/trace_printk.h:9, from ./include/linux/kernel.h:34, from arch/x86/purgatory/purgatory.c:12:
./include/linux/fortify-string.h:626:63: error: expected identifier or '(' before '{' token
626 |p_size_field,q_size_field, op) ({ \
| ^./include/linux/fortify-string.h:694:27: note: in expansion of macro '__fortify_memcpy_chk'694 | #define memmove(p, q, s) __fortify_memcpy_chk(p, q, s, \ | ^~~~~~~~~~~~~~~~~~~~ arch/x86/purgatory/../boot/string.h:11:7: note: in expansion of macro 'memmove' 11 | void *memmove(void *dst, const void *src, size_t len); | ^~~~~~~ ./include/linux/fortify-string.h:258:9: error: expected identifier or '(' before '__builtin_choose_expr' 258 | __builtin_choose_expr(__is_constexpr(__builtin_strlen(p)), \ | ^~~~~~~~~~~~~~~~~~~~~ arch/x86/purgatory/../boot/string.h:23:15: note: in expansion of macro 'strlen' 23 | extern size_t strlen(const char *s); | ^~~~~~make[4]: *** [
scripts/Makefile.build:287:arch/x86/purgatory/purgatory.o] Error 1 make[3]: *** [scripts/Makefile.build:556:arch/x86/purgatory] Error 2 make[2]: *** [scripts/Makefile.build:556:arch/x86] Error 2
make[1]: *** [/usr/src/25/Makefile:2054: .] Error 2
make: *** [Makefile:248: __sub-make] Error 2
Signature · 1 line
~Randy
Re: [PATCH v3 4/4] tracing: move tracing declarations from kernel.h to a dedicated header
Quoted 27 lines · Randy Dunlap
[adding Kees]
Quoted 6 lines · Andrew Morton
Quoted 4 lines · On Fri, 5 Dec 2025 12:52:35 -0500 "Yury Norov (NVIDIA)"…
Tracing is a half of the
kernel.hin terms of LOCs, although it's a self-consistent part. It is intended for quick debugging purposes and isn't used by the normal tracing utilities.Quoted 6 lines
Quoted 6 lines
Move it to a separate header. If someone needs to just throw a
trace_printk()in their driver, they will not have to pull all the heavy tracing machinery.This is a pure move, except for removing a few 'extern's.
Hm, for a pure move, this shouldn't be necessary. Anyway, not using FORTIFY in purgatory.o fixes this build error.
Or maybe there's a better answer.--- arch/x86/purgatory/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/purgatory/Makefile PURGATORY_CFLAGS_REMOVE += $(CC_FLAGS_C · line 68
Quoted 8 lines
arch/x86/purgatory/Makefile +1
-1@@ -62,7 +62,7 @@ PURGATORY_CFLAGS_REMOVE += $(CC_FLAGS_C endif CFLAGS_REMOVE_purgatory.o += $(PURGATORY_CFLAGS_REMOVE) -CFLAGS_purgatory.o += $(PURGATORY_CFLAGS) +CFLAGS_purgatory.o += $(PURGATORY_CFLAGS) -D__NO_FORTIFY CFLAGS_REMOVE_sha256.o += $(PURGATORY_CFLAGS_REMOVE) CFLAGS_sha256.o += $(PURGATORY_CFLAGS)
That happened because the new trace_printk.h includes string.h for strlen(), so all kernel.h users now indirectly include it, and it causes, seemingly, a circular dependency if FORTIFY is enabled.
A fix would be dropping trace_printk.h from kernel.h, or switching the only user of string.h, trace_puts(), to __builtin_strlen().
Notice, Andy has concerned about this on the previous round, and also suggested __builtin_strlen():
https://lkml.org/lkml/2025/12/3/910
I deem to drop trace_printk.h from kernel.h - it is more aligned with the idea of unloading the header. The original motivation to keep trace_printk.h in kernel.h was just because a similar printk.h is living there. But after all, this is a purely debugging header, so no need for almost every C file to bear debugging stuff.
I can actually do both - switch to an intrinsic and drop the header.
Guys, please let me know what do you thing.
Thanks,
Yury
Randy Dunlap
reviewerRe: [PATCH v3 4/4] tracing: move tracing declarations from kernel.h to a dedicated header
Quoted 55 lines · Yury Norov
Quoted 27 lines · Randy Dunlap
[adding Kees]
Quoted 6 lines · Andrew Morton
Quoted 4 lines · On Fri, 5 Dec 2025 12:52:35 -0500 "Yury Norov (NVIDIA)"…
Tracing is a half of the
kernel.hin terms of LOCs, although it's a self-consistent part. It is intended for quick debugging purposes and isn't used by the normal tracing utilities.Quoted 6 lines
Quoted 6 lines
Move it to a separate header. If someone needs to just throw a
trace_printk()in their driver, they will not have to pull all the heavy tracing machinery.This is a pure move, except for removing a few 'extern's.
Hm, for a pure move, this shouldn't be necessary. Anyway, not using FORTIFY in purgatory.o fixes this build error.
Or maybe there's a better answer.--- arch/x86/purgatory/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/purgatory/Makefile PURGATORY_CFLAGS_REMOVE += $(CC_FLAGS_C · line 68
Quoted 8 lines
arch/x86/purgatory/Makefile +1
-1@@ -62,7 +62,7 @@ PURGATORY_CFLAGS_REMOVE += $(CC_FLAGS_C endif CFLAGS_REMOVE_purgatory.o += $(PURGATORY_CFLAGS_REMOVE) -CFLAGS_purgatory.o += $(PURGATORY_CFLAGS) +CFLAGS_purgatory.o += $(PURGATORY_CFLAGS) -D__NO_FORTIFY CFLAGS_REMOVE_sha256.o += $(PURGATORY_CFLAGS_REMOVE) CFLAGS_sha256.o += $(PURGATORY_CFLAGS)That happened because the new
trace_printk.hincludesstring.hforstrlen(), so allkernel.husers now indirectly include it, and it causes, seemingly, a circular dependency if FORTIFY is enabled.A fix would be dropping
trace_printk.hfromkernel.h, or switching the only user ofstring.h,trace_puts(), to__builtin_strlen().Notice, Andy has concerned about this on the previous round, and also suggested
__builtin_strlen():https://lkml.org/lkml/2025/12/3/910I deem to drop
trace_printk.hfromkernel.h- it is more aligned with the idea of unloading the header. The original motivation to keeptrace_printk.hinkernel.hwas just because a similarprintk.his living there. But after all, this is a purely debugging header, so no need for almost every C file to bear debugging stuff.
Quoted 3 lines
I can actually do both - switch to an intrinsic and drop the header.
Guys, please let me know what do you thing.
There are some problems with using __builtin_mem{cpy,set} -- don't know about __builtin_str{whatever}. See
commit 4ce97317f41d
Author: Nick Desaulniers <[email protected]> Date: Wed Aug 7 15:15:32 2019 -0700
x86/purgatory: Do not use __builtin_memcpy and __builtin_memset
We should drop the header from kernel.h soon anyway, whether now or in a few weeks/months. IMHO.
Signature · 1 line
~Randy
Steven Rostedt
maintainerRe: [PATCH v3 4/4] tracing: move tracing declarations from kernel.h to a dedicated header
In reply to Yury NorovQuoted 5 lines · On Wed, 17 Dec 2025 22:59:33 -0500 Yury Norov <[email protected]> wrote:
I deem to drop
trace_printk.hfromkernel.h- it is more aligned with the idea of unloading the header. The original motivation to keeptrace_printk.hinkernel.hwas just because a similarprintk.his living there. But after all, this is a purely debugging header, so no need for almost every C file to bear debugging stuff.
It is a big deal for debugging stuff. A lot of developers debug their code with trace_printk(), and do the "shotgun approach", where they cut and paste trace_printk()s all over their code in several files. Having to now add:
#include <linux/trace_printk.h>
whenever a trace_printk() is added is going to be a big PITA and slow down all debugging efforts.
-- Steve
Steven Rostedt
maintainerRe: [PATCH v3 4/4] tracing: move tracing declarations from kernel.h to a dedicated header
Quoted 9 lines · On Thu, 18 Dec 2025 12:33:49 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 5 lines · On Wed, 17 Dec 2025 22:59:33 -0500 Yury Norov <[email protected]> wrote:
I deem to drop
trace_printk.hfromkernel.h- it is more aligned with the idea of unloading the header. The original motivation to keeptrace_printk.hinkernel.hwas just because a similarprintk.his living there. But after all, this is a purely debugging header, so no need for almost every C file to bear debugging stuff.
Quoted 9 lines
It is a big deal for debugging stuff. A lot of developers debug their code with
trace_printk(), and do the "shotgun approach", where they cut and paste trace_printk()s all over their code in several files. Having to now add:#include <linux/trace_printk.h>whenever a
trace_printk()is added is going to be a big PITA and slow down all debugging efforts.
I don't actually remember why I had __trace_puts() pass in the size. I could change it to:
include/linux/kernel.h +2 -2
@@ -331,10 +331,10 @@ int __trace_printk(unsigned long ip, const char *fmt, ...);if (__builtin_constant_p (str)) \__trace_bputs (_THIS_IP_, trace_printk_fmt); \else \ -__trace_puts (_THIS_IP_, str,strlen (str)); \ +__trace_puts (_THIS_IP_, str); \ })extern int __trace_bputs (unsigned long ip,const char *str); -extern int __trace_puts (unsigned long ip,const char *str,int size); +extern int __trace_puts (unsigned long ip,const char *str);extern void trace_dump_stack (int skip);
kernel/trace/trace.c +3 -4
@@ -1178,11 +1178,10 @@ EXPORT_SYMBOL_GPL(__trace_array_puts);* __trace_puts - write a constant string into the trace buffer. * @ip: The address of the caller * @str: The constant string to write -* @size: The size of the string. */ -int __trace_puts (unsigned long ip,const char *str,int size) +int __trace_puts (unsigned long ip,const char *str) { -return __trace_array_puts (printk_trace, ip, str, size); +return __trace_array_puts (printk_trace, ip, str,strlen (str)); }EXPORT_SYMBOL_GPL (__trace_puts);
@@ -1201,7 +1200,7 @@ int __trace_bputs(unsigned long ip, const char *str)int size =sizeof (struct bputs_entry );if (!printk_binsafe (tr)) -return __trace_puts (ip, str,strlen (str)); +return __trace_puts (ip, str);if (!(tr->trace_flags &TRACE_ITER (PRINTK )))return 0 ;
kernel/trace/trace.h +1 -1
@@ -2116,7 +2116,7 @@ extern void tracing_log_err(struct trace_array *tr,* about performance). The internal_trace_puts() is for such * a purpose. */ -#define internal_trace_puts (str) __trace_puts(_THIS_IP_, str, strlen(str)) +#define internal_trace_puts (str) __trace_puts(_THIS_IP_, str)#undef FTRACE_ENTRY#define FTRACE_ENTRY (call, struct_name, id, tstruct, print) \
Which removes the strlen() altogether.
-- Steve
Re: [PATCH v3 4/4] tracing: move tracing declarations from kernel.h to a dedicated header
Quoted 16 lines · Steven Rostedt
Quoted 13 lines · On Thu, 18 Dec 2025 12:33:49 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 5 lines · On Wed, 17 Dec 2025 22:59:33 -0500 Yury Norov <[email protected]> wrote:
I deem to drop
trace_printk.hfromkernel.h- it is more aligned with the idea of unloading the header. The original motivation to keeptrace_printk.hinkernel.hwas just because a similarprintk.his living there. But after all, this is a purely debugging header, so no need for almost every C file to bear debugging stuff.It is a big deal for debugging stuff. A lot of developers debug their code with
trace_printk(), and do the "shotgun approach", where they cut and paste trace_printk()s all over their code in several files. Having to now add:
Quoted 8 lines
Quoted 5 lines
#include <linux/trace_printk.h>whenever a
trace_printk()is added is going to be a big PITA and slow down all debugging efforts.I don't actually remember why I had
__trace_puts()pass in the size. I could change it to:
This is the best approach. I'll schedule it for v4. Would you like me to take it as-is, or you'd send a patch?
Quoted 63 lines
include/linux/kernel.h +2
-2@@ -331,10 +331,10 @@ int __trace_printk(unsigned long ip, const char *fmt, ...);if (__builtin_constant_p (str)) \__trace_bputs (_THIS_IP_, trace_printk_fmt); \else \ -__trace_puts (_THIS_IP_, str,strlen (str)); \ +__trace_puts (_THIS_IP_, str); \ })extern int __trace_bputs (unsigned long ip,const char *str); -extern int __trace_puts (unsigned long ip,const char *str,int size); +extern int __trace_puts (unsigned long ip,const char *str);extern void trace_dump_stack (int skip);kernel/trace/trace.c +3
-4@@ -1178,11 +1178,10 @@ EXPORT_SYMBOL_GPL(__trace_array_puts);* __trace_puts - write a constant string into the trace buffer. * @ip: The address of the caller * @str: The constant string to write -* @size: The size of the string. */ -int __trace_puts (unsigned long ip,const char *str,int size) +int __trace_puts (unsigned long ip,const char *str) { -return __trace_array_puts (printk_trace, ip, str, size); +return __trace_array_puts (printk_trace, ip, str,strlen (str)); }EXPORT_SYMBOL_GPL (__trace_puts);@@ -1201,7 +1200,7 @@ int __trace_bputs(unsigned long ip, const char *str)int size =sizeof (struct bputs_entry );if (!printk_binsafe (tr)) -return __trace_puts (ip, str,strlen (str)); +return __trace_puts (ip, str);if (!(tr->trace_flags &TRACE_ITER (PRINTK )))return 0 ;kernel/trace/trace.h +1
-1@@ -2116,7 +2116,7 @@ extern void tracing_log_err(struct trace_array *tr,* about performance). The internal_trace_puts() is for such * a purpose. */ -#define internal_trace_puts (str) __trace_puts(_THIS_IP_, str, strlen(str)) +#define internal_trace_puts (str) __trace_puts(_THIS_IP_, str)#undef FTRACE_ENTRY#define FTRACE_ENTRY (call, struct_name, id, tstruct, print) \Which removes the
strlen()altogether.-- Steve
Steven Rostedt
maintainerRe: [PATCH v3 4/4] tracing: move tracing declarations from kernel.h to a dedicated header
Quoted 6 lines · On Thu, 18 Dec 2025 15:33:47 -0500 Yury Norov <[email protected]> wrote:
Quoted 2 lines
I don't actually remember why I had
__trace_puts()pass in the size. I could change it to:This is the best approach. I'll schedule it for v4. Would you like me to take it as-is, or you'd send a patch?
Let me send an official patch.
-- Steve
Steven Rostedt
maintainerRe: [PATCH v3 4/4] tracing: move tracing declarations from kernel.h to a dedicated header
Quoted 12 lines · On Thu, 18 Dec 2025 16:25:42 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 6 lines · On Thu, 18 Dec 2025 15:33:47 -0500 Yury Norov <[email protected]> wrote:
Quoted 2 lines
I don't actually remember why I had
__trace_puts()pass in the size. I could change it to:This is the best approach. I'll schedule it for v4. Would you like me to take it as-is, or you'd send a patch?
Let me send an official patch.
You can find it here (I Cc'd you too). Feel free to add it to your patch set.
https://lore.kernel.org/all/[email protected]/
-- Steve
Re: [PATCH v3 4/4] tracing: move tracing declarations from kernel.h to a dedicated header
Quoted 13 lines · Steven Rostedt
Quoted 10 lines · On Thu, 18 Dec 2025 16:25:42 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 6 lines · On Thu, 18 Dec 2025 15:33:47 -0500 Yury Norov <[email protected]> wrote:
Quoted 2 lines
I don't actually remember why I had
__trace_puts()pass in the size. I could change it to:This is the best approach. I'll schedule it for v4. Would you like me to take it as-is, or you'd send a patch?
Quoted 6 lines
Quoted 2 lines
Let me send an official patch.
You can find it here (I Cc'd you too). Feel free to add it to your patch set.
Thanks, will do.
Randy Dunlap
reviewerRe: [PATCH v3 4/4] tracing: move tracing declarations from kernel.h to a dedicated header
In reply to Steven RostedtQuoted 9 lines · Steven Rostedt
Quoted 5 lines · On Wed, 17 Dec 2025 22:59:33 -0500 Yury Norov <[email protected]> wrote:
I deem to drop
trace_printk.hfromkernel.h- it is more aligned with the idea of unloading the header. The original motivation to keeptrace_printk.hinkernel.hwas just because a similarprintk.his living there. But after all, this is a purely debugging header, so no need for almost every C file to bear debugging stuff.
Quoted 8 lines
It is a big deal for debugging stuff. A lot of developers debug their code with
trace_printk(), and do the "shotgun approach", where they cut and paste trace_printk()s all over their code in several files. Having to now add:#include <linux/trace_printk.h>whenever a
trace_printk()is added is going to be a big PITA and slow down all debugging efforts.
Eh? Maybe a PITA, but surely not a big one.
Slow down "all debugging efforts?"
Please cut down on the hyperbole.
Signature · 1 line
~Randy
Re: [PATCH v3 4/4] tracing: move tracing declarations from kernel.h to a dedicated header
Quoted 16 lines · Randy Dunlap
Quoted 13 lines · Steven Rostedt
Quoted 5 lines · On Wed, 17 Dec 2025 22:59:33 -0500 Yury Norov <[email protected]> wrote:
I deem to drop
trace_printk.hfromkernel.h- it is more aligned with the idea of unloading the header. The original motivation to keeptrace_printk.hinkernel.hwas just because a similarprintk.his living there. But after all, this is a purely debugging header, so no need for almost every C file to bear debugging stuff.It is a big deal for debugging stuff. A lot of developers debug their code with
trace_printk(), and do the "shotgun approach", where they cut and paste trace_printk()s all over their code in several files. Having to now add:
Quoted 8 lines
Quoted 4 lines
#include <linux/trace_printk.h>whenever a
trace_printk()is added is going to be a big PITA and slow down all debugging efforts.Eh? Maybe a PITA, but surely not a big one.
Slow down "all debugging efforts?"
Please cut down on the hyperbole.
For me, removing trace_prink.h saves 1.5-2% of compile time:
Before:
#1 real 5m12.602s
#2 real 5m11.333s
After:
#1 real 5m6.190s
#2 real 5m7.151s
I'm building ubuntu-derived localyesconfig with a couple extra drivers. Steven, if you're not absolutely against, lets drop the trace_printk.h?
Thanks,
Yury
Patchwork
CI✗ LGCI.VerificationFailed: failure for Unload linux/kernel.h (rev4)
In reply to Yury Norov (NVIDIA)== Series Details ==
== Series Details ==
Series: Unload linux/kernel.h (rev4)
URL : https://patchwork.freedesktop.org/series/158239/
State : failure
== Summary ==
Address '[email protected]' is not on the allowlist, which prevents CI from being triggered for this patch. If you want Intel GFX CI to accept this address, please contact the script maintainers at [email protected]. Exception occurred during validation, bailing out!