Skip to content

Commit f4af41b

Browse files
Baoquan Heakpm00
authored andcommitted
kexec: fix the unexpected kexec_dprintk() macro
Jiri reported that the current kexec_dprintk() always prints out debugging message whenever kexec/kdmmp loading is triggered. That is not wanted. The debugging message is supposed to be printed out when 'kexec -s -d' is specified for kexec/kdump loading. After investigating, the reason is the current kexec_dprintk() takes printk(KERN_INFO) or printk(KERN_DEBUG) depending on whether '-d' is specified. However, distros usually have defaulg log level like below: [~]# cat /proc/sys/kernel/printk 7 4 1 7 So, even though '-d' is not specified, printk(KERN_DEBUG) also always prints out. I thought printk(KERN_DEBUG) is equal to pr_debug(), it's not. Fix it by changing to use pr_info() instead which are expected to work. Link: https://lkml.kernel.org/r/[email protected] Fixes: cbc2fe9 ("kexec_file: add kexec_file flag to control debug printing") Signed-off-by: Baoquan He <[email protected]> Reported-by: Jiri Slaby <[email protected]> Closes: https://lore.kernel.org/all/[email protected] Reviewed-by: Dave Young <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 4707c13 commit f4af41b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

include/linux/kexec.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,10 +461,8 @@ static inline void arch_kexec_pre_free_pages(void *vaddr, unsigned int pages) {
461461

462462
extern bool kexec_file_dbg_print;
463463

464-
#define kexec_dprintk(fmt, ...) \
465-
printk("%s" fmt, \
466-
kexec_file_dbg_print ? KERN_INFO : KERN_DEBUG, \
467-
##__VA_ARGS__)
464+
#define kexec_dprintk(fmt, arg...) \
465+
do { if (kexec_file_dbg_print) pr_info(fmt, ##arg); } while (0)
468466

469467
#else /* !CONFIG_KEXEC_CORE */
470468
struct pt_regs;

0 commit comments

Comments
 (0)