Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp456381rdb; Mon, 22 Jan 2024 09:13:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IEJCmlLdCeRKkFk/98okJwcQnHcYFxBQI9U0kYvzgulsXlQkpUbdFaymO3eb8NmdNfGwFm3 X-Received: by 2002:ac8:5dce:0:b0:42a:325b:e9a with SMTP id e14-20020ac85dce000000b0042a325b0e9amr5115405qtx.77.1705943626979; Mon, 22 Jan 2024 09:13:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705943626; cv=pass; d=google.com; s=arc-20160816; b=UAusK6h2fDXJMYL/DaYyDu+EE3C+I5dBgsSkYAF3ZB4XDT7CYYaKPR3Y+a3+DsFnbJ TP/39ZOlz2YKvgEVWx+rkb6RSlGsScGdhDf7rLzN3JZShPwrDsTB9csYqa3KvRgQ+Elu m98xKWOmpn1UtYZcDhMDEuaL1e/m1+J0NQQOElqg8Ap8PUUTwc8QqBuVQgrUXjD7qXiG aBkUe6p5bYN9xh4bPkbf+QZj1vrf4Da3Rqhy8M8MG1NrM8BHpF7abCl3j+qKI6eCHvRB 03u+DX3oZGzr+3oZ2vINNZEoxciaEZWq4CwtEpfWxZL2mKKmm9IoB0/UzFAxr6G3U9j2 zeXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date; bh=vrFrN/Clx8w5cq+5MmqFlkcL3WskH5N96mwqrlZgnBg=; fh=Znsn6mtEq8jmuIJgUo/xbgu3B+TeYmx4q5iWwbda34A=; b=tDfopcgarJndc91TMbXBqdr8HwP/wj/whiyvQRs7E1OTkMtHxUluOWF2R/iq36pDTj ceOYSEHOV+EwMjnu5pGvrtUYOJzDLkINT+qWK9Rb20ZRM7jQg00SlND/V9AhAs+vG9+g tvGBYoRX7iJ6ihAL/xMTXWe9k5RknvMOuCoinCRX+3jrNwAn0xpYMe659NVVTYGrFZfK KG5me9rIST+tAYyIsukiCJuU4BxEXDJrg4Gbpnrk9JYsGS17VB6f6fZc6mh9UZKjpqu6 O1Kd53NlDXwxnfAebJbsaLYyMSJoATxWFUr6+jm1FltVzwfaPF5HuQA9pv1HebMKrYJP 9SSQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-33646-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33646-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id j17-20020ac85f91000000b0042a47f949edsi885109qta.180.2024.01.22.09.13.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 09:13:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33646-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-33646-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33646-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9E9701C24469 for ; Mon, 22 Jan 2024 17:13:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 99CF84CB56; Mon, 22 Jan 2024 16:02:34 +0000 (UTC) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 552013E479; Mon, 22 Jan 2024 16:02:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705939354; cv=none; b=Rwzu8Dclo0PlUkoy6lIeD1MXAoFqViOPGQPt2vtlgYs2O7qJ1VeeKDKhtSQV2NiyF4oKTDPsZKZbVsPv7HpcDaGwtUONmREuN7SNZg3u9LCdhYVeY+KG/csBc3TnXmEeyaH3Fo6otiDTM88L8me+5eUQeT1xWJPozIVxBhkR5NE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705939354; c=relaxed/simple; bh=DfvUc1kkTAgFV9KbBC0HUkcLxAbVIJv/dK2TEfAAtq8=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=huohQdLaAwTIeg4SefLPIdvnoGWvp3do1yJx7cTMDlZTyBgl7jbP9P6p+WOPRQpMIHLQ1XUAb/sO+pTBym6ra5RdOwUxezcDNjRbo5/JArobeXfSZ8PbQxc9HyaniDo1kBlpE0JCiqqwk9pkJ6+p3C4g4Wcz1kPAKLwZ6cCa7aM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4TJZg429vPz6K6FL; Tue, 23 Jan 2024 00:00:00 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 89AC3140B2F; Tue, 23 Jan 2024 00:02:28 +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.35; Mon, 22 Jan 2024 16:02:27 +0000 Date: Mon, 22 Jan 2024 16:02:27 +0000 From: Jonathan Cameron To: "Russell King (Oracle)" CC: "Rafael J. Wysocki" , , , , , , , , , , , , , , , Salil Mehta , Jean-Philippe Brucker , , , James Morse Subject: Re: [PATCH RFC v3 03/21] ACPI: processor: Register CPUs that are online, but not described in the DSDT Message-ID: <20240122160227.00002d83@Huawei.com> In-Reply-To: References: Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: lhrpeml100005.china.huawei.com (7.191.160.25) To lhrpeml500005.china.huawei.com (7.191.163.240) On Mon, 15 Jan 2024 11:06:29 +0000 "Russell King (Oracle)" wrote: > On Mon, Dec 18, 2023 at 09:22:03PM +0100, Rafael J. Wysocki wrote: > > On Wed, Dec 13, 2023 at 1:49=E2=80=AFPM Russell King wrote: =20 > > > > > > From: James Morse > > > > > > ACPI has two descriptions of CPUs, one in the MADT/APIC table, the ot= her > > > 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. =20 > >=20 > > So why is this a kernel problem? =20 >=20 > So what are you proposing should be the behaviour here? What this > statement seems to be saying is that QEMU as it exists today only > describes the first CPU in DSDT. This confuses me somewhat, because I'm far from sure which machines this is true for in QEMU. I'm guessing it's a legacy thing with some old distro version of QEMU - so we'll have to paper over it anyway but for current QEMU I'm not sure it's true. Helpfully there are a bunch of ACPI table tests so I've been checking through all the multi CPU cases. CPU hotplug not enabled. pc/DSDT.dimmpxm - 4x Processor entries. -smp 4 pc/DSDT.acpihmat - 2x Processor entries. -smp 2 q35/DSDT.acpihmat - 2x Processor entries. -smp 2 virt/DSDT.acpihmatvirt - 4x ACPI0007 entries -smp 4 q35/DSDT.acpihmat-noinitiator - 4 x Processor () entries -smp 4=20 virt/DSDT.topology - 8x ACPI0007 entries I've also looked at the code and we have various types of CPU hotplug on x86 but they all build appropriate numbers of Processor() entries in DSDT. Arm likewise seems to build the right number of ACPI0007 entries (and doesn't yet have CPU HP support). If anyone can add a reference on why this is needed that would be very helpful. >=20 > As this patch series changes when arch_register_cpu() gets called (as > described in the paragraph above) we obviously need to preserve the > _existing_ behaviour to avoid causing regressions. So, if changing the > kernel causes user visible regressions (e.g. sysfs entries to > disappear) then it obviously _is_ a kernel problem that needs to be > solved. >=20 > We can't say "well fix QEMU then" without invoking the wrath of Linus. Overall I'm fine with the defensive nature of this patch as there 'might' be firmware out there with this problem - I just can't establish that there is! If anyone else recalls the history of this then give a shout. I vaguely wondered if this was an ia64 thing but nope, QEMU never generated tables for ia64 before dropping support back in QEMU 2.11 >=20 > > > Signed-off-by: James Morse > > > Reviewed-by: Jonathan Cameron > > > Reviewed-by: Gavin Shan > > > Tested-by: Miguel Luis > > > Tested-by: Vishnu Pajjuri > > > Tested-by: Jianyong Wu > > > Signed-off-by: Russell King (Oracle) > > > --- > > > drivers/acpi/acpi_processor.c | 19 +++++++++++++++++++ > > > 1 file changed, 19 insertions(+) > > > > > > diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_proces= sor.c > > > index 6a542e0ce396..0511f2bc10bc 100644 > > > --- a/drivers/acpi/acpi_processor.c > > > +++ b/drivers/acpi/acpi_processor.c > > > @@ -791,6 +791,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 namesp= ace description!\n", cpu); > > > + add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_= STILL_OK); > > > + arch_register_cpu(cpu); =20 > >=20 > > Which part of this code is related to ACPI? =20 >=20 > That's a good question, and I suspect it would be more suited to being > placed in drivers/base/cpu.c except for the problem that the error > message refers to ACPI. >=20 > As long as we keep the acpi_disabled test, I guess that's fine. > cpu_dev_register_generic() there already tests acpi_disabled. >=20 Moving it seems fine to me. Jonathan