Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2845286rdb; Wed, 15 Nov 2023 12:13:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IFmX3bFwV2DuXS7J/KU3ZZlRAzrshi1Y1vuGFycMt94rqamKJbMs/4vYVidN1oxawxCP62I X-Received: by 2002:a17:902:74c3:b0:1cd:f94b:1823 with SMTP id f3-20020a17090274c300b001cdf94b1823mr6070145plt.64.1700079198280; Wed, 15 Nov 2023 12:13:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700079198; cv=none; d=google.com; s=arc-20160816; b=jrOOLidN3Lb4oAs6dVv/W1rZqxyiMwKbnIZVFULWom3Wu5fZm4VY7q5x6aOuzC/Qer 8c92zARTYRf0s0qq+ZyM+X4Jmshw/06R2HDaZyW4s+IokUxuYUMS+YBcGAMB+UIORF/u ZvkpCoeDfNTGudhnCk8GRB6cxHJkz4DmDzDTltzh/wWokYRZI/zqu9BFJBPBJs6QbJHC BfJQP5dGLAAaAvwpn3+jpALNGXVkzeoxzW9yY/din1UIV2S6t25JF3SIeFuTRysj2Wwn onpE+XFrDwSHeyJ7HEP/QaPCX7Igd1r5PqdYUw09cbaG/MH8fkcoW6ApNDnHjIxlyBJK dJfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=r0qnzrKUBmsWORqDSa8T12KYHLSNp48u9GU8kRFgVN8=; fh=DfaIPJv7k2VREnpcFEFcGWb1t1Mhrg/4oykncI6AXqQ=; b=QUOY6Ja5Jut84Q8BZv7vxl/HbK6X1WnaJaAekhf4i8Uh/4Tp/DyXfyuND3u4qK7wP3 EUp5ov1mudYtc6K3zYBWeW7uwzKSjbp5A7kWZx8ibh8dNnDRVwWVvdqMqLolvKVrvkrg 0iK1avGuFDNluYmZrblMdAVcvLTthoGuGmVVfEsCwDiAdv6Wh7HqxbQoKcvm8e5HceXC VaO5Vh8GaioXiPOz8SyHpccbmGyzvaofYm7mF8xhfLKoPCSWI8P8YlSMz41rhI25JBp3 Fj6NjS+5QhZNDU27tX7gDF4U1+Pu2CfBljK42wwFPU/aFrTxKvBTJY3XpK9UCX7LSH58 +dSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mMuO5AmI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id l8-20020a63ba48000000b00578db6172fdsi10757939pgu.325.2023.11.15.12.13.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 12:13:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mMuO5AmI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id D44FA8053606; Wed, 15 Nov 2023 12:13:15 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343908AbjKOUNB (ORCPT + 99 others); Wed, 15 Nov 2023 15:13:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230107AbjKOUM7 (ORCPT ); Wed, 15 Nov 2023 15:12:59 -0500 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FCC7B9 for ; Wed, 15 Nov 2023 12:12:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700079177; x=1731615177; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=Lc1jWISARgFdJYQUQcrkIWD4qhOpyFCrbPiSfmP2Hk4=; b=mMuO5AmIyEekpOCqjL+GyshBt4EycOZF91jM1dmzhjfFs4Atc9tO973Z 9XDUelDSHFNmcV0+IONfXbCgF9uqA1M3L2u1YX935QsTiWcoRUz+1Pq8X 3ocdXgPF2MIvRFCD3pDghpQw05CKGaLKXnArjevXOZj8TqSW+7Q4R6n6/ 2iRLl6jSCnbjF53Af+QUiy3oDnHYprC81NzEbW9EPtmuRBIFoiEPTAG5T 6Z7dXUb4g0Mr5IyyqhLnmaLMAU3lLi2Qk/nJa+JpR5i2UbEeIm/XB3IfI dwNHmB9UCR86d+dYLmZd1tPO7CvbeB1zkybjFwypqcrMf0W0xcbOkZGes g==; X-IronPort-AV: E=McAfee;i="6600,9927,10895"; a="9587830" X-IronPort-AV: E=Sophos;i="6.03,306,1694761200"; d="scan'208";a="9587830" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Nov 2023 12:12:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10895"; a="855756093" X-IronPort-AV: E=Sophos;i="6.03,306,1694761200"; d="scan'208";a="855756093" Received: from ybradsha-mobl1.amr.corp.intel.com (HELO [10.212.204.204]) ([10.212.204.204]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Nov 2023 12:12:54 -0800 Message-ID: <09e0c289-9693-4376-9b89-0f74715f7728@linux.intel.com> Date: Wed, 15 Nov 2023 12:12:54 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCHv3 13/14] x86/acpi: Do not attempt to bring up secondary CPUs in kexec case Content-Language: en-US To: "Kirill A. Shutemov" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org Cc: "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 References: <20231115120044.8034-1-kirill.shutemov@linux.intel.com> <20231115120044.8034-14-kirill.shutemov@linux.intel.com> From: Kuppuswamy Sathyanarayanan In-Reply-To: <20231115120044.8034-14-kirill.shutemov@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Wed, 15 Nov 2023 12:13:16 -0800 (PST) On 11/15/2023 4:00 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 > Reviewed-by: Kai Huang > --- Looks good to me. Reviewed-by: Kuppuswamy Sathyanarayanan > 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 386adbb03094..5d92d12f1042 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 __ro_afte > > static int acpi_wakeup_cpu(u32 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->mailbox_address = 0; > + > apic_update_callback(wakeup_secondary_cpu_64, acpi_wakeup_cpu); > > return 0; -- Sathyanarayanan Kuppuswamy Linux Kernel Developer