On Wed, 27 Jul 2022 11:25:11 +0800 Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> wrote: > Use pr_fmt to prefix all pr_<level> output, but unpoison_memory() > and soft_offline_page() are used by error injection, which have > own prefixes like "Unpoison:" and "soft offline:", meanwhile, > soft_offline_page() could be used by memory hotremove, so undef > pr_fmt before unpoison_pr_info definition to keep the original > output for them. > > ... > > @@ -2289,6 +2285,7 @@ static int __init memory_failure_init(void) > } > core_initcall(memory_failure_init); > > +#undef pr_fmt > #define unpoison_pr_info(fmt, pfn, rs) \ > ({ \ > if (__ratelimit(rs)) \ This change makes the build fail. In file included from ./include/linux/kernel.h:29, from mm/memory-failure.c:39: mm/memory-failure.c: In function 'unpoison_memory': ./include/linux/printk.h:537:26: error: expected ')' before 'pr_fmt' 537 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) | ^~~~~~ ./include/linux/printk.h:388:42: note: in definition of macro '__printk_index_emit' 388 | if (__builtin_constant_p(_fmt) && __builtin_constant_p(_level)) { \ | ^~~~ ./include/linux/printk.h:464:26: note: in expansion of macro 'printk_index_wrap' 464 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~ ./include/linux/printk.h:537:9: note: in expansion of macro 'printk' 537 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) | ^~~~~~ mm/memory-failure.c:2292:17: note: in expansion of macro 'pr_info' 2292 | pr_info(fmt, pfn); \ | ^~~~~~~ mm/memory-failure.c:2326:17: note: in expansion of macro 'unpoison_pr_info' 2326 | unpoison_pr_info("Unpoison: Disabled after HW memory failure %#lx\n", | ^~~~~~~~~~~~~~~~ [1500 lines of the same]