linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/1] dump kmessage before machine_kexec
@ 2021-01-26 20:41 Pavel Tatashin
  2021-01-26 20:41 ` [PATCH v2 1/1] kexec: " Pavel Tatashin
  0 siblings, 1 reply; 5+ messages in thread
From: Pavel Tatashin @ 2021-01-26 20:41 UTC (permalink / raw)
  To: pasha.tatashin, jmorris, sashal, tyhicks, pmladek, ebiederm,
	keescook, anton, ccross, tony.luck, kexec, linux-kernel

Changelog
v2
	- Added review-by's
	- Sync with mainline

Allow to study performance shutdown via kexec reboot calls by having kmsg
log saved via pstore.

Previous submissions
v1 https://lore.kernel.org/lkml/20200605194642.62278-1-pasha.tatashin@soleen.com

Pavel Tatashin (1):
  kexec: dump kmessage before machine_kexec

 kernel/kexec_core.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/1] kexec: dump kmessage before machine_kexec
  2021-01-26 20:41 [PATCH v2 0/1] dump kmessage before machine_kexec Pavel Tatashin
@ 2021-01-26 20:41 ` Pavel Tatashin
  2021-01-28  5:22   ` Baoquan He
  2021-01-28 20:00   ` Eric W. Biederman
  0 siblings, 2 replies; 5+ messages in thread
From: Pavel Tatashin @ 2021-01-26 20:41 UTC (permalink / raw)
  To: pasha.tatashin, jmorris, sashal, tyhicks, pmladek, ebiederm,
	keescook, anton, ccross, tony.luck, kexec, linux-kernel

kmsg_dump(KMSG_DUMP_SHUTDOWN) is called before
machine_restart(), machine_halt(), machine_power_off(), the only one that
is missing is  machine_kexec().

The dmesg output that it contains can be used to study the shutdown
performance of both kernel and systemd during kexec reboot.

Here is example of dmesg data collected after kexec:

root@dplat-cp22:~# cat /sys/fs/pstore/dmesg-ramoops-0 | tail
...
<6>[   70.914592] psci: CPU3 killed (polled 0 ms)
<5>[   70.915705] CPU4: shutdown
<6>[   70.916643] psci: CPU4 killed (polled 4 ms)
<5>[   70.917715] CPU5: shutdown
<6>[   70.918725] psci: CPU5 killed (polled 0 ms)
<5>[   70.919704] CPU6: shutdown
<6>[   70.920726] psci: CPU6 killed (polled 4 ms)
<5>[   70.921642] CPU7: shutdown
<6>[   70.922650] psci: CPU7 killed (polled 0 ms)

Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Bhupesh Sharma <bhsharma@redhat.com>
---
 kernel/kexec_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 4f8efc278aa7..e253c8b59145 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -37,6 +37,7 @@
 #include <linux/compiler.h>
 #include <linux/hugetlb.h>
 #include <linux/objtool.h>
+#include <linux/kmsg_dump.h>
 
 #include <asm/page.h>
 #include <asm/sections.h>
@@ -1180,6 +1181,7 @@ int kernel_kexec(void)
 		machine_shutdown();
 	}
 
+	kmsg_dump(KMSG_DUMP_SHUTDOWN);
 	machine_kexec(kexec_image);
 
 #ifdef CONFIG_KEXEC_JUMP
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] kexec: dump kmessage before machine_kexec
  2021-01-26 20:41 ` [PATCH v2 1/1] kexec: " Pavel Tatashin
@ 2021-01-28  5:22   ` Baoquan He
  2021-01-28 20:00   ` Eric W. Biederman
  1 sibling, 0 replies; 5+ messages in thread
From: Baoquan He @ 2021-01-28  5:22 UTC (permalink / raw)
  To: Pavel Tatashin
  Cc: jmorris, sashal, tyhicks, pmladek, ebiederm, keescook, anton,
	ccross, tony.luck, kexec, linux-kernel, akpm

On 01/26/21 at 03:41pm, Pavel Tatashin wrote:
> kmsg_dump(KMSG_DUMP_SHUTDOWN) is called before
> machine_restart(), machine_halt(), machine_power_off(), the only one that
> is missing is  machine_kexec().
> 
> The dmesg output that it contains can be used to study the shutdown
> performance of both kernel and systemd during kexec reboot.
> 
> Here is example of dmesg data collected after kexec:
> 
> root@dplat-cp22:~# cat /sys/fs/pstore/dmesg-ramoops-0 | tail
> ...
> <6>[   70.914592] psci: CPU3 killed (polled 0 ms)
> <5>[   70.915705] CPU4: shutdown
> <6>[   70.916643] psci: CPU4 killed (polled 4 ms)
> <5>[   70.917715] CPU5: shutdown
> <6>[   70.918725] psci: CPU5 killed (polled 0 ms)
> <5>[   70.919704] CPU6: shutdown
> <6>[   70.920726] psci: CPU6 killed (polled 4 ms)
> <5>[   70.921642] CPU7: shutdown
> <6>[   70.922650] psci: CPU7 killed (polled 0 ms)
> 
> Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com>
> Reviewed-by: Kees Cook <keescook@chromium.org>
> Reviewed-by: Petr Mladek <pmladek@suse.com>
> Reviewed-by: Bhupesh Sharma <bhsharma@redhat.com>
> ---
>  kernel/kexec_core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
> index 4f8efc278aa7..e253c8b59145 100644
> --- a/kernel/kexec_core.c
> +++ b/kernel/kexec_core.c
> @@ -37,6 +37,7 @@
>  #include <linux/compiler.h>
>  #include <linux/hugetlb.h>
>  #include <linux/objtool.h>
> +#include <linux/kmsg_dump.h>
>  
>  #include <asm/page.h>
>  #include <asm/sections.h>
> @@ -1180,6 +1181,7 @@ int kernel_kexec(void)
>  		machine_shutdown();
>  	}
>  
> +	kmsg_dump(KMSG_DUMP_SHUTDOWN);
>  	machine_kexec(kexec_image);

Looks good to me, thx.

Acked-by: Baoquan He <bhe@redhat.com>

>  
>  #ifdef CONFIG_KEXEC_JUMP
> -- 
> 2.25.1
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] kexec: dump kmessage before machine_kexec
  2021-01-26 20:41 ` [PATCH v2 1/1] kexec: " Pavel Tatashin
  2021-01-28  5:22   ` Baoquan He
@ 2021-01-28 20:00   ` Eric W. Biederman
  2021-01-28 21:43     ` Pavel Tatashin
  1 sibling, 1 reply; 5+ messages in thread
From: Eric W. Biederman @ 2021-01-28 20:00 UTC (permalink / raw)
  To: Pavel Tatashin
  Cc: jmorris, sashal, tyhicks, pmladek, keescook, anton, ccross,
	tony.luck, kexec, linux-kernel

Pavel Tatashin <pasha.tatashin@soleen.com> writes:

> kmsg_dump(KMSG_DUMP_SHUTDOWN) is called before
> machine_restart(), machine_halt(), machine_power_off(), the only one that
> is missing is  machine_kexec().
>
> The dmesg output that it contains can be used to study the shutdown
> performance of both kernel and systemd during kexec reboot.
>
> Here is example of dmesg data collected after kexec:

As long was we keep kmsg_dump out of the crash_kexec path where
it completely breaks kexec on panic this seems a reasonable thing to do.
On the ordinary kernel_kexec path everything is expected to be working.

Is kmsg_dump expected to work after all of the device drivers
are shut down?  Otherwise this placement of kmsg_dump is too late.

Eric

> root@dplat-cp22:~# cat /sys/fs/pstore/dmesg-ramoops-0 | tail
> ...
> <6>[   70.914592] psci: CPU3 killed (polled 0 ms)
> <5>[   70.915705] CPU4: shutdown
> <6>[   70.916643] psci: CPU4 killed (polled 4 ms)
> <5>[   70.917715] CPU5: shutdown
> <6>[   70.918725] psci: CPU5 killed (polled 0 ms)
> <5>[   70.919704] CPU6: shutdown
> <6>[   70.920726] psci: CPU6 killed (polled 4 ms)
> <5>[   70.921642] CPU7: shutdown
> <6>[   70.922650] psci: CPU7 killed (polled 0 ms)
>
> Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com>
> Reviewed-by: Kees Cook <keescook@chromium.org>
> Reviewed-by: Petr Mladek <pmladek@suse.com>
> Reviewed-by: Bhupesh Sharma <bhsharma@redhat.com>
> ---
>  kernel/kexec_core.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
> index 4f8efc278aa7..e253c8b59145 100644
> --- a/kernel/kexec_core.c
> +++ b/kernel/kexec_core.c
> @@ -37,6 +37,7 @@
>  #include <linux/compiler.h>
>  #include <linux/hugetlb.h>
>  #include <linux/objtool.h>
> +#include <linux/kmsg_dump.h>
>  
>  #include <asm/page.h>
>  #include <asm/sections.h>
> @@ -1180,6 +1181,7 @@ int kernel_kexec(void)
>  		machine_shutdown();
>  	}
>  
> +	kmsg_dump(KMSG_DUMP_SHUTDOWN);
>  	machine_kexec(kexec_image);
>  
>  #ifdef CONFIG_KEXEC_JUMP

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] kexec: dump kmessage before machine_kexec
  2021-01-28 20:00   ` Eric W. Biederman
@ 2021-01-28 21:43     ` Pavel Tatashin
  0 siblings, 0 replies; 5+ messages in thread
From: Pavel Tatashin @ 2021-01-28 21:43 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: James Morris, Sasha Levin, Tyler Hicks, Petr Mladek, Kees Cook,
	Anton Vorontsov, Colin Cross, Tony Luck, kexec mailing list,
	LKML

On Thu, Jan 28, 2021 at 3:01 PM Eric W. Biederman <ebiederm@xmission.com> wrote:
>
> Pavel Tatashin <pasha.tatashin@soleen.com> writes:
>
> > kmsg_dump(KMSG_DUMP_SHUTDOWN) is called before
> > machine_restart(), machine_halt(), machine_power_off(), the only one that
> > is missing is  machine_kexec().
> >
> > The dmesg output that it contains can be used to study the shutdown
> > performance of both kernel and systemd during kexec reboot.
> >
> > Here is example of dmesg data collected after kexec:
>
> As long was we keep kmsg_dump out of the crash_kexec path where
> it completely breaks kexec on panic this seems a reasonable thing to do.
> On the ordinary kernel_kexec path everything is expected to be working.

This is an ordinary kexec reboot path, not kdump.

>
> Is kmsg_dump expected to work after all of the device drivers
> are shut down?  Otherwise this placement of kmsg_dump is too late.

Yes it is. It is called after device_shutdown(); in all other places.


Thank you,
Pasha

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-28 21:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-26 20:41 [PATCH v2 0/1] dump kmessage before machine_kexec Pavel Tatashin
2021-01-26 20:41 ` [PATCH v2 1/1] kexec: " Pavel Tatashin
2021-01-28  5:22   ` Baoquan He
2021-01-28 20:00   ` Eric W. Biederman
2021-01-28 21:43     ` Pavel Tatashin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).