Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1139015rdh; Fri, 27 Oct 2023 06:02:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGlgKhCJIH457REeuKpvvKKX7GtXjVP53E2l3AgQFs5eJmr+ojcwKfx1KoNyoUnDo7ScRrW X-Received: by 2002:a81:ae5f:0:b0:5a8:2037:36d9 with SMTP id g31-20020a81ae5f000000b005a8203736d9mr2303150ywk.25.1698411740915; Fri, 27 Oct 2023 06:02:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698411740; cv=none; d=google.com; s=arc-20160816; b=mCx+yqLzyiZA5yyy0vjfTB4A7aooTy2U4IfH7PGk80Mxpz4WYXHUp/iGZiafUcamAV QLytY8v0Pi2xfS3M/iLHkq12jnZ230u9l319ZcyafoVIU8/z6k92fjKJezQWsuTGgz3j AJRlj6mvcCYWFfGAwz/mpBA69V9c53dJpmm4H2VGWo9jWAYNyQFu/nIsngzryu2PfvNz U/b5uusjbHpyLIy4lBEo5K+HKHRef+DTucY+7B9/IaXzqpTcQDlMeC70GmjMUL0SyEGM F5k+G0T8T2jyHYdy6ONoE4smQqX6Q5mVvdrEuE1wqHZFIclsa5O99JhgjHNDYY/GyX7W QXlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=72juqfBpxnct6zFrt21QGRvoDPeFPQ0Z6l6BF4Ag34k=; fh=t+jScIUA7/jzXNJL4jj8X+jKRfA9+AUyvUFJMNvu6Lw=; b=iTbVDHytfmMCBq6HsMKtpW+bK09MOdjpN2JU8fWlk70H+CmPapQXZrUTRyMUJGRgPj xredRazczdJc54EamiSZDecM6iee0dE5xwueQinODZIjxgt5uAquBrtaSkN/gdSim/Ax LIx3QehAmfIQRGd3duLWUItW6wyq1Ioapyar5/jOdVjNVBSTJaK8RUBDqynaIsCoxTSO bHwmBBSscw92iUJESKv0pIugLHTgDVxGWl1/V6+yjXHX8B8mpGo2ubm1djR3OZqvp1nS QrNWptdcNo6hmY/0MwJDxer9esKHFtNhmAv1rkuKylGu7+VGy/7U31+AzH71JEBSyvvw FsaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=g+qB4383; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id t184-20020a815fc1000000b005ac61ae41c5si2390951ywb.227.2023.10.27.06.02.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 06:02:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=g+qB4383; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id D1C1583CE28E; Fri, 27 Oct 2023 06:02:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231345AbjJ0NBw (ORCPT + 99 others); Fri, 27 Oct 2023 09:01:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbjJ0NBu (ORCPT ); Fri, 27 Oct 2023 09:01:50 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADDD810E for ; Fri, 27 Oct 2023 06:01:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698411708; x=1729947708; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=jySUg5BBj2x92b+aCarRimTae0InN/QCh5etMPoVNIM=; b=g+qB4383mhSo7FfuWR97q+PZQwHvmzp2ro9m9dHGqrjImuauOkuryg1i K9yL9YKsMm7SVSiuuXPxAY8r4YNTU2PO2F6jMuwlcsQ/X731pQEqc9qZO RQRDHyIJaCm6DMZu66wQcPkeZvvP4zTDnfMt35ReGckQKlsEyG9DKkLLM ZfbOihc5a3V4ctkGCI/FafnyYVAlRUeiKm3mHY9NK6kvCCH2oMK7Bvtl3 8UpZD6fH9/V0ff1r0hR3nd99tV5YrOTk3tWuIdXB5XPdOK6ZsdjhBEflE 5yU98WG7iTmPmyB4wbegbNXW0+avQJBSSbtrcsvZnAppvt9+QcXxbB2oe g==; X-IronPort-AV: E=McAfee;i="6600,9927,10875"; a="9309468" X-IronPort-AV: E=Sophos;i="6.03,256,1694761200"; d="scan'208";a="9309468" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2023 06:01:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10875"; a="736080004" X-IronPort-AV: E=Sophos;i="6.03,256,1694761200"; d="scan'208";a="736080004" Received: from nirmoyda-mobl.ger.corp.intel.com (HELO box.shutemov.name) ([10.251.213.108]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2023 06:01:42 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id 5FA5210A210; Fri, 27 Oct 2023 16:01:39 +0300 (+03) Date: Fri, 27 Oct 2023 16:01:39 +0300 From: "Kirill A. Shutemov" To: Kuppuswamy Sathyanarayanan Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "Rafael J. Wysocki" , Peter Zijlstra , Adrian Hunter , Elena Reshetova , Jun Nakajima , Rick Edgecombe , Tom Lendacky , "Kalra, Ashish" , Sean Christopherson , "Huang, Kai" , Baoquan He , kexec@lists.infradead.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCHv2 11/13] x86/acpi: Do not attempt to bring up secondary CPUs in kexec case Message-ID: <20231027130139.iqvjpu2rizmsxxz7@box.shutemov.name> References: <20231020151242.1814-1-kirill.shutemov@linux.intel.com> <20231020151242.1814-12-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 27 Oct 2023 06:02:06 -0700 (PDT) On Tue, Oct 24, 2023 at 06:59:58AM -0700, Kuppuswamy Sathyanarayanan wrote: > > > On 10/20/2023 8:12 AM, Kirill A. Shutemov wrote: > > ACPI MADT doesn't allow to offline CPU after it got woke up. It limits > > kexec: the second kernel won't be able to use more than one CPU. > > > > Now acpi_mp_wake_mailbox_paddr already has the mailbox address. > > The acpi_wakeup_cpu() will use it to bring up secondary cpus. > > > > Zero out mailbox address in the ACPI MADT wakeup structure to indicate > > that the mailbox is not usable. This prevents the kexec()-ed kernel > > from reading a vaild mailbox, which in turn makes the kexec()-ed kernel > > only be able to use the boot CPU. > > > > This is Linux-specific protocol and not reflected in ACPI spec. > > > > Booting the second kernel with signle CPU is enough to cover the most > > common case for kexec -- kdump. > > > > Signed-off-by: Kirill A. Shutemov > > --- > > arch/x86/kernel/acpi/madt_wakeup.c | 22 ++++++++++++++++++++++ > > 1 file changed, 22 insertions(+) > > > > diff --git a/arch/x86/kernel/acpi/madt_wakeup.c b/arch/x86/kernel/acpi/madt_wakeup.c > > index 4bc1d5106afd..9bbe829737e7 100644 > > --- a/arch/x86/kernel/acpi/madt_wakeup.c > > +++ b/arch/x86/kernel/acpi/madt_wakeup.c > > @@ -13,6 +13,11 @@ static struct acpi_madt_multiproc_wakeup_mailbox *acpi_mp_wake_mailbox; > > > > static int acpi_wakeup_cpu(int apicid, unsigned long start_ip) > > { > > + if (!acpi_mp_wake_mailbox_paddr) { > > + pr_warn_once("No MADT mailbox: cannot bringup secondary CPUs. Booting with kexec?\n"); > > + return -EOPNOTSUPP; > > + } > > + > > /* > > * Remap mailbox memory only for the first call to acpi_wakeup_cpu(). > > * > > @@ -78,6 +83,23 @@ int __init acpi_parse_mp_wake(union acpi_subtable_headers *header, > > > > cpu_hotplug_disable_offlining(); > > > > + /* > > + * ACPI MADT doesn't allow to offline CPU after it got woke up. > > + * It limits kexec: the second kernel won't be able to use more than > > + * one CPU. > > + * > > + * Now acpi_mp_wake_mailbox_paddr already has the mailbox address. > > + * The acpi_wakeup_cpu() will use it to bring up secondary cpus. > > + * > > + * Zero out mailbox address in the ACPI MADT wakeup structure to > > + * indicate that the mailbox is not usable. This prevents the > > + * kexec()-ed kernel from reading a vaild mailbox, which in turn > > + * makes the kexec()-ed kernel only be able to use the boot CPU. > > + * > > + * This is Linux-specific protocol and not reflected in ACPI spec. > > + */ > > + mp_wake->base_address = 0; > > Is there any way to skip secondary CPU bring-up for kexec case instead of > returning error in ->wakeup_secondary_cpu_64()? I have not found a cleaner way. Do you have ideas? -- Kiryl Shutsemau / Kirill A. Shutemov