Skip to contentSkip to conversation

follow up patches for panic_print's generalization

PATCH Superseded Feng Tang 4 participants 19 messages Aug 15, 2025 – Aug 25, 2025

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Feng Tang

author
#0 lore raw

cover follow up patches for panic_print's generalization

Generalization of panic_print's dump function [1] has been merged, and this patchset is to address some remaining issues, like adding note of the obsoletion of 'panic_print' cmdline parameter, refining the kernel document for panic_print, and hardening some string management.

Please help to review!

Feng Tang (3):
lib/sys_info: handle sys_info_mask==0 case
panic: refine the document for 'panic_print'
panic: add note that 'panic_print' parameter is deprecated

 .../admin-guide/kernel-parameters.txt         |  2 +-
 Documentation/admin-guide/sysctl/kernel.rst   |  2 +-
 include/linux/moduleparam.h                   | 14 ++++++++++++++
 kernel/panic.c                                | 19 ++++++++++++++++++-
 lib/sys_info.c                                |  5 ++++-
 5 files changed, 38 insertions(+), 4 deletions(-)
Signature · 1 line
2.43.5
author
#1 lore raw

PATCH 1/3 lib/sys_info: handle sys_info_mask==0 case

It is a normal case that bitmask parameter is 0, so pre-initialize the names[] to null string to cover this case.

Also remove the superfluous "+1" in names[sizeof(sys_info_avail) + 1], which is needed for 'strlen()', but not for 'sizeof()'.

---
 lib/sys_info.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
lib/sys_info.c +4 -1
index 5bf503fd7ec1..b2df148971ba 100644
@@ -55,7 +55,7 @@ int sysctl_sys_info_handler(const struct ctl_table *ro_table, int write,
 					  void *buffer, size_t *lenp,
 					  loff_t *ppos)
 {
-	char names[sizeof(sys_info_avail) + 1];
+	char names[sizeof(sys_info_avail)];
 	struct ctl_table table;
 	unsigned long *si_bits_global;
 
@@ -81,6 +81,9 @@ int sysctl_sys_info_handler(const struct ctl_table *ro_table, int write,
 		char *delim = "";
 		int i, len = 0;
 
+		/* *si_bits_glabl could be 0 */
+		names[0] = '\0';
+
 		for (i = 0; i < ARRAY_SIZE(si_names); i++) {
 			if (*si_bits_global & si_names[i].bit) {
 				len += scnprintf(names + len, sizeof(names) - len,
Signature · 1 line
2.43.5
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] lib/sys_info: handle sys_info_mask==0 case

Quoted 18 lines · Feng Tang

It is a normal case that bitmask parameter is 0, so pre-initialize the names[] to null string to cover this case.

Also remove the superfluous "+1" in names[sizeof(sys_info_avail) + 1], which is needed for 'strlen()', but not for 'sizeof()'.

lib/sys_info.c +1 -1
@@ -55,7 +55,7 @@ int sysctl_sys_info_handler(const struct ctl_table *ro_table, int write,
 					  void *buffer, size_t *lenp,
 					  loff_t *ppos)
 {
-	char names[sizeof(sys_info_avail) + 1];
+	char names[sizeof(sys_info_avail)];
 	struct ctl_table table;
 	unsigned long *si_bits_global;
 

lib/sys_info.c int sysctl_sys_info_handler(const struct ctl_table *ro_table, int write, · line 84

Quoted 4 lines
lib/sys_info.c +1 -0
@@ -81,6 +81,9 @@ int sysctl_sys_info_handler(const struct ctl_table *ro_table, int write,
 		char *delim = "";
 		int i, len = 0;
 
+		/* *si_bits_glabl could be 0 */

s/si_bits_glabl/si_bits_global/

But I would personally remove the comment completely. IMHO, the purpose is quite obvious. But I do not resist on it.

lib/sys_info.c int sysctl_sys_info_handler(const struct ctl_table *ro_table, int write, · line 89

Quoted 5 lines
lib/sys_info.c +2 -0
+		names[0] = '\0';
+
 		for (i = 0; i < ARRAY_SIZE(si_names); i++) {
 			if (*si_bits_global & si_names[i].bit) {
 				len += scnprintf(names + len, sizeof(names) - len,

Otherwise, it looks good to me:

Best Regards,
Petr

author
#3 lore raw

Re: [PATCH 1/3] lib/sys_info: handle sys_info_mask==0 case

Quoted 22 lines · Petr Mladek
Quoted 21 lines · Feng Tang

It is a normal case that bitmask parameter is 0, so pre-initialize the names[] to null string to cover this case.

Also remove the superfluous "+1" in names[sizeof(sys_info_avail) + 1], which is needed for 'strlen()', but not for 'sizeof()'.

lib/sys_info.c +1 -1
@@ -55,7 +55,7 @@ int sysctl_sys_info_handler(const struct ctl_table *ro_table, int write,
 					  void *buffer, size_t *lenp,
 					  loff_t *ppos)
 {
-	char names[sizeof(sys_info_avail) + 1];
+	char names[sizeof(sys_info_avail)];
 	struct ctl_table table;
 	unsigned long *si_bits_global;
 
@@ -81,6 +81,9 @@ int sysctl_sys_info_handler(const struct ctl_table *ro_table, int write,
 		char *delim = "";
 		int i, len = 0;
 
Quoted 6 lines

lib/sys_info.c int sysctl_sys_info_handler(const struct ctl_table *ro_table, int write, · line 84

Quoted 1 line
lib/sys_info.c +1 -0
+		/* *si_bits_glabl could be 0 */

s/si_bits_glabl/si_bits_global/

But I would personally remove the comment completely. IMHO, the purpose is quite obvious. But I do not resist on it.

Will remove.

Quoted 10 lines

lib/sys_info.c int sysctl_sys_info_handler(const struct ctl_table *ro_table, int write, · line 89

Quoted 6 lines
lib/sys_info.c +2 -0
+		names[0] = '\0';
+
 		for (i = 0; i < ARRAY_SIZE(si_names); i++) {
 			if (*si_bits_global & si_names[i].bit) {
 				len += scnprintf(names + len, sizeof(names) - len,

Otherwise, it looks good to me:

Thank you! will resend a v2 patchset.

- Feng

Quoted 3 lines

Best Regards,
Petr

author
#4 lore raw

PATCH 2/3 panic: refine the document for 'panic_print'

In reply to Feng Tang

User reported current document about SYS_INFO_PANIC_CONSOLE_REPLAY is confusing, that people could expect all user space console messages to be replayed.

Specify that only 'kernel' messages will be replayed to solve the confusion.

---
 Documentation/admin-guide/kernel-parameters.txt | 2 +-
 Documentation/admin-guide/sysctl/kernel.rst     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +1 -1
index 747a55abf494..86f395f2933b 100644
@@ -4589,7 +4589,7 @@
 			bit 2: print timer info
 			bit 3: print locks info if CONFIG_LOCKDEP is on
 			bit 4: print ftrace buffer
-			bit 5: replay all messages on consoles at the end of panic
+			bit 5: replay all kernel messages on consoles at the end of panic
 			bit 6: print all CPUs backtrace (if available in the arch)
 			bit 7: print only tasks in uninterruptible (blocked) state
 			*Be aware* that this option may print a _lot_ of lines,
Documentation/admin-guide/sysctl/kernel.rst +1 -1
index 8b49eab937d0..f3ee807b5d8b 100644
@@ -890,7 +890,7 @@ bit 1  print system memory info
 bit 2  print timer info
 bit 3  print locks info if ``CONFIG_LOCKDEP`` is on
 bit 4  print ftrace buffer
-bit 5  replay all messages on consoles at the end of panic
+bit 5  replay all kernel messages on consoles at the end of panic
 bit 6  print all CPUs backtrace (if available in the arch)
 bit 7  print only tasks in uninterruptible (blocked) state
 =====  ============================================
Signature · 1 line
2.43.5
Reviewed-by on v1 2/3
#5 lore raw

Re: [PATCH 2/3] panic: refine the document for 'panic_print'

Quoted 8 lines · Feng Tang

User reported current document about SYS_INFO_PANIC_CONSOLE_REPLAY is confusing, that people could expect all user space console messages to be replayed.

Specify that only 'kernel' messages will be replayed to solve the confusion.

Looks good to me:

Best Regards,
Petr

author
#6 lore raw

PATCH 3/3 panic: add note that 'panic_print' parameter is deprecated

In reply to Feng Tang

Just like for 'panic_print's systcl interface, add similar note for setup of kernel cmdline parameter and parameter under /sys/module/kernel/.

Also add __core_param_cb() macro, which enables to add special get/set operation for a kernel parameter.

---
 include/linux/moduleparam.h | 14 ++++++++++++++
 kernel/panic.c              | 19 ++++++++++++++++++-
 2 files changed, 32 insertions(+), 1 deletion(-)
include/linux/moduleparam.h +14 -0
index 3a25122d83e2..381c3779244c 100644
@@ -199,6 +199,7 @@ struct kparam_array
 #define core_param_cb(name, ops, arg, perm)		\
 	__level_param_cb(name, ops, arg, perm, 1)
 
+
 /**
  * postcore_param_cb - general callback for a module/cmdline parameter
  *                     to be evaluated before postcore initcall level
@@ -349,6 +350,19 @@ static inline void kernel_param_unlock(struct module *mod)
 	__module_param_call("", name, &param_ops_##type, &var, perm,	\
 			    -1, KERNEL_PARAM_FL_UNSAFE)
 
+/**
+ * __core_param_cb - similar like core_param, with a set/get ops instead of type.
+ * @name: the name of the cmdline and sysfs parameter (often the same as var)
+ * @var: the variable
+ * @ops: the set & get operations for this parameter.
+ * @perm: visibility in sysfs
+ *
+ * Ideally this should be called 'core_param_cb', but the name has been
+ * used for module core parameter, so add the '__' prefix
+ */
+#define __core_param_cb(name, ops, arg, perm) \
+	__module_param_call("", name, ops, arg, perm, -1, 0)
+
 #endif /* !MODULE */
 
 /**
kernel/panic.c +18 -1
index 72fcbb5a071b..12a10e17ab4a 100644
@@ -937,12 +937,29 @@ EXPORT_SYMBOL(__stack_chk_fail);
 #endif
 
 core_param(panic, panic_timeout, int, 0644);
-core_param(panic_print, panic_print, ulong, 0644);
 core_param(pause_on_oops, pause_on_oops, int, 0644);
 core_param(panic_on_warn, panic_on_warn, int, 0644);
 core_param(crash_kexec_post_notifiers, crash_kexec_post_notifiers, bool, 0644);
 core_param(panic_console_replay, panic_console_replay, bool, 0644);
 
+static int panic_print_set(const char *val, const struct kernel_param *kp)
+{
+	pr_info_once("Kernel: 'panic_print' parameter will be obsoleted by both 'panic_sys_info' and 'panic_console_replay'\n");
+	return  param_set_ulong(val, kp);
+}
+
+static int panic_print_get(char *val, const struct kernel_param *kp)
+{
+	pr_info_once("Kernel: 'panic_print' parameter will be obsoleted by both 'panic_sys_info' and 'panic_console_replay'\n");
+	return  param_get_ulong(val, kp);
+}
+
+static const struct kernel_param_ops panic_print_ops = {
+	.set	= panic_print_set,
+	.get	= panic_print_get,
+};
+__core_param_cb(panic_print, &panic_print_ops, &panic_print, 0644);
+
 static int __init oops_setup(char *s)
 {
 	if (!s)
Signature · 1 line
2.43.5
Reviewed-by on v1 3/3
#7 lore raw

Re: [PATCH 3/3] panic: add note that 'panic_print' parameter is deprecated

Quoted 21 lines · Feng Tang

Just like for 'panic_print's systcl interface, add similar note for setup of kernel cmdline parameter and parameter under /sys/module/kernel/.

Also add __core_param_cb() macro, which enables to add special get/set operation for a kernel parameter.

kernel/panic.c +1 -1
@@ -937,12 +937,29 @@ EXPORT_SYMBOL(__stack_chk_fail);
 #endif
 
 core_param(panic, panic_timeout, int, 0644);
-core_param(panic_print, panic_print, ulong, 0644);
 core_param(pause_on_oops, pause_on_oops, int, 0644);
 core_param(panic_on_warn, panic_on_warn, int, 0644);
 core_param(crash_kexec_post_notifiers, crash_kexec_post_notifiers, bool, 0644);
 core_param(panic_console_replay, panic_console_replay, bool, 0644);
 
+static int panic_print_set(const char *val, const struct kernel_param *kp)

kernel/panic.c EXPORT_SYMBOL(__stack_chk_fail); · line 955

Quoted 10 lines
kernel/panic.c +10 -0
+{
+	pr_info_once("Kernel: 'panic_print' parameter will be obsoleted by both 'panic_sys_info' and 'panic_console_replay'\n");
+	return  param_set_ulong(val, kp);
+}
+
+static int panic_print_get(char *val, const struct kernel_param *kp)
+{
+	pr_info_once("Kernel: 'panic_print' parameter will be obsoleted by both 'panic_sys_info' and 'panic_console_replay'\n");
+	return  param_get_ulong(val, kp);
+}

It should be enough to print the message only once and avoid duplication in the sources.

Also I would make the message more direct, something like:

	pr_info_once("Kernel: The 'panic_print' parameter is now deprecated. Please use 'panic_sys_info' and 'panic_console_replay' instead.\n");

I am going to send a followup patch. Feel free to keep this one as is:

Best Regards,
Petr

#8 lore raw

PATCH 1/1 panic: Clean up message about deprecated 'panic_print' parameter

In reply to Feng Tang

Remove duplication of the message about the deprecated 'panic_print' parameter.

Also make the wording more direct. Make it clear that the new parameters already exist and should be used instead.

---
This can be used as a follow up patch.
Or feel free to squash it into the 3rd patch.

kernel/panic.c | 11 ++++++++---

 1 file changed, 8 insertions(+), 3 deletions(-)
kernel/panic.c +8 -3
index 12a10e17ab4a..d3907fd95d72 100644
@@ -122,10 +122,15 @@ static int proc_taint(const struct ctl_table *table, int write,
 	return err;
 }
 
+static void panic_print_deprecated(void)
+{
+	pr_info_once("Kernel: The 'panic_print' parameter is now deprecated. Please use 'panic_sys_info' and 'panic_console_replay' instead.\n");
+}
+
 static int sysctl_panic_print_handler(const struct ctl_table *table, int write,
 			   void *buffer, size_t *lenp, loff_t *ppos)
 {
-	pr_info_once("Kernel: 'panic_print' sysctl interface will be obsoleted by both 'panic_sys_info' and 'panic_console_replay'\n");
+	panic_print_deprecated();
 	return proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
 }
 
@@ -944,13 +949,13 @@ core_param(panic_console_replay, panic_console_replay, bool, 0644);
 
 static int panic_print_set(const char *val, const struct kernel_param *kp)
 {
-	pr_info_once("Kernel: 'panic_print' parameter will be obsoleted by both 'panic_sys_info' and 'panic_console_replay'\n");
+	panic_print_deprecated();
 	return  param_set_ulong(val, kp);
 }
 
 static int panic_print_get(char *val, const struct kernel_param *kp)
 {
-	pr_info_once("Kernel: 'panic_print' parameter will be obsoleted by both 'panic_sys_info' and 'panic_console_replay'\n");
+	panic_print_deprecated();
 	return  param_get_ulong(val, kp);
 }
 
Signature · 1 line
2.50.1
Reviewed-by on v1 1/1
#9 lore raw

Re: [PATCH] panic: Clean up message about deprecated 'panic_print' parameter

Quoted 7 lines · Petr Mladek

Remove duplication of the message about the deprecated 'panic_print' parameter.

Also make the wording more direct. Make it clear that the new parameters already exist and should be used instead.

Nice cleanup! This makes the code cleaner and the message more direct. So, feel free to add:

Thanks,
Lance

Quoted 44 lines

---
This can be used as a follow up patch.
Or feel free to squash it into the 3rd patch.

kernel/panic.c | 11 ++++++++---

  1 file changed, 8 insertions(+), 3 deletions(-)
kernel/panic.c +8 -3
index 12a10e17ab4a..d3907fd95d72 100644
@@ -122,10 +122,15 @@ static int proc_taint(const struct ctl_table *table, int write,
  	return err;
  }
 
+static void panic_print_deprecated(void)
+{
+	pr_info_once("Kernel: The 'panic_print' parameter is now deprecated. Please use 'panic_sys_info' and 'panic_console_replay' instead.\n");
+}
+
  static int sysctl_panic_print_handler(const struct ctl_table *table, int write,
  			   void *buffer, size_t *lenp, loff_t *ppos)
  {
-	pr_info_once("Kernel: 'panic_print' sysctl interface will be obsoleted by both 'panic_sys_info' and 'panic_console_replay'\n");
+	panic_print_deprecated();
  	return proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
  }
 
@@ -944,13 +949,13 @@ core_param(panic_console_replay, panic_console_replay, bool, 0644);
 
  static int panic_print_set(const char *val, const struct kernel_param *kp)
  {
-	pr_info_once("Kernel: 'panic_print' parameter will be obsoleted by both 'panic_sys_info' and 'panic_console_replay'\n");
+	panic_print_deprecated();
  	return  param_set_ulong(val, kp);
  }
 
  static int panic_print_get(char *val, const struct kernel_param *kp)
  {
-	pr_info_once("Kernel: 'panic_print' parameter will be obsoleted by both 'panic_sys_info' and 'panic_console_replay'\n");
+	panic_print_deprecated();
  	return  param_get_ulong(val, kp);
  }
 
#10 lore raw

Re: [PATCH] panic: Clean up message about deprecated 'panic_print' parameter

In reply to Petr Mladek
kernel test robot noticed the following build errors:

Hi Petr,

kernel test robot noticed the following build errors:

url:    https://github.com/intel-lab-lkp/linux/commits/UPDATE-20250819-180717/Feng-Tang/lib-sys_info-handle-sys_info_mask-0-case/20250815-152131
base:   the 3th patch of https://lore.kernel.org/r/20250815071428.98041-4-feng.tang%40linux.alibaba.com
patch link:    https://lore.kernel.org/r/aKRJKZHgcxyNF3y7%40pathway.suse.cz
patch subject: [PATCH] panic: Clean up message about deprecated 'panic_print' parameter
config: i386-buildonly-randconfig-004-20250820 (https://download.01.org/0day-ci/archive/20250820/[email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250820/[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 >>):

>> kernel/panic.c:952:2: error: call to undeclared function 'panic_print_deprecated'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     952 |         panic_print_deprecated();
         |         ^
   kernel/panic.c:958:2: error: call to undeclared function 'panic_print_deprecated'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     958 |         panic_print_deprecated();
         |         ^

2 errors generated.

vim +/panic_print_deprecated +952 kernel/panic.c

949
950 static int panic_print_set(const char *val, const struct kernel_param *kp)
951 {

 > 952		panic_print_deprecated();

953 return param_set_ulong(val, kp);
954 }
955

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#11 lore raw

Re: [PATCH] panic: Clean up message about deprecated 'panic_print' parameter

Quoted 21 lines · kernel test robot

Hi Petr,

kernel test robot noticed the following build errors:

url:    https://github.com/intel-lab-lkp/linux/commits/UPDATE-20250819-180717/Feng-Tang/lib-sys_info-handle-sys_info_mask-0-case/20250815-152131
base:   the 3th patch of https://lore.kernel.org/r/20250815071428.98041-4-feng.tang%40linux.alibaba.com
patch link:    https://lore.kernel.org/r/aKRJKZHgcxyNF3y7%40pathway.suse.cz
patch subject: [PATCH] panic: Clean up message about deprecated 'panic_print' parameter
config: i386-buildonly-randconfig-004-20250820 (https://download.01.org/0day-ci/archive/20250820/[email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250820/[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 >>):

Quoted 7 lines
Quoted 1 line
Quoted 1 line

kernel/panic.c:952:2: error: call to undeclared function 'panic_print_deprecated'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

      952 |         panic_print_deprecated();
          |         ^

kernel/panic.c:958:2: error: call to undeclared function 'panic_print_deprecated'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
958 | panic_print_deprecated();
| ^
2 errors generated.

Oops, panic_print_deprecated() is defined within the #ifdef CONFIG_PROC_SYSCTL block, but it's also called from panic_print_set() and panic_print_get(), which are outside of that block.

So, we need to move the definition out of the block to a common scope where all its callers can see it. @Petr wdyt?

Thanks,
Lance

Quoted 12 lines

vim +/panic_print_deprecated +952 kernel/panic.c

    949	
    950	static int panic_print_set(const char *val, const struct kernel_param *kp)
    951	{
Quoted 1 line

952 panic_print_deprecated();

    953		return  param_set_ulong(val, kp);
    954	}
    955	
#12 lore raw

Re: [PATCH] panic: Clean up message about deprecated 'panic_print' parameter

Quoted 33 lines · Lance Yang
Quoted 21 lines · kernel test robot

Hi Petr,

kernel test robot noticed the following build errors:

url:    https://github.com/intel-lab-lkp/linux/commits/ UPDATE-20250819-180717/Feng-Tang/lib-sys_info-handle-sys_info_mask-0- case/20250815-152131 base:   the 3th patch of https://lore.kernel.org/ r/20250815071428.98041-4-feng.tang%40linux.alibaba.com
patch link:    https://lore.kernel.org/r/ aKRJKZHgcxyNF3y7%40pathway.suse.cz
patch subject: [PATCH] panic: Clean up message about deprecated 'panic_print' parameter
config: i386-buildonly-randconfig-004-20250820 (https:// download.01.org/0day-ci/archive/20250820/202508200907.PsZ3geub- [email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/ archive/20250820/[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/202508200907.PsZ3geub- [email protected]/

All errors (new ones prefixed by >>):

Quoted 7 lines
Quoted 1 line
Quoted 1 line

kernel/panic.c:952:2: error: call to undeclared function 'panic_print_deprecated'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

      952 |         panic_print_deprecated();
          |         ^
    kernel/panic.c:958:2: error: call to undeclared function 'panic_print_deprecated'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 958 |         panic_print_deprecated();
          |         ^
    2 errors generated.

Quoted 2 lines

Oops, panic_print_deprecated() is defined within the #ifdef CONFIG_PROC_SYSCTL block, but it's also called from panic_print_set()

Correction:

CONFIG_SYSCTL block - sorry ;(

Quoted 21 lines

and panic_print_get(), which are outside of that block.

So, we need to move the definition out of the block to a common scope where all its callers can see it. @Petr wdyt?

Thanks,
Lance

Quoted 12 lines

vim +/panic_print_deprecated +952 kernel/panic.c

    949
    950    static int panic_print_set(const char *val, const struct kernel_param *kp) 951    {
  > 952        panic_print_deprecated();
    953        return  param_set_ulong(val, kp);
    954    }
    955

#13 lore raw

Re: [PATCH] panic: Clean up message about deprecated 'panic_print' parameter

Quoted 36 lines · Lance Yang
Quoted 33 lines · Lance Yang
Quoted 28 lines · kernel test robot

Hi Petr,

kernel test robot noticed the following build errors:

url:    https://github.com/intel-lab-lkp/linux/commits/ UPDATE-20250819-180717/Feng-Tang/lib-sys_info-handle-sys_info_mask-0- case/20250815-152131 base:   the 3th patch of https://lore.kernel.org/ r/20250815071428.98041-4-feng.tang%40linux.alibaba.com
patch link:    https://lore.kernel.org/r/ aKRJKZHgcxyNF3y7%40pathway.suse.cz
patch subject: [PATCH] panic: Clean up message about deprecated 'panic_print' parameter
config: i386-buildonly-randconfig-004-20250820 (https:// download.01.org/0day-ci/archive/20250820/202508200907.PsZ3geub- [email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/ archive/20250820/[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/202508200907.PsZ3geub- [email protected]/

All errors (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

kernel/panic.c:952:2: error: call to undeclared function 'panic_print_deprecated'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

      952 |         panic_print_deprecated();
          |         ^
    kernel/panic.c:958:2: error: call to undeclared function 'panic_print_deprecated'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 958 |         panic_print_deprecated();
          |         ^
    2 errors generated.

Quoted 12 lines
Quoted 2 lines

Oops, panic_print_deprecated() is defined within the #ifdef CONFIG_PROC_SYSCTL block, but it's also called from panic_print_set()

Correction:

CONFIG_SYSCTL block - sorry ;(

Quoted 5 lines

and panic_print_get(), which are outside of that block.

So, we need to move the definition out of the block to a common scope where all its callers can see it. @Petr wdyt?

If Petr is cool, @Andrew could you squash the following?

---
Subject: [PATCH 1/1] fixup: panic: clean up message about deprecated
'panic_print' parameter

From: Lance Yang <[email protected]>

Moving the definition out of the CONFIG_SYSCTL block to a common scope where all its callers can see it.

---
 kernel/panic.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
kernel/panic.c +5 -5
index d3907fd95d72..24bca263f896 100644
@@ -77,6 +77,11 @@ ATOMIC_NOTIFIER_HEAD(panic_notifier_list);
 
 EXPORT_SYMBOL(panic_notifier_list);
 
+static void panic_print_deprecated(void)
+{
+	pr_info_once("Kernel: The 'panic_print' parameter is now deprecated. Please use 'panic_sys_info' and 'panic_console_replay' instead.\n");
+}
+
 #ifdef CONFIG_SYSCTL
 
 /*
@@ -122,11 +127,6 @@ static int proc_taint(const struct ctl_table *table, int write,
 	return err;
 }
 
-static void panic_print_deprecated(void)
-{
-	pr_info_once("Kernel: The 'panic_print' parameter is now deprecated. Please use 'panic_sys_info' and 'panic_console_replay' instead.\n");
-}
-
 static int sysctl_panic_print_handler(const struct ctl_table *table, 

int write,
void *buffer, size_t *lenp, loff_t *ppos)
{
--
2.49.0

Reviewed-by
#14 lore raw

Re: [PATCH] panic: Clean up message about deprecated 'panic_print' parameter

Quoted 23 lines · Lance Yang
Quoted 18 lines · Lance Yang
Quoted 17 lines · Lance Yang
Quoted 14 lines · kernel test robot

All errors (new ones prefixed by >>):

Quoted 4 lines
Quoted 4 lines

kernel/panic.c:952:2: error: call to undeclared function 'panic_print_deprecated'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

      952 |         panic_print_deprecated();
          |         ^
    kernel/panic.c:958:2: error: call to undeclared function 'panic_print_deprecated'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 958 |         panic_print_deprecated();
          |         ^
    2 errors generated.

Quoted 3 lines
Quoted 2 lines

Oops, panic_print_deprecated() is defined within the #ifdef CONFIG_PROC_SYSCTL block, but it's also called from panic_print_set()

Quoted 5 lines

If Petr is cool, @Andrew could you squash the following?

---
Subject: [PATCH 1/1] fixup: panic: clean up message about deprecated
'panic_print' parameter

The patch was malformed probably by your mail client. Below is the fixed and revied variant.
I am going to resend also the squashed version.

Here is the fixed followup patch:

From 35ded31e9ff2c9925d7a78472115c9929b582c63 Mon Sep 17 00:00:00 2001
From: Lance Yang <[email protected]>
Date: Wed, 20 Aug 2025 11:25:31 +0200
Subject: [PATCH] fixup: panic: clean up message about deprecated 'panic_print'
parameter

---
 kernel/panic.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
kernel/panic.c +5 -5
index d3907fd95d72..24bca263f896 100644
@@ -77,6 +77,11 @@ ATOMIC_NOTIFIER_HEAD(panic_notifier_list);
 
 EXPORT_SYMBOL(panic_notifier_list);
 
+static void panic_print_deprecated(void)
+{
+	pr_info_once("Kernel: The 'panic_print' parameter is now deprecated. Please use 'panic_sys_info' and 'panic_console_replay' instead.\n");
+}
+
 #ifdef CONFIG_SYSCTL
 
 /*
@@ -122,11 +127,6 @@ static int proc_taint(const struct ctl_table *table, int write,
 	return err;
 }
 
-static void panic_print_deprecated(void)
-{
-	pr_info_once("Kernel: The 'panic_print' parameter is now deprecated. Please use 'panic_sys_info' and 'panic_console_replay' instead.\n");
-}
-
 static int sysctl_panic_print_handler(const struct ctl_table *table, int write,
 			   void *buffer, size_t *lenp, loff_t *ppos)
 {
Signature · 1 line
2.50.1
#15 lore raw

PATCH v2 1/1 panic: Clean up message about deprecated 'panic_print' parameter

Remove duplication of the message about deprecated 'panic_print' parameter.

Also make the wording more direct. Make it clear that the new parameters already exist and should be used instead.

---
Changes since v1:

- fixed compilation with CONFIG_SYSCTL disabled (kernel test robot <[email protected]>)

Thanks Lance Yang <[email protected]> for debugging the compilation error reported by the test robot.

 kernel/panic.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
kernel/panic.c +8 -3
index 12a10e17ab4a..24bca263f896 100644
@@ -77,6 +77,11 @@ ATOMIC_NOTIFIER_HEAD(panic_notifier_list);
 
 EXPORT_SYMBOL(panic_notifier_list);
 
+static void panic_print_deprecated(void)
+{
+	pr_info_once("Kernel: The 'panic_print' parameter is now deprecated. Please use 'panic_sys_info' and 'panic_console_replay' instead.\n");
+}
+
 #ifdef CONFIG_SYSCTL
 
 /*
@@ -125,7 +130,7 @@ static int proc_taint(const struct ctl_table *table, int write,
 static int sysctl_panic_print_handler(const struct ctl_table *table, int write,
 			   void *buffer, size_t *lenp, loff_t *ppos)
 {
-	pr_info_once("Kernel: 'panic_print' sysctl interface will be obsoleted by both 'panic_sys_info' and 'panic_console_replay'\n");
+	panic_print_deprecated();
 	return proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
 }
 
@@ -944,13 +949,13 @@ core_param(panic_console_replay, panic_console_replay, bool, 0644);
 
 static int panic_print_set(const char *val, const struct kernel_param *kp)
 {
-	pr_info_once("Kernel: 'panic_print' parameter will be obsoleted by both 'panic_sys_info' and 'panic_console_replay'\n");
+	panic_print_deprecated();
 	return  param_set_ulong(val, kp);
 }
 
 static int panic_print_get(char *val, const struct kernel_param *kp)
 {
-	pr_info_once("Kernel: 'panic_print' parameter will be obsoleted by both 'panic_sys_info' and 'panic_console_replay'\n");
+	panic_print_deprecated();
 	return  param_get_ulong(val, kp);
 }
 
Signature · 1 line
2.50.1
Tested-by on v2 1/1
#16 lore raw

Re: [PATCH v2] panic: Clean up message about deprecated 'panic_print' parameter

Quoted 7 lines · Petr Mladek

Remove duplication of the message about deprecated 'panic_print' parameter.

Also make the wording more direct. Make it clear that the new parameters already exist and should be used instead.

Confirmed that it fixes the build error when CONFIG_SYSCTL is disabled.

author Reviewed-by on v2 1/1
#17 lore raw

Re: [PATCH v2] panic: Clean up message about deprecated 'panic_print' parameter

In reply to Petr Mladek
Quoted 7 lines · Petr Mladek

Remove duplication of the message about deprecated 'panic_print' parameter.

Also make the wording more direct. Make it clear that the new parameters already exist and should be used instead.

Thanks for the cleanup!

Quoted 55 lines

---
Changes since v1:

- fixed compilation with CONFIG_SYSCTL disabled (kernel test robot <[email protected]>)

Thanks Lance Yang <[email protected]> for debugging the compilation error reported by the test robot.

 kernel/panic.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
kernel/panic.c +8 -3
index 12a10e17ab4a..24bca263f896 100644
@@ -77,6 +77,11 @@ ATOMIC_NOTIFIER_HEAD(panic_notifier_list);
 
 EXPORT_SYMBOL(panic_notifier_list);
 
+static void panic_print_deprecated(void)
+{
+	pr_info_once("Kernel: The 'panic_print' parameter is now deprecated. Please use 'panic_sys_info' and 'panic_console_replay' instead.\n");
+}
+
 #ifdef CONFIG_SYSCTL
 
 /*
@@ -125,7 +130,7 @@ static int proc_taint(const struct ctl_table *table, int write,
 static int sysctl_panic_print_handler(const struct ctl_table *table, int write,
 			   void *buffer, size_t *lenp, loff_t *ppos)
 {
-	pr_info_once("Kernel: 'panic_print' sysctl interface will be obsoleted by both 'panic_sys_info' and 'panic_console_replay'\n");
+	panic_print_deprecated();
 	return proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
 }
 
@@ -944,13 +949,13 @@ core_param(panic_console_replay, panic_console_replay, bool, 0644);
 
 static int panic_print_set(const char *val, const struct kernel_param *kp)
 {
-	pr_info_once("Kernel: 'panic_print' parameter will be obsoleted by both 'panic_sys_info' and 'panic_console_replay'\n");
+	panic_print_deprecated();
 	return  param_set_ulong(val, kp);
 }
 
 static int panic_print_get(char *val, const struct kernel_param *kp)
 {
-	pr_info_once("Kernel: 'panic_print' parameter will be obsoleted by both 'panic_sys_info' and 'panic_console_replay'\n");
+	panic_print_deprecated();
 	return  param_get_ulong(val, kp);
 }
 
Signature · 1 line
2.50.1
#18 lore raw

Re: [PATCH] panic: Clean up message about deprecated 'panic_print' parameter

In reply to Petr Mladek
Quoted 24 lines · Petr Mladek
Quoted 23 lines · Lance Yang
Quoted 21 lines · Lance Yang
Quoted 19 lines · Lance Yang
Quoted 6 lines · kernel test robot

All errors (new ones prefixed by >>):

Quoted 4 lines
Quoted 4 lines

kernel/panic.c:952:2: error: call to undeclared function 'panic_print_deprecated'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

Quoted 8 lines

      952 |         panic_print_deprecated();
          |         ^
    kernel/panic.c:958:2: error: call to undeclared function
'panic_print_deprecated'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      958 |         panic_print_deprecated();
          |         ^
    2 errors generated.

Oops, panic_print_deprecated() is defined within the #ifdef CONFIG_PROC_SYSCTL block, but it's also called from panic_print_set()

Quoted 8 lines
Quoted 5 lines

If Petr is cool, @Andrew could you squash the following?

---
Subject: [PATCH 1/1] fixup: panic: clean up message about deprecated
'panic_print' parameter

The patch was malformed probably by your mail client. Below is the fixed and revied variant.

Yes. My client messed up the formatting - git send-email it is ;)

Thanks,
Lance