Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3926897rdb; Thu, 14 Sep 2023 07:02:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IENuEJ2NUl8eiQ2onbSn2ZLKtkiNZl7vb/RppIGogJIP2zcqWJCB9BHvDODGH5QsiqMCtFx X-Received: by 2002:a17:90a:65c4:b0:25e:d727:6fb4 with SMTP id i4-20020a17090a65c400b0025ed7276fb4mr5379249pjs.2.1694700175287; Thu, 14 Sep 2023 07:02:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694700175; cv=none; d=google.com; s=arc-20160816; b=Wm2z89t33vTQhQV794kO7yOUUkOk/yDYaT3AJorA2vy0XbpRtfyBxb/EpKcXiZuSVc 8/J8q9hGN7FPIi11t3zlbmYrmjrA7cS9bBvwusclmof6NZdIzf6vvHXm2NbSbkrFj6Fn pkhdZNiTtnAcf0vRC5Ikz+I3CRxLxlvbz+H3TIvS3a7IOat9W17/Va1pK0HqNMKKTNZL peCeDCjIdSUHaEIQRo9XtYlMlhLyS+/gKrlWvNpUuHcpXTTSCXhqtzNP8W7On07txGVI ggqF4RguLchabfrmHd4I9ehdIQ/vnbU+CNcN3WxHWejSmLIjszppuMa++I/K4dGaOnh5 CzOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=nnYXkCG/5Yh2IwAUTv6Gzoypt5KtVmuWQWnNygyzFv0=; fh=oO43h3w0Gnh1/uzgjBLTRg+oe1Gv6aFHPIod5z8aS5s=; b=SmQpK8GNzu/c+hMppPBGGv97k5vN9PORDEWnV2F/BIs55zX2STFiO6aZin1T6Cnqyg yq4UwKhWPisTkkJjCifruKv3PrURZpmAkalw1nACRMyEEQZ/k0RIQVkRtq/wg9UphnRL N/Y/WBVI2VDqbih6tM9p49JbN8zL5Sbl7MGTIYSPH7as9KQsNfo4caiumanc6PpCQtz7 0tJ9EQZ5321i1ROXAL5CREi/o7/MCiNgnDbPzY05qFgHkYLxBj+z/0olxbbvdJASrNk1 jWe7pKCXYuIzR9oTYIKZC7yAYIl5AsbsLd1B1s0JFPoM4uy1kyuaDFhtzYbQONp0T/tI WTEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id b6-20020a17090a12c600b0025de453ee4csi1749689pjg.168.2023.09.14.07.02.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 07:02:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 832E58283A19; Thu, 14 Sep 2023 06:56:22 -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 S239368AbjINN4S (ORCPT + 99 others); Thu, 14 Sep 2023 09:56:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239273AbjINN4O (ORCPT ); Thu, 14 Sep 2023 09:56:14 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A57A1CEB; Thu, 14 Sep 2023 06:56:10 -0700 (PDT) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Rmf2700D8z6HJb0; Thu, 14 Sep 2023 21:54:22 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Thu, 14 Sep 2023 14:56:08 +0100 Date: Thu, 14 Sep 2023 14:56:07 +0100 From: Jonathan Cameron To: James Morse CC: , , , , , , , , , Salil Mehta , Russell King , Jean-Philippe Brucker , , Subject: Re: [RFC PATCH v2 16/35] ACPI: processor: Register CPUs that are online, but not described in the DSDT Message-ID: <20230914145607.00006f9b@Huawei.com> In-Reply-To: <20230913163823.7880-17-james.morse@arm.com> References: <20230913163823.7880-1-james.morse@arm.com> <20230913163823.7880-17-james.morse@arm.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml500006.china.huawei.com (7.191.161.198) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected 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]); Thu, 14 Sep 2023 06:56:22 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=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 On Wed, 13 Sep 2023 16:38:04 +0000 James Morse wrote: > ACPI has two descriptions of CPUs, one in the MADT/APIC table, the other > in the DSDT. Both are required. (ACPI 6.5's 8.4 "Declaring Processors" > says "Each processor in the system must be declared in the ACPI > namespace"). Having two descriptions allows firmware authors to get > this wrong. > > If CPUs are described in the MADT/APIC, they will be brought online > early during boot. Once the register_cpu() calls are moved to ACPI, > they will be based on the DSDT description of the CPUs. When CPUs are > missing from the DSDT description, they will end up online, but not > registered. > > Add a helper that runs after acpi_init() has completed to register > CPUs that are online, but weren't found in the DSDT. Any CPU that > is registered by this code triggers a firmware-bug warning and kernel > taint. > > Qemu TCG only describes the first CPU in the DSDT, unless cpu-hotplug > is configured. We should fix that as who likes warnings and taint :) I dread to think how common this will turn out to be. > > Signed-off-by: James Morse LGTM Reviewed-by: Jonathan Cameron > --- > drivers/acpi/acpi_processor.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c > index b4bde78121bb..a01e315aa16a 100644 > --- a/drivers/acpi/acpi_processor.c > +++ b/drivers/acpi/acpi_processor.c > @@ -790,6 +790,25 @@ void __init acpi_processor_init(void) > acpi_pcc_cpufreq_init(); > } > > +static int __init acpi_processor_register_missing_cpus(void) > +{ > + int cpu; > + > + if (acpi_disabled) > + return 0; > + > + for_each_online_cpu(cpu) { > + if (!get_cpu_device(cpu)) { > + pr_err_once(FW_BUG "CPU %u has no ACPI namespace description!\n", cpu); > + add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); > + arch_register_cpu(cpu); > + } > + } > + > + return 0; > +} > +subsys_initcall_sync(acpi_processor_register_missing_cpus); > + > #ifdef CONFIG_ACPI_PROCESSOR_CSTATE > /** > * acpi_processor_claim_cst_control - Request _CST control from the platform.