Re: [PATCH v2] printk: Add a short description string to kmsg_dump()

2024-07-12 Thread Jocelyn Falempe




On 12/07/2024 15:34, Kees Cook wrote:



On July 12, 2024 2:59:30 AM PDT, Jocelyn Falempe  wrote:

Gentle ping, I need reviews from powerpc, usermod linux, mtd, pstore and 
hyperv, to be able to push it in the drm-misc tree.


Oops, I thought I'd Acked already!

Acked-by: Kees Cook 

And, yeah, as mpe said, you're all good to take this via drm-misc.


Thanks a lot. If there is no objection I will push it to drm-misc mid 
next week. I may have all required acks by then.


Thanks!

-Kees




Best regards,

--

Jocelyn



Re: [PATCH v2] printk: Add a short description string to kmsg_dump()

2024-07-12 Thread Jocelyn Falempe

On 02/07/2024 14:26, Jocelyn Falempe wrote:

kmsg_dump doesn't forward the panic reason string to the kmsg_dumper
callback.
This patch adds a new struct kmsg_dump_detail, that will hold the
reason and description, and pass it to the dump() callback.

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 " on the drm panic screen.

v2:
  * Use a struct kmsg_dump_detail to hold the reason and description
pointer, for more flexibility if we want to add other parameters.
(Kees Cook)
  * Fix powerpc/nvram_64 build, as I didn't update the forward
declaration of oops_to_nvram()

Signed-off-by: Jocelyn Falempe 
---
  arch/powerpc/kernel/nvram_64.c |  8 
  arch/powerpc/platforms/powernv/opal-kmsg.c |  4 ++--
  arch/um/kernel/kmsg_dump.c |  2 +-
  drivers/gpu/drm/drm_panic.c|  4 ++--
  drivers/hv/hv_common.c |  4 ++--
  drivers/mtd/mtdoops.c  |  2 +-
  fs/pstore/platform.c   | 10 +-
  include/linux/kmsg_dump.h  | 22 +++---
  kernel/panic.c |  2 +-
  kernel/printk/printk.c | 11 ---
  10 files changed, 45 insertions(+), 24 deletions(-)

diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index e385d3164648..f9c6568a9137 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -73,7 +73,7 @@ static const char *nvram_os_partitions[] = {
  };
  
  static void oops_to_nvram(struct kmsg_dumper *dumper,

- enum kmsg_dump_reason reason);
+ struct kmsg_dump_detail *detail);
  
  static struct kmsg_dumper nvram_kmsg_dumper = {

.dump = oops_to_nvram
@@ -643,7 +643,7 @@ void __init nvram_init_oops_partition(int 
rtas_partition_exists)
   * 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)
+ struct kmsg_dump_detail *detail)
  {
struct oops_log_info *oops_hdr = (struct oops_log_info *)oops_buf;
static unsigned int oops_count = 0;
@@ -655,7 +655,7 @@ static void oops_to_nvram(struct kmsg_dumper *dumper,
unsigned int err_type = ERR_TYPE_KERNEL_PANIC_GZ;
int rc = -1;
  
-	switch (reason) {

+   switch (detail->reason) {
case KMSG_DUMP_SHUTDOWN:
/* These are almost always orderly shutdowns. */
return;
@@ -671,7 +671,7 @@ static void oops_to_nvram(struct kmsg_dumper *dumper,
break;
default:
pr_err("%s: ignoring unrecognized KMSG_DUMP_* reason %d\n",
-  __func__, (int) reason);
+  __func__, (int) detail->reason);
return;
}
  
diff --git a/arch/powerpc/platforms/powernv/opal-kmsg.c b/arch/powerpc/platforms/powernv/opal-kmsg.c

index 6c3bc4b4da98..bb4218fa796e 100644
--- a/arch/powerpc/platforms/powernv/opal-kmsg.c
+++ b/arch/powerpc/platforms/powernv/opal-kmsg.c
@@ -20,13 +20,13 @@
   * 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)
+struct kmsg_dump_detail *detail)
  {
/*
 * Outside of a panic context the pollers will continue to run,
 * so we don't need to do any special flushing.
 */
-   if (reason != KMSG_DUMP_PANIC)
+   if (detail->reason != KMSG_DUMP_PANIC)
return;
  
  	opal_flush_console(0);

diff --git a/arch/um/kernel/kmsg_dump.c b/arch/um/kernel/kmsg_dump.c
index 4382cf02a6d1..419021175272 100644
--- a/arch/um/kernel/kmsg_dump.c
+++ b/arch/um/kernel/kmsg_dump.c
@@ -8,7 +8,7 @@
  #include 
  
  static void kmsg_dumper_stdout(struct kmsg_dumper *dumper,

-   enum kmsg_dump_reason reason)
+   struct kmsg_dump_detail *detail)
  {
static struct kmsg_dump_iter iter;
static DEFINE_SPINLOCK(lock);
diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c
index 948aed00595e..8794c7f6c0ee 100644
--- a/drivers/gpu/drm/drm_panic.c
+++ b/drivers/gpu/drm/drm_panic.c
@@ -655,11 +655,11 @@ static struct drm_plane *to_drm_plane(struct kmsg_dumper 
*kd)
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 *d

Re: [PATCH v2] printk: Add a short description string to kmsg_dump()

2024-07-03 Thread Jocelyn Falempe




On 03/07/2024 18:27, Kees Cook wrote:

On Wed, Jul 03, 2024 at 10:22:11AM +0200, Petr Mladek wrote:

On Wed 2024-07-03 09:57:26, Jocelyn Falempe wrote:



On 02/07/2024 22:29, Kees Cook wrote:

On Tue, Jul 02, 2024 at 02:26:04PM +0200, Jocelyn Falempe wrote:

kmsg_dump doesn't forward the panic reason string to the kmsg_dumper
callback.
This patch adds a new struct kmsg_dump_detail, that will hold the
reason and description, and pass it to the dump() callback.


Thanks! I like this much better. :)



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 " on the drm panic screen.

v2:
   * Use a struct kmsg_dump_detail to hold the reason and description
 pointer, for more flexibility if we want to add other parameters.
 (Kees Cook)
   * Fix powerpc/nvram_64 build, as I didn't update the forward
 declaration of oops_to_nvram()


The versioning history commonly goes after the "---".


ok, I was not aware of this.



[...]
diff --git a/include/linux/kmsg_dump.h b/include/linux/kmsg_dump.h
index 906521c2329c..65f5a47727bc 100644
--- a/include/linux/kmsg_dump.h
+++ b/include/linux/kmsg_dump.h
@@ -39,6 +39,17 @@ struct kmsg_dump_iter {
u64 next_seq;
   };
+/**
+ *struct kmsg_dump_detail - kernel crash detail


Is kern-doc happy with this? I think there is supposed to be a space
between the "*" and the first word:

   /**
* struct kmsg...



Good catch, yes there is a space missing.

I just checked with "make htmldocs", and in fact include/linux/kmsg_dump.h
is not indexed for kernel documentation.
And you can't find the definition of struct kmsg_dumper in the online doc.
https://www.kernel.org/doc/html/latest/search.html?q=kmsg_dumper


Otherwise looks good to me!



Thanks.

As this patch touches different subsystems, do you know on which tree it
should land ?


Andrew usually takes patches against kernel/panic.c.

Or you could take it via the DRM tree, especially if you already have the code
using the string.


If it's not taken in Andrew's tree next week, I will see if I can push 
it to the drm-misc tree. I think there is a very low chance of conflicts.




Also I could take it via the printk tree. The only complication is
that I am going to be away the following two weeks and would come
back in the middle of the merge window. I do not expect much problems
with this change but...


If DRM doesn't want to carry it, I can put it in through the pstore
tree. Let me know! :)



Thanks for the proposition, I will see how it goes, it would be nice to 
have it in time for the v6.11 merge window.


Best regards,

--

Jocelyn



Re: [PATCH v2] printk: Add a short description string to kmsg_dump()

2024-07-03 Thread Jocelyn Falempe




On 02/07/2024 22:29, Kees Cook wrote:

On Tue, Jul 02, 2024 at 02:26:04PM +0200, Jocelyn Falempe wrote:

kmsg_dump doesn't forward the panic reason string to the kmsg_dumper
callback.
This patch adds a new struct kmsg_dump_detail, that will hold the
reason and description, and pass it to the dump() callback.


Thanks! I like this much better. :)



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 " on the drm panic screen.

v2:
  * Use a struct kmsg_dump_detail to hold the reason and description
pointer, for more flexibility if we want to add other parameters.
(Kees Cook)
  * Fix powerpc/nvram_64 build, as I didn't update the forward
declaration of oops_to_nvram()


The versioning history commonly goes after the "---".


ok, I was not aware of this.



[...]
diff --git a/include/linux/kmsg_dump.h b/include/linux/kmsg_dump.h
index 906521c2329c..65f5a47727bc 100644
--- a/include/linux/kmsg_dump.h
+++ b/include/linux/kmsg_dump.h
@@ -39,6 +39,17 @@ struct kmsg_dump_iter {
u64 next_seq;
  };
  
+/**

+ *struct kmsg_dump_detail - kernel crash detail


Is kern-doc happy with this? I think there is supposed to be a space
between the "*" and the first word:

  /**
   * struct kmsg...



Good catch, yes there is a space missing.

I just checked with "make htmldocs", and in fact 
include/linux/kmsg_dump.h is not indexed for kernel documentation.

And you can't find the definition of struct kmsg_dumper in the online doc.
https://www.kernel.org/doc/html/latest/search.html?q=kmsg_dumper


Otherwise looks good to me!



Thanks.

As this patch touches different subsystems, do you know on which tree it 
should land ?


--

Jocelyn



[PATCH v2] printk: Add a short description string to kmsg_dump()

2024-07-02 Thread Jocelyn Falempe
kmsg_dump doesn't forward the panic reason string to the kmsg_dumper
callback.
This patch adds a new struct kmsg_dump_detail, that will hold the
reason and description, and pass it to the dump() callback.

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 " on the drm panic screen.

v2:
 * Use a struct kmsg_dump_detail to hold the reason and description
   pointer, for more flexibility if we want to add other parameters.
   (Kees Cook)
 * Fix powerpc/nvram_64 build, as I didn't update the forward
   declaration of oops_to_nvram()

Signed-off-by: Jocelyn Falempe 
---
 arch/powerpc/kernel/nvram_64.c |  8 
 arch/powerpc/platforms/powernv/opal-kmsg.c |  4 ++--
 arch/um/kernel/kmsg_dump.c |  2 +-
 drivers/gpu/drm/drm_panic.c|  4 ++--
 drivers/hv/hv_common.c |  4 ++--
 drivers/mtd/mtdoops.c  |  2 +-
 fs/pstore/platform.c   | 10 +-
 include/linux/kmsg_dump.h  | 22 +++---
 kernel/panic.c |  2 +-
 kernel/printk/printk.c | 11 ---
 10 files changed, 45 insertions(+), 24 deletions(-)

diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index e385d3164648..f9c6568a9137 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -73,7 +73,7 @@ static const char *nvram_os_partitions[] = {
 };
 
 static void oops_to_nvram(struct kmsg_dumper *dumper,
- enum kmsg_dump_reason reason);
+ struct kmsg_dump_detail *detail);
 
 static struct kmsg_dumper nvram_kmsg_dumper = {
.dump = oops_to_nvram
@@ -643,7 +643,7 @@ void __init nvram_init_oops_partition(int 
rtas_partition_exists)
  * 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)
+ struct kmsg_dump_detail *detail)
 {
struct oops_log_info *oops_hdr = (struct oops_log_info *)oops_buf;
static unsigned int oops_count = 0;
@@ -655,7 +655,7 @@ static void oops_to_nvram(struct kmsg_dumper *dumper,
unsigned int err_type = ERR_TYPE_KERNEL_PANIC_GZ;
int rc = -1;
 
-   switch (reason) {
+   switch (detail->reason) {
case KMSG_DUMP_SHUTDOWN:
/* These are almost always orderly shutdowns. */
return;
@@ -671,7 +671,7 @@ static void oops_to_nvram(struct kmsg_dumper *dumper,
break;
default:
pr_err("%s: ignoring unrecognized KMSG_DUMP_* reason %d\n",
-  __func__, (int) reason);
+  __func__, (int) detail->reason);
return;
}
 
diff --git a/arch/powerpc/platforms/powernv/opal-kmsg.c 
b/arch/powerpc/platforms/powernv/opal-kmsg.c
index 6c3bc4b4da98..bb4218fa796e 100644
--- a/arch/powerpc/platforms/powernv/opal-kmsg.c
+++ b/arch/powerpc/platforms/powernv/opal-kmsg.c
@@ -20,13 +20,13 @@
  * 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)
+struct kmsg_dump_detail *detail)
 {
/*
 * Outside of a panic context the pollers will continue to run,
 * so we don't need to do any special flushing.
 */
-   if (reason != KMSG_DUMP_PANIC)
+   if (detail->reason != KMSG_DUMP_PANIC)
return;
 
opal_flush_console(0);
diff --git a/arch/um/kernel/kmsg_dump.c b/arch/um/kernel/kmsg_dump.c
index 4382cf02a6d1..419021175272 100644
--- a/arch/um/kernel/kmsg_dump.c
+++ b/arch/um/kernel/kmsg_dump.c
@@ -8,7 +8,7 @@
 #include 
 
 static void kmsg_dumper_stdout(struct kmsg_dumper *dumper,
-   enum kmsg_dump_reason reason)
+   struct kmsg_dump_detail *detail)
 {
static struct kmsg_dump_iter iter;
static DEFINE_SPINLOCK(lock);
diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c
index 948aed00595e..8794c7f6c0ee 100644
--- a/drivers/gpu/drm/drm_panic.c
+++ b/drivers/gpu/drm/drm_panic.c
@@ -655,11 +655,11 @@ static struct drm_plane *to_drm_plane(struct kmsg_dumper 
*kd)
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, struct kmsg_dump_detail 
*detail)
 {
struct drm_plane *plane = to_

Re: [PATCH] printk: Add a short description string to kmsg_dump()

2024-06-28 Thread Jocelyn Falempe




On 26/06/2024 18:26, Kees Cook wrote:

On Tue, Jun 25, 2024 at 02:39:29PM +0200, Jocelyn Falempe wrote:

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 " on the drm panic screen.


Seems reasonable. Given the prototype before/after:

dump(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason)

dump(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason,
  const char *desc)

Perhaps this should instead be a struct that the panic fills in? Then
it'll be easy to adjust the struct in the future:


yes that's a good idea, so it's a bit more flexible.



struct kmsg_dump_detail {
enum kmsg_dump_reason reason;
const char *description;
};

dump(struct kmsg_dumper *dumper, struct kmsg_dump *detail)

This .cocci could do the conversion:


@ dump_func @
identifier DUMPER, CALLBACK;
@@

   struct kmsg_dumper DUMPER = {
 .dump = CALLBACK,
   };

@ detail @
identifier dump_func.CALLBACK;
identifier DUMPER, REASON;
@@

CALLBACK(struct kmsg_dumper *DUMPER,
-enum kmsg_dump_reason REASON
+struct kmsg_dump_detail *detail
)
{
<...
-   REASON
+   detail->reason
...>
}


Also, just to double-check, doesn't the panic reason show up in the
kmsg_dump log itself (at the end?) I ask since for pstore, "desc" is
likely redundant since it's capturing the entire console log.


It is present in the kdump log, but before all the register dumps.
So to retrieve it you need to parse the last 30~40 lines of logs, and 
search for a line starting with "Kernel panic - not syncing".

https://elixir.bootlin.com/linux/v6.10-rc5/source/kernel/panic.c#L341
But I think that's a bit messy, and I prefer having a kmsg_dump parameter.

--

Jocelyn


-Kees

Here's the patch from the above cocci:


diff -u -p a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c
--- a/drivers/hv/hv_common.c
+++ b/drivers/hv/hv_common.c
@@ -207,13 +207,13 @@ 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)
+struct kmsg_dump_detail *detail)
  {
struct kmsg_dump_iter iter;
size_t bytes_written;
  
  	/* We are only interested in panics. */

-   if (reason != KMSG_DUMP_PANIC || !sysctl_record_panic_msg)
+   if (detail->reason != KMSG_DUMP_PANIC || !sysctl_record_panic_msg)
return;
  
  	/*

diff -u -p a/arch/powerpc/platforms/powernv/opal-kmsg.c 
b/arch/powerpc/platforms/powernv/opal-kmsg.c
--- a/arch/powerpc/platforms/powernv/opal-kmsg.c
+++ b/arch/powerpc/platforms/powernv/opal-kmsg.c
@@ -20,13 +20,13 @@
   * 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)
+struct kmsg_dump_detail *detail)
  {
/*
 * Outside of a panic context the pollers will continue to run,
 * so we don't need to do any special flushing.
 */
-   if (reason != KMSG_DUMP_PANIC)
+   if (detail->reason != KMSG_DUMP_PANIC)
return;
  
  	opal_flush_console(0);

diff -u -p a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -73,7 +73,7 @@ static const char *nvram_os_partitions[]
  };
  
  static void oops_to_nvram(struct kmsg_dumper *dumper,

- enum kmsg_dump_reason reason);
+ struct kmsg_dump_detail *detail);
  
  static struct kmsg_dumper nvram_kmsg_dumper = {

.dump = oops_to_nvram
@@ -643,7 +643,7 @@ 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)
+ struct kmsg_dump_detail *detail)
  {
struct oops_log_info *oops_hdr = (struct oops_log_info *)oops_buf;
static unsigned int oops_count = 0;
@@ -655,7 +655,7 @@ static void oops_to_nvram(struct kmsg_du
unsigned int err_type = ERR_TYPE_KERNEL_PANIC_GZ;
int rc = -1;
  
-	switch (reason) {

+   switch (detail->reason) {
   

Re: [PATCH] printk: Add a short description string to kmsg_dump()

2024-06-27 Thread Jocelyn Falempe




On 26/06/2024 10:00, Petr Mladek wrote:

On Tue 2024-06-25 14:39:29, Jocelyn Falempe wrote:

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 " on the drm panic screen.

Signed-off-by: Jocelyn Falempe 
---
  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(-)


The parameter is added into all dumpers. I guess that it would be
used only drm_panic() because it is graphics and might be "fancy".
The others simply dump the log buffer and the reason is in
the dumped log as well.


Ok, I also tried to retrieve the reason from the dumped log, but that's 
really fragile.




Anyway, the passed buffer is static. Alternative solution would
be to make it global and export it like, for example, panic_cpu.


It's not a static buffer, because the string is generated at runtime.
eg: https://elixir.bootlin.com/linux/latest/source/arch/arm/mm/init.c#L158

So it will be hard to avoid race conditions.



Best Regards,
Petr





[PATCH] printk: Add a short description string to kmsg_dump()

2024-06-26 Thread Jocelyn Falempe
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 " on the drm panic screen.

Signed-off-by: Jocelyn Falempe 
---
 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(-)

diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index e385d3164648c..6b3a80d8cfa64 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -643,7 +643,8 @@ void __init nvram_init_oops_partition(int 
rtas_partition_exists)
  * 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;
diff --git a/arch/powerpc/platforms/powernv/opal-kmsg.c 
b/arch/powerpc/platforms/powernv/opal-kmsg.c
index 6c3bc4b4da983..49b60de6feb04 100644
--- a/arch/powerpc/platforms/powernv/opal-kmsg.c
+++ b/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,
diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c
index 293d4dcbc80da..88e9359fe6d78 100644
--- a/drivers/gpu/drm/drm_panic.c
+++ b/drivers/gpu/drm/drm_panic.c
@@ -604,7 +604,8 @@ static struct drm_plane *to_drm_plane(struct kmsg_dumper 
*kd)
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);
 
diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c
index 9c452bfbd5719..b0786ee9c94e3 100644
--- a/drivers/hv/hv_common.c
+++ b/drivers/hv/hv_common.c
@@ -207,7 +207,8 @@ static int hv_die_panic_notify_crash(struct notifier_block 
*self,
  * 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;
diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
index 2f11585b5613e..c618999a96832 100644
--- a/drivers/mtd/mtdoops.c
+++ b/drivers/mtd/mtdoops.c
@@ -298,7 +298,8 @@ static void find_next_position(struct mtdoops_context *cxt)
 }
 
 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);
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 3497ede88aa01..a6ed5d56021ef 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -275,7 +275,8 @@ void pstore_record_init(struct pstore_record *record,
  * 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;
diff --git a/include/linux/kmsg_dump.h b/include/linux/kmsg_dump.h
index 906521c2329ca..a8f8a6204542d 100644
--- a/include/linux/kmsg_dump.h
+++ b/include/linux/kmsg_dump.h
@@ -49,13 +