Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp892554rdb; Fri, 20 Oct 2023 02:29:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHUW/PkQFJogwFxdKr0DoCWWIXGuogAr2O1Xgim0Hc33EZCWy1iaRXhfh8pzTPQ6WrbHBe9 X-Received: by 2002:a05:6870:1148:b0:1ea:eed:fd02 with SMTP id 8-20020a056870114800b001ea0eedfd02mr1195689oag.45.1697794192807; Fri, 20 Oct 2023 02:29:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697794192; cv=none; d=google.com; s=arc-20160816; b=n4IdO0lKsyNhgbOTY57Ufjl6KPS3RxKmW87FojuFBoT46ydsdv8TT8flsWSxRFgy6C tlToh3bscOFEr8hzdFUnVXsGaYpMF2daaH+hiOnvAV/uDRSAeiDntQqWbM5SKfNmovze Ku95T307FCDocf5G41JCM/2/CNMaIzDHEAMspBt8F0YP38ka1Dh9J9OgrQ4osfmLoeO5 AOcLvi8Sjf/64Mb6DQI4+kApwL17xSoJ1Ow5KcisGp4glRJP+SmGiHSfBKFync7XWbOY XmpNlqBtHFj5wIM1wLoQ3HD3Hs7z3uTfwYBNh1xHqGtUwwYaf6TyU7h06vTWmdSFj7HV purQ== 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=56xILx2W2FbZ+nayHBcbeoGz5jmwRJWptQacBeUstU0=; fh=HXgKhMpP3NR0oFIvtr7coEU3Z/s2pWD4Y60/u8oLjgg=; b=Zx35dLrwtfVAgJau2ZIjdIcmWG9E5XpSTrkykmeB2WM/GFUQMdctfE/sTEtkg1xYkL nYMkKuXJOc0VIMtW2mryAduDPOns21HyZcvx5k55fwj3KCnykd4kQKsbVmqooZFGLIT9 10bzjmbTFEMNWWjtqp15V0y7kRpO6NC/IzFxWdc1Rr/HnFddWjzVgVPwj5TZEmt4cbiL 8Zv4bwr2wPad3CAOkjoHDqQsyb3fwNOFVtwYEOD48mfqWy3Ed1LBq6dmcBXocuI1DX49 Emfk1I0/NDtnOqkDVtsPE5kwThqSoH6iX2VB+9XOUu18m3sYEhmAxOBdn7btQeaBiRCU rACA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Gq54QSBH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id r31-20020a63205f000000b00565e42df278si1416149pgm.759.2023.10.20.02.29.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 02:29:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Gq54QSBH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 1A626833CE3F; Fri, 20 Oct 2023 02:29:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376615AbjJTJ3k (ORCPT + 99 others); Fri, 20 Oct 2023 05:29:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376593AbjJTJ3j (ORCPT ); Fri, 20 Oct 2023 05:29:39 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB390D49 for ; Fri, 20 Oct 2023 02:29:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697794176; x=1729330176; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=4jcyR0AHrPRoptorbJ7sUPfnYiRZ/f0uNOPZCGqeL0M=; b=Gq54QSBHKnLde/XUHaMNgHMzsVgEPKRnFQAgIGUyGJwbMD3bGpePTZzB uqFhOf64kqprt34jmZr01vwjW9dYaftR/69OSejzv8/y3OmkErDYOAcnh hFRrTkwH3cTb+UKlF9vvPR1KokfkSSLRj6GnWbxWzvZflb72uELuSsSoZ AIcjfhs5mCdToguNTCF48em3QbqXeqOW9iFwlzCYo/sIIgfK+FiSkc/5j 8slOxtLXFWJJJFVNujy0PmpU+0U8mQc5wUyYPQaF+58S+YtNIgKbmTCQr 2FRaX9mqa/NApRlYG6OYzTYxN8whBjrtjPRFJDS5CeqX6BT+tYBaQVn16 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10868"; a="452943109" X-IronPort-AV: E=Sophos;i="6.03,238,1694761200"; d="scan'208";a="452943109" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2023 02:29:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10868"; a="873848717" X-IronPort-AV: E=Sophos;i="6.03,238,1694761200"; d="scan'208";a="873848717" Received: from dgutows1-mobl.ger.corp.intel.com (HELO box.shutemov.name) ([10.249.39.237]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2023 02:29:32 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id 9E13B109D0A; Fri, 20 Oct 2023 12:29:29 +0300 (+03) Date: Fri, 20 Oct 2023 12:29:29 +0300 From: "kirill.shutemov@linux.intel.com" To: "Huang, Kai" Cc: "tglx@linutronix.de" , "mingo@redhat.com" , "x86@kernel.org" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "Edgecombe, Rick P" , "Reshetova, Elena" , "Nakajima, Jun" , "rafael@kernel.org" , "peterz@infradead.org" , "sathyanarayanan.kuppuswamy@linux.intel.com" , "Hunter, Adrian" , "thomas.lendacky@amd.com" , "linux-kernel@vger.kernel.org" , "kexec@lists.infradead.org" , "linux-coco@lists.linux.dev" Subject: Re: [PATCH 12/13] x86/acpi: Do not attempt to bring up secondary CPUs in kexec case Message-ID: <20231020092929.ieig5xbhtwgrkqrl@box> References: <20231005131402.14611-1-kirill.shutemov@linux.intel.com> <20231005131402.14611-13-kirill.shutemov@linux.intel.com> <100c567d4ba2e6f25dd6c51ceaf2995049d12c78.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <100c567d4ba2e6f25dd6c51ceaf2995049d12c78.camel@intel.com> 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 howler.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 (howler.vger.email [0.0.0.0]); Fri, 20 Oct 2023 02:29:50 -0700 (PDT) On Fri, Oct 20, 2023 at 03:29:24AM +0000, Huang, Kai wrote: > On Thu, 2023-10-05 at 16:14 +0300, Kirill A. Shutemov wrote: > > ACPI MADT doesn't allow to offline CPU after it got woke up. It limits > > kexec: target kernel won't be able to use more than one CPU. > > > > Zero out mailbox address in the ACPI MADT wakeup structure to indicate > > that the mailbox is not usable. > > > > This is Linux-specific protocol and not reflected in ACPI spec. > > > > Booting the target 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 | 17 +++++++++++++++++ > > 1 file changed, 17 insertions(+) > > > > diff --git a/arch/x86/kernel/acpi/madt_wakeup.c b/arch/x86/kernel/acpi/madt_wakeup.c > > index 15bdf10b1393..4e92d1d4a5fa 100644 > > --- a/arch/x86/kernel/acpi/madt_wakeup.c > > +++ b/arch/x86/kernel/acpi/madt_wakeup.c > > @@ -9,6 +9,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,18 @@ int __init acpi_parse_mp_wake(union acpi_subtable_headers *header, > > /* Disable CPU onlining/offlining */ > > cpu_hotplug_not_supported(); > > > > + /* > > + * ACPI MADT doesn't allow to offline CPU after it got woke up. > > + * It limits kexec: target kernel won't be able to use more than > > + * one CPU. > > + * > > + * Zero out mailbox address in the ACPI MADT wakeup structure to > > + * indicate that the mailbox is not usable. > > Nit: > > It is better to explicitly say that this will only impact the second kernel > because the current kernel has already detected the mailbox address? > > 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. Okay. Looks good. -- Kiryl Shutsemau / Kirill A. Shutemov