The patch titled Subject: kexec: dump kmessage before machine_kexec has been added to the -mm tree. Its filename is kexec-dump-kmessage-before-machine_kexec.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/kexec-dump-kmessage-before-machine_kexec.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/kexec-dump-kmessage-before-machine_kexec.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Pavel Tatashin <pasha.tatashin@xxxxxxxxxx> Subject: kexec: dump kmessage before machine_kexec 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) Link: https://lkml.kernel.org/r/20210319192326.146000-2-pasha.tatashin@xxxxxxxxxx Signed-off-by: Pavel Tatashin <pasha.tatashin@xxxxxxxxxx> Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx> Reviewed-by: Petr Mladek <pmladek@xxxxxxxx> Reviewed-by: Bhupesh Sharma <bhsharma@xxxxxxxxxx> Acked-by: Baoquan He <bhe@xxxxxxxxxx> Reviewed-by: Tyler Hicks <tyhicks@xxxxxxxxxxxxxxxxxxx> Cc: James Morris <jmorris@xxxxxxxxx> Cc: Sasha Levin <sashal@xxxxxxxxxx> Cc: Eric W. Biederman <ebiederm@xxxxxxxxxxxx> Cc: Anton Vorontsov <anton@xxxxxxxxxx> Cc: Colin Cross <ccross@xxxxxxxxxxx> Cc: Tony Luck <tony.luck@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/kexec_core.c | 2 ++ 1 file changed, 2 insertions(+) --- a/kernel/kexec_core.c~kexec-dump-kmessage-before-machine_kexec +++ a/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> @@ -1179,6 +1180,7 @@ int kernel_kexec(void) machine_shutdown(); } + kmsg_dump(KMSG_DUMP_SHUTDOWN); machine_kexec(kexec_image); #ifdef CONFIG_KEXEC_JUMP _ Patches currently in -mm which might be from pasha.tatashin@xxxxxxxxxx are mm-gup-dont-pin-migrated-cma-pages-in-movable-zone.patch mm-gup-check-every-subpage-of-a-compound-page-during-isolation.patch mm-gup-return-an-error-on-migration-failure.patch mm-gup-check-for-isolation-errors.patch mm-cma-rename-pf_memalloc_nocma-to-pf_memalloc_pin.patch mm-apply-per-task-gfp-constraints-in-fast-path.patch mm-honor-pf_memalloc_pin-for-all-movable-pages.patch mm-gup-do-not-migrate-zero-page.patch mm-gup-migrate-pinned-pages-out-of-movable-zone.patch memory-hotplugrst-add-a-note-about-zone_movable-and-page-pinning.patch mm-gup-change-index-type-to-long-as-it-counts-pages.patch mm-gup-longterm-pin-migration-cleanup.patch selftests-vm-gup_test-fix-test-flag.patch selftests-vm-gup_test-test-faulting-in-kernel-and-verify-pinnable-pages.patch kexec-dump-kmessage-before-machine_kexec.patch