Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp514591pxb; Thu, 12 Aug 2021 23:32:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDEafJRbQsNT0MCXJsRtgeiGD/upt+MOZRmDNJVP8KL3mTRLjxzc2PHdTFzgidkp/c3OJD X-Received: by 2002:a92:de4b:: with SMTP id e11mr736308ilr.22.1628836373686; Thu, 12 Aug 2021 23:32:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628836373; cv=none; d=google.com; s=arc-20160816; b=qIPpzk+OBW8/OV5d0ASLprCR2vSfVHQiYfpd+jWX/1igk8MaDt2dy4sSZMdu4cr4Um EZAJKz8/WY9sKkxD7/XI7B4YlvbDs+wxcx9ZDH6oOHYuSiXOcYThjssK/kusyhGaV4Xd GRyM3Pamf3aPAbYVv1Egmw+1cveEAEIE8b/JmlbAjW833UWVFsG5Y1Ik7Eh+3hHvIiY2 6eRiWHmhEsIdUINxCV1p6arhMhjNAqb8+d+FWGfOgmtxu2IgP2Eyn4lhDyqeskiDbkmN F84HM96rmbHdgatc+uD7yD5Maneh/8XaLR0c8A/nAy54qq9bWf233BFSRJnl/BdDvNaG nRfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=nRmYsld+i1NMovA913PuYub8fWt8n6Vtg/Fhnh94drQ=; b=cKI6mDfVmuwbvSWgcJk3CLi4+yt0HQirW3qFfHgq1/JTq07oxSplhvtMpwa6SnS5oG 8jsF9JMXAauJlawaMMrxBxX9f1IBwRZYjuJ+CFauKz96m4WLdpJdxpc66WuuJKC0Onqa AVLssFYTFHGFo1aMR7fqSgz3aLAF7pEBfJZ+AOL/+Wj9KzwbpKfKwNKyA6subHkzvQLP K4w5i9+DBLxMezlG3UdApfSMTL0f+FXEk/1h7xbTaqkFSflT+/Yi4bIsc+sUxkuRvpqm XaM9BdaXfZYQqpfkGZUSk0nzNp2TE033xtiBdl05IAkEhS/k/4etCVW7SUeuqhfPtfyL OO4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b4si662467ile.87.2021.08.12.23.32.42; Thu, 12 Aug 2021 23:32:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238855AbhHMG1a (ORCPT + 99 others); Fri, 13 Aug 2021 02:27:30 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:13310 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238523AbhHMG1a (ORCPT ); Fri, 13 Aug 2021 02:27:30 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4GmD9Y4K3nz85pm; Fri, 13 Aug 2021 14:26:57 +0800 (CST) Received: from dggpemm500002.china.huawei.com (7.185.36.229) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Fri, 13 Aug 2021 14:26:57 +0800 Received: from [10.174.178.247] (10.174.178.247) by dggpemm500002.china.huawei.com (7.185.36.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Fri, 13 Aug 2021 14:26:56 +0800 Subject: Re: [PATCH] x86/acpi: Don't add CPUs that are not online capable To: Mario Limonciello , Borislav Petkov , Ingo Molnar , Thomas Gleixner CC: Alex Deucher , Huang Rui , "Rafael J. Wysocki" , Len Brown , Pavel Machek , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , Robert Moore , Erik Kaneda , "open list:SUSPEND TO RAM" , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:ACPI" , "open list:ACPI COMPONENT ARCHITECTURE (ACPICA)" References: <20210812051657.28605-1-mario.limonciello@amd.com> From: Hanjun Guo Message-ID: Date: Fri, 13 Aug 2021 14:26:56 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20210812051657.28605-1-mario.limonciello@amd.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.178.247] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500002.china.huawei.com (7.185.36.229) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/8/12 13:16, Mario Limonciello wrote: > A number of systems are showing "hotplug capable" CPUs when they > are not really hotpluggable. This is because the MADT has extra > CPU entries to support different CPUs that may be inserted into > the socket with different numbers of cores. > > The ACPI spec is clear that the Online Capable bit in the > MADT should be used to determine whether or not a CPU is hotplug > capable when the enabled bit is not set. This was introduced in ACPI 6.3 spec, which means ACPI 6.2 and earlier versions don't include the "Online Capable bit". > > Link: https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/05_ACPI_Software_Programming_Model/ACPI_Software_Programming_Model.html?#local-apic-flags > Reviewed-by: Alex Deucher > Reviewed-by: Huang Rui > Signed-off-by: Mario Limonciello > --- > arch/x86/kernel/acpi/boot.c | 6 ++++++ > include/acpi/actbl2.h | 1 + > 2 files changed, 7 insertions(+) > > diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c > index e55e0c1fad8c..eeb10b27d6de 100644 > --- a/arch/x86/kernel/acpi/boot.c > +++ b/arch/x86/kernel/acpi/boot.c > @@ -239,6 +239,12 @@ acpi_parse_lapic(union acpi_subtable_headers * header, const unsigned long end) > if (processor->id == 0xff) > return 0; > > + /* don't register processors that can not be onlined */ > + if (!(processor->lapic_flags & ACPI_MADT_ENABLED)) { > + if (!(processor->lapic_flags & ACPI_MADT_ONLINE_CAPABLE)) > + return 0; > + } For firmware using ACPI 6.2 and early versions, the ACPI_MADT_ONLINE_CAPABLE bit is reserved as zero, so if we set CPU as disabled, the code here will always return 0 in those firmwares. > + > /* > * We need to register disabled CPU as well to permit > * counting disabled CPUs. This allows us to size So we will not register the disabled CPU and will break CPU hotplug features. I think we need to consider the compatibility with old versions of firmware. Thanks Hanjun