The quilt patch titled Subject: printk: add a short description string to kmsg_dump() has been removed from the -mm tree. Its filename was printk-add-a-short-description-string-to-kmsg_dump.patch This patch was dropped because an updated version will be merged ------------------------------------------------------ From: Jocelyn Falempe <jfalempe@xxxxxxxxxx> Subject: printk: add a short description string to kmsg_dump() Date: Tue, 25 Jun 2024 14:39:29 +0200 kmsg_dump doesn't forward the panic reason string to the kmsg_dumper callback. This patch adds a new parameter "const char *desc" to the kmsg_dumper dump() callback, and update all drivers that are using it. To avoid updating all kmsg_dump() call, it adds a kmsg_dump_desc() function and a macro for backward compatibility. I've written this for drm_panic, but it can be useful for other kmsg_dumper. It allows to see the panic reason, like "sysrq triggered crash" or "VFS: Unable to mount root fs on xxxx" on the drm panic screen. Link: https://lkml.kernel.org/r/20240625123954.211184-1-jfalempe@xxxxxxxxxx Signed-off-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx> Cc: Christophe Leroy <christophe.leroy@xxxxxxxxxx> Cc: Daniel Vetter <daniel@xxxxxxxx> Cc: David Airlie <airlied@xxxxxxxxx> Cc: Dexuan Cui <decui@xxxxxxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: Guilherme G. Piccoli <gpiccoli@xxxxxxxxxx> Cc: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx> Cc: Jani Nikula <jani.nikula@xxxxxxxxx> Cc: John Ogness <john.ogness@xxxxxxxxxxxxx> Cc: Kees Cook <kees@xxxxxxxxxx> Cc: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> Cc: "K. Y. Srinivasan" <kys@xxxxxxxxxxxxx> Cc: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx> Cc: Maxime Ripard <mripard@xxxxxxxxxx> Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx> Cc: Miquel Raynal <miquel.raynal@xxxxxxxxxxx> Cc: "Naveen N. Rao" <naveen.n.rao@xxxxxxxxxxxxx> Cc: Nicholas Piggin <npiggin@xxxxxxxxx> Cc: Petr Mladek <pmladek@xxxxxxxx> Cc: Richard Weinberger <richard@xxxxxx> Cc: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> Cc: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Thomas Zimmermann <tzimmermann@xxxxxxx> Cc: Tony Luck <tony.luck@xxxxxxxxx> Cc: Uros Bizjak <ubizjak@xxxxxxxxx> Cc: Vignesh Raghavendra <vigneshr@xxxxxx> Cc: Wei Liu <wei.liu@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/powerpc/kernel/nvram_64.c | 3 ++- arch/powerpc/platforms/powernv/opal-kmsg.c | 3 ++- drivers/gpu/drm/drm_panic.c | 3 ++- drivers/hv/hv_common.c | 3 ++- drivers/mtd/mtdoops.c | 3 ++- fs/pstore/platform.c | 3 ++- include/linux/kmsg_dump.h | 13 ++++++++++--- kernel/panic.c | 2 +- kernel/printk/printk.c | 8 +++++--- 9 files changed, 28 insertions(+), 13 deletions(-) --- a/arch/powerpc/kernel/nvram_64.c~printk-add-a-short-description-string-to-kmsg_dump +++ a/arch/powerpc/kernel/nvram_64.c @@ -643,7 +643,8 @@ void __init nvram_init_oops_partition(in * partition. If that's too much, go back and capture uncompressed text. */ static void oops_to_nvram(struct kmsg_dumper *dumper, - enum kmsg_dump_reason reason) + enum kmsg_dump_reason reason, + const char *desc) { struct oops_log_info *oops_hdr = (struct oops_log_info *)oops_buf; static unsigned int oops_count = 0; --- a/arch/powerpc/platforms/powernv/opal-kmsg.c~printk-add-a-short-description-string-to-kmsg_dump +++ a/arch/powerpc/platforms/powernv/opal-kmsg.c @@ -20,7 +20,8 @@ * message, it just ensures that OPAL completely flushes the console buffer. */ static void kmsg_dump_opal_console_flush(struct kmsg_dumper *dumper, - enum kmsg_dump_reason reason) + enum kmsg_dump_reason reason, + const char *desc) { /* * Outside of a panic context the pollers will continue to run, --- a/drivers/gpu/drm/drm_panic.c~printk-add-a-short-description-string-to-kmsg_dump +++ a/drivers/gpu/drm/drm_panic.c @@ -488,7 +488,8 @@ static struct drm_plane *to_drm_plane(st return container_of(kd, struct drm_plane, kmsg_panic); } -static void drm_panic(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason) +static void drm_panic(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason, + const char *desc) { struct drm_plane *plane = to_drm_plane(dumper); --- a/drivers/hv/hv_common.c~printk-add-a-short-description-string-to-kmsg_dump +++ a/drivers/hv/hv_common.c @@ -207,7 +207,8 @@ static int hv_die_panic_notify_crash(str * buffer and call into Hyper-V to transfer the data. */ static void hv_kmsg_dump(struct kmsg_dumper *dumper, - enum kmsg_dump_reason reason) + enum kmsg_dump_reason reason, + const char *desc) { struct kmsg_dump_iter iter; size_t bytes_written; --- a/drivers/mtd/mtdoops.c~printk-add-a-short-description-string-to-kmsg_dump +++ a/drivers/mtd/mtdoops.c @@ -298,7 +298,8 @@ static void find_next_position(struct mt } static void mtdoops_do_dump(struct kmsg_dumper *dumper, - enum kmsg_dump_reason reason) + enum kmsg_dump_reason reason, + const char *desc) { struct mtdoops_context *cxt = container_of(dumper, struct mtdoops_context, dump); --- a/fs/pstore/platform.c~printk-add-a-short-description-string-to-kmsg_dump +++ a/fs/pstore/platform.c @@ -275,7 +275,8 @@ void pstore_record_init(struct pstore_re * end of the buffer. */ static void pstore_dump(struct kmsg_dumper *dumper, - enum kmsg_dump_reason reason) + enum kmsg_dump_reason reason, + const char *desc) { struct kmsg_dump_iter iter; unsigned long total = 0; --- a/include/linux/kmsg_dump.h~printk-add-a-short-description-string-to-kmsg_dump +++ a/include/linux/kmsg_dump.h @@ -49,13 +49,15 @@ struct kmsg_dump_iter { */ struct kmsg_dumper { struct list_head list; - void (*dump)(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason); + void (*dump)(struct kmsg_dumper *dumper, + enum kmsg_dump_reason reason, + const char *desc); enum kmsg_dump_reason max_reason; bool registered; }; #ifdef CONFIG_PRINTK -void kmsg_dump(enum kmsg_dump_reason reason); +void kmsg_dump_desc(enum kmsg_dump_reason reason, const char *desc); bool kmsg_dump_get_line(struct kmsg_dump_iter *iter, bool syslog, char *line, size_t size, size_t *len); @@ -71,7 +73,7 @@ int kmsg_dump_unregister(struct kmsg_dum const char *kmsg_dump_reason_str(enum kmsg_dump_reason reason); #else -static inline void kmsg_dump(enum kmsg_dump_reason reason) +static inline void kmsg_dump_desc(enum kmsg_dump_reason reason, const char *desc) { } @@ -107,4 +109,9 @@ static inline const char *kmsg_dump_reas } #endif +static inline void kmsg_dump(enum kmsg_dump_reason reason) +{ + kmsg_dump_desc(reason, NULL); +} + #endif /* _LINUX_KMSG_DUMP_H */ --- a/kernel/panic.c~printk-add-a-short-description-string-to-kmsg_dump +++ a/kernel/panic.c @@ -376,7 +376,7 @@ void panic(const char *fmt, ...) panic_print_sys_info(false); - kmsg_dump(KMSG_DUMP_PANIC); + kmsg_dump_desc(KMSG_DUMP_PANIC, buf); /* * If you doubt kdump always works fine in any situation, --- a/kernel/printk/printk.c~printk-add-a-short-description-string-to-kmsg_dump +++ a/kernel/printk/printk.c @@ -4126,14 +4126,16 @@ const char *kmsg_dump_reason_str(enum km EXPORT_SYMBOL_GPL(kmsg_dump_reason_str); /** - * kmsg_dump - dump kernel log to kernel message dumpers. + * kmsg_dump_desc - dump kernel log to kernel message dumpers. * @reason: the reason (oops, panic etc) for dumping + * @desc: a short string to describe what caused the panic or oops. Can be NULL + * if no additional description is available. * * Call each of the registered dumper's dump() callback, which can * retrieve the kmsg records with kmsg_dump_get_line() or * kmsg_dump_get_buffer(). */ -void kmsg_dump(enum kmsg_dump_reason reason) +void kmsg_dump_desc(enum kmsg_dump_reason reason, const char *desc) { struct kmsg_dumper *dumper; @@ -4153,7 +4155,7 @@ void kmsg_dump(enum kmsg_dump_reason rea continue; /* invoke dumper which will iterate over records */ - dumper->dump(dumper, reason); + dumper->dump(dumper, reason, desc); } rcu_read_unlock(); } _ Patches currently in -mm which might be from jfalempe@xxxxxxxxxx are