From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5115AC47422 for ; Thu, 25 Jan 2024 09:18:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4LFgcV4DwQTu00x4jFiio7AjUR0Aap/mLVGsNfmaggI=; b=lq3YpRTLZ8k23Z 4MHrPWvvvJWFeFJiLmUtZmfUK02y2V1r8PIcCOM6YPgf3ZPe4VAUdqlbtm97Y3NNLtlbzau3Cdgde s+gSkOvBXNaarZ8/7bU/Le8gqavdXOkIBz6+u1/KzgJ5zNsOj+7UIzVs0lZ2if33yf2Kw3y7afQ5S TU5O73JqEnlSB/QiejfhbcbiFA1/iqnTawbOJiWjR+6C+MebLHVhY6kNvLiigOgTfGRp98ycXa81a u63/tIvCWNF/XmM2F+WX3Ogq7SUYnrvMGLBHhcI4rtKY0Zq6cjcChJfS+SWJ/wcQHjMfwJH6nO01X 4jqAtGBLazskbRbvn3HQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rSvrh-007VMY-2x; Thu, 25 Jan 2024 09:17:41 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rSvrc-007VI2-1G for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 09:17:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706174249; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=SDoUkylaVEDmZz6nqfW3ZjNKRZGYGdls3feFdR//5ps=; b=coOFFbzRPEdTM7H5AaoPSRHNlSboakdJ80ElPMgMm6CeUkH5IhNa99LDuyLAKKSHosEUaA iGZeEkTkRzvl53AEhVVVAe213AU0jRgHh/AmBPkIqQBThoK2+tUHO9LYsdR40LbKwKgF0P rfmBTvMVaU5syC4DCb7xdAphYSeycZY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-636-iCprDXE0NJaMkShWq3Qs8Q-1; Thu, 25 Jan 2024 04:17:26 -0500 X-MC-Unique: iCprDXE0NJaMkShWq3Qs8Q-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 701931013682; Thu, 25 Jan 2024 09:17:25 +0000 (UTC) Received: from localhost (unknown [10.72.116.117]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8814F1C060AF; Thu, 25 Jan 2024 09:17:24 +0000 (UTC) Date: Thu, 25 Jan 2024 17:17:21 +0800 From: Baoquan He To: Michael Kelley Cc: "linux-kernel@vger.kernel.org" , "kexec@lists.infradead.org" , "x86@kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-s390@vger.kernel.org" , "linux-sh@vger.kernel.org" , "linux-mips@vger.kernel.org" , "linux-riscv@lists.infradead.org" , "loongarch@lists.linux.dev" , "akpm@linux-foundation.org" , "ebiederm@xmission.com" , "hbathini@linux.ibm.com" , "piliu@redhat.com" , "viro@zeniv.linux.org.uk" Subject: Re: [PATCH linux-next v3 06/14] x86, crash: wrap crash dumping code into crash related ifdefs Message-ID: References: <20240124051254.67105-1-bhe@redhat.com> <20240124051254.67105-7-bhe@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240125_011736_543606_2467C250 X-CRM114-Status: GOOD ( 32.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 01/25/24 at 05:12am, Michael Kelley wrote: > From: Baoquan He Sent: Wednesday, January 24, 2024 8:10 PM > > > > 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? > > Yes, these changes look good as a delta to your original patch. > > But also look at xen_hvm_guest_init(). It looks like your original patch > does nesting there as well, and it could probably be "un-nested". Right. I checked them all in arch/x86 this time, hope nothing is missed again. I can post a v4 to update this x86 patch later if no other concern. Thanks. 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); diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c index 09e3db7ff990..0b367c1e086d 100644 --- a/arch/x86/xen/enlighten_hvm.c +++ b/arch/x86/xen/enlighten_hvm.c @@ -148,6 +148,7 @@ static void xen_hvm_shutdown(void) if (kexec_in_progress) xen_reboot(SHUTDOWN_soft_reset); } +#endif #ifdef CONFIG_CRASH_DUMP static void xen_hvm_crash_shutdown(struct pt_regs *regs) @@ -156,7 +157,6 @@ static void xen_hvm_crash_shutdown(struct pt_regs *regs) xen_reboot(SHUTDOWN_soft_reset); } #endif -#endif static int xen_cpu_up_prepare_hvm(unsigned int cpu) { @@ -238,10 +238,10 @@ static void __init xen_hvm_guest_init(void) #ifdef CONFIG_KEXEC_CORE machine_ops.shutdown = xen_hvm_shutdown; +#endif #ifdef CONFIG_CRASH_DUMP machine_ops.crash_shutdown = xen_hvm_crash_shutdown; #endif -#endif } static __init int xen_parse_nopv(char *arg) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel