From: Baoquan He <bhe@redhat.com>
To: Michael Kelley <mhklinux@outlook.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kexec@lists.infradead.org" <kexec@lists.infradead.org>,
"x86@kernel.org" <x86@kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
"linux-s390@vger.kernel.org" <linux-s390@vger.kernel.org>,
"linux-sh@vger.kernel.org" <linux-sh@vger.kernel.org>,
"linux-mips@vger.kernel.org" <linux-mips@vger.kernel.org>,
"linux-riscv@lists.infradead.org"
<linux-riscv@lists.infradead.org>,
"loongarch@lists.linux.dev" <loongarch@lists.linux.dev>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"ebiederm@xmission.com" <ebiederm@xmission.com>,
"hbathini@linux.ibm.com" <hbathini@linux.ibm.com>,
"piliu@redhat.com" <piliu@redhat.com>,
"viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH linux-next v3 06/14] x86, crash: wrap crash dumping code into crash related ifdefs
Date: Thu, 25 Jan 2024 12:09:36 +0800 [thread overview]
Message-ID: <ZbHfACpwqi2U9vmK@MiWiFi-R3L-srv> (raw)
In-Reply-To: <SN6PR02MB4157931105FA68D72E3D3DB8D47B2@SN6PR02MB4157.namprd02.prod.outlook.com>
On 01/24/24 at 11:02pm, Michael Kelley wrote:
> > diff --git a/arch/x86/kernel/cpu/mshyperv.c
> > b/arch/x86/kernel/cpu/mshyperv.c
> > index 01fa06dd06b6..f8163a59026b 100644
> > --- a/arch/x86/kernel/cpu/mshyperv.c
> > +++ b/arch/x86/kernel/cpu/mshyperv.c
> > @@ -210,6 +210,7 @@ static void hv_machine_shutdown(void)
> > hyperv_cleanup();
> > }
> >
> > +#ifdef CONFIG_CRASH_DUMP
> > static void hv_machine_crash_shutdown(struct pt_regs *regs)
> > {
> > if (hv_crash_handler)
> > @@ -221,6 +222,7 @@ static void hv_machine_crash_shutdown(struct
> > pt_regs *regs)
> > /* Disable the hypercall page when there is only 1 active CPU. */
> > hyperv_cleanup();
> > }
> > +#endif
> > #endif /* CONFIG_KEXEC_CORE */
>
> Note that the #ifdef CONFIG_CRASH_DUMP is nested inside
> #ifdef CONFIG_KEXEC_CODE here, and in the other Hyper-V code
> just below. It's also nested in xen_hvm_guest_init() at the bottom
> of this patch. But the KVM case of setting crash_shutdown is
> not nested -- you changed #ifdef CONFIG_KEXEC_CORE to #ifdef
> CONFIG_CRASH_DUMP.
>
> I think both approaches work because CONFIG_CRASH_DUMP implies
> CONFIG_KEXEC_CORE, but I wonder if it would be better to *not* nest
> in all cases. I'd like to see the cases be consistent so in the future
> someone doesn't wonder why there's a difference (unless there's
> a reason for the difference that I missed).
I agree with you, it's a great suggestion. Thanks.
Do you think below draft patch includes all changes you are concerned
about?
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index f8163a59026b..2e8cd5a4ae85 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -209,6 +209,7 @@ static void hv_machine_shutdown(void)
if (kexec_in_progress)
hyperv_cleanup();
}
+#endif /* CONFIG_KEXEC_CORE */
#ifdef CONFIG_CRASH_DUMP
static void hv_machine_crash_shutdown(struct pt_regs *regs)
@@ -222,8 +223,7 @@ static void hv_machine_crash_shutdown(struct pt_regs *regs)
/* Disable the hypercall page when there is only 1 active CPU. */
hyperv_cleanup();
}
-#endif
-#endif /* CONFIG_KEXEC_CORE */
+#endif /* CONFIG_CRASH_DUMP */
#endif /* CONFIG_HYPERV */
static uint32_t __init ms_hyperv_platform(void)
@@ -497,9 +497,11 @@ static void __init ms_hyperv_init_platform(void)
no_timer_check = 1;
#endif
-#if IS_ENABLED(CONFIG_HYPERV) && defined(CONFIG_KEXEC_CORE)
+#if IS_ENABLED(CONFIG_HYPERV)
+#if defined(CONFIG_KEXEC_CORE)
machine_ops.shutdown = hv_machine_shutdown;
-#ifdef CONFIG_CRASH_DUMP
+#endif
+#if defined(CONFIG_CRASH_DUMP)
machine_ops.crash_shutdown = hv_machine_crash_shutdown;
#endif
#endif
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 1287b0d5962f..f3130f762784 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -826,7 +826,7 @@ void machine_halt(void)
machine_ops.halt();
}
-#ifdef CONFIG_KEXEC_CORE
+#ifdef CONFIG_CRASH_DUMP
void machine_crash_shutdown(struct pt_regs *regs)
{
machine_ops.crash_shutdown(regs);
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-01-25 4:10 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-24 5:12 [PATCH linux-next v3 00/14] Split crash out from kexec and clean up related config items Baoquan He
2024-01-24 5:12 ` [PATCH linux-next v3 01/14] kexec: split crashkernel reservation code out from crash_core.c Baoquan He
2024-01-28 1:28 ` Klara Modin
2024-01-29 1:57 ` Baoquan He
2024-01-24 5:12 ` [PATCH linux-next v3 02/14] crash: split vmcoreinfo exporting " Baoquan He
2024-03-25 8:24 ` Geert Uytterhoeven
2024-03-25 9:48 ` Baoquan He
2024-01-24 5:12 ` [PATCH linux-next v3 03/14] crash: remove dependency of FA_DUMP on CRASH_DUMP Baoquan He
2024-01-24 5:12 ` [PATCH linux-next v3 04/14] crash: split crash dumping code out from kexec_core.c Baoquan He
2024-01-24 5:12 ` [PATCH linux-next v3 05/14] crash: clean up kdump related config items Baoquan He
2024-08-22 7:33 ` John Paul Adrian Glaubitz
2024-08-22 9:17 ` Baoquan He
2024-08-22 9:37 ` John Paul Adrian Glaubitz
2024-08-23 0:04 ` Baoquan He
2024-08-23 0:41 ` Dave Vasilevsky
2024-08-23 1:58 ` Baoquan He
2024-08-23 7:16 ` John Paul Adrian Glaubitz
2024-08-23 11:58 ` Dave Vasilevsky
2024-08-23 12:05 ` Dave Vasilevsky
2024-01-24 5:12 ` [PATCH linux-next v3 06/14] x86, crash: wrap crash dumping code into crash related ifdefs Baoquan He
2024-01-24 23:02 ` Michael Kelley
2024-01-25 4:09 ` Baoquan He [this message]
2024-01-25 5:12 ` Michael Kelley
2024-01-25 9:17 ` Baoquan He
2024-01-25 15:30 ` Michael Kelley
2024-01-24 5:12 ` [PATCH linux-next v3 07/14] arm64, " Baoquan He
2024-01-24 5:12 ` [PATCH linux-next v3 08/14] ppc, crash: enforce KEXEC and KEXEC_FILE to select CRASH_DUMP Baoquan He
2024-01-24 5:12 ` [PATCH linux-next v3 09/14] s390, crash: wrap crash dumping code into crash related ifdefs Baoquan He
2024-01-24 5:12 ` [PATCH linux-next v3 10/14] sh, " Baoquan He
2024-01-24 8:13 ` John Paul Adrian Glaubitz
2024-01-24 14:38 ` Baoquan He
2024-01-24 5:12 ` [PATCH linux-next v3 11/14] mips, " Baoquan He
2024-01-24 5:12 ` [PATCH linux-next v3 12/14] riscv, " Baoquan He
2024-01-24 5:12 ` [PATCH linux-next v3 13/14] arm, " Baoquan He
2024-01-24 5:12 ` [PATCH linux-next v3 14/14] loongarch, " Baoquan He
2024-01-26 4:55 ` [PATCH linux-next v3 00/14] Split crash out from kexec and clean up related config items Nathan Chancellor
2024-01-26 6:07 ` Baoquan He
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZbHfACpwqi2U9vmK@MiWiFi-R3L-srv \
--to=bhe@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=hbathini@linux.ibm.com \
--cc=kexec@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=loongarch@lists.linux.dev \
--cc=mhklinux@outlook.com \
--cc=piliu@redhat.com \
--cc=viro@zeniv.linux.org.uk \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).