This is a note to let you know that I've just added the patch titled x86/Hyper-V: Report crash register data when sysctl_record_panic_msg is not set to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: x86-hyper-v-report-crash-register-data-when-sysctl_record_panic_msg-is-not-set.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 040026df7088c56ccbad28f7042308f67bde63df Mon Sep 17 00:00:00 2001 From: Tianyu Lan <Tianyu.Lan@xxxxxxxxxxxxx> Date: Mon, 6 Apr 2020 08:53:30 -0700 Subject: x86/Hyper-V: Report crash register data when sysctl_record_panic_msg is not set From: Tianyu Lan <Tianyu.Lan@xxxxxxxxxxxxx> commit 040026df7088c56ccbad28f7042308f67bde63df upstream. When sysctl_record_panic_msg is not set, the panic will not be reported to Hyper-V via hyperv_report_panic_msg(). So the crash should be reported via hyperv_report_panic(). Fixes: 81b18bce48af ("Drivers: HV: Send one page worth of kmsg dump over Hyper-V during panic") Reviewed-by: Michael Kelley <mikelley@xxxxxxxxxxxxx> Signed-off-by: Tianyu Lan <Tianyu.Lan@xxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20200406155331.2105-6-Tianyu.Lan@xxxxxxxxxxxxx Signed-off-by: Wei Liu <wei.liu@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/hv/vmbus_drv.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -48,6 +48,18 @@ static int hyperv_cpuhp_online; static void *hv_panic_page; +/* + * Boolean to control whether to report panic messages over Hyper-V. + * + * It can be set via /proc/sys/kernel/hyperv/record_panic_msg + */ +static int sysctl_record_panic_msg = 1; + +static int hyperv_report_reg(void) +{ + return !sysctl_record_panic_msg || !hv_panic_page; +} + static int hyperv_panic_event(struct notifier_block *nb, unsigned long val, void *args) { @@ -61,7 +73,7 @@ static int hyperv_panic_event(struct not * the notification here. */ if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE - && !hv_panic_page) { + && hyperv_report_reg()) { regs = current_pt_regs(); hyperv_report_panic(regs, val); } @@ -79,7 +91,7 @@ static int hyperv_die_event(struct notif * doing hyperv_report_panic_msg() later with kmsg data, don't do * the notification here. */ - if (!hv_panic_page) + if (hyperv_report_reg()) hyperv_report_panic(regs, val); return NOTIFY_DONE; } @@ -1262,13 +1274,6 @@ static void vmbus_isr(void) } /* - * Boolean to control whether to report panic messages over Hyper-V. - * - * It can be set via /proc/sys/kernel/hyperv/record_panic_msg - */ -static int sysctl_record_panic_msg = 1; - -/* * Callback from kmsg_dump. Grab as much as possible from the end of the kmsg * buffer and call into Hyper-V to transfer the data. */ Patches currently in stable-queue which might be from Tianyu.Lan@xxxxxxxxxxxxx are queue-5.4/x86-hyper-v-unload-vmbus-channel-in-hv-panic-callback.patch queue-5.4/x86-hyper-v-trigger-crash-enlightenment-only-once-during-system-crash.patch queue-5.4/x86-hyper-v-report-crash-register-data-or-kmsg-before-running-crash-kernel.patch queue-5.4/x86-hyper-v-report-crash-register-data-when-sysctl_record_panic_msg-is-not-set.patch queue-5.4/x86-hyper-v-report-crash-data-in-die-when-panic_on_oops-is-set.patch