Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp3629rdb; Thu, 25 Jan 2024 06:46:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IFneujWcBp/IHg68xdb9RvBfM1EBhYiXZP6iverQzriRbuIL16IR1OzuPergLuNJMdtLwNV X-Received: by 2002:a05:6a20:12d0:b0:19a:4d54:67e4 with SMTP id v16-20020a056a2012d000b0019a4d5467e4mr1730095pzg.2.1706193969678; Thu, 25 Jan 2024 06:46:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706193969; cv=pass; d=google.com; s=arc-20160816; b=X8r1T18UtpHW3+bOjlipqXVEHCXAGO8RDri6AK0nNZwEsxkG4DzFdY6Dof/rF/uDDb 1M0RLlaYam2y3w9c4x9ZCXsxA6ouXPkcXWGMpNUfnaOy5N3ITws28UDV2Rc4AXj6d06S bEXAouVIa2DReqVlXKFz9ngivL16qebsxsJ0HDAVUIVBkkZV1nJBGl1FZO3Buu/ZHC6K 0A5jbZC0AIxuFLclwJa0h3omxMLwD6A0t/2skDztvwWTadAhDwzUvH4zYzi+MOeHqndL FGIYG60HewwMSCaz9naSbO3f3m8RIPWHBTVhtcyCzPzTyA7vyCBNsSZG7+Y6Rq8yLmCU JNbg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=WansAIK1kV2qngBkKGzUZEv8a9oLEEFRWHM6D4Yzd+M=; fh=f506qHuAmFIuQHFCkvj2XWyudXzbCE8KDmSyVNm5NhI=; b=KYz3ivjY1URbxn5tyQ/pCQRc7W/N2m0cqkdsB6aJA8rF/V/QcpiJ1XeGKamQUWT26O RPw/UDQyI5+2Qe6bpFb9OL6kS2RpuU86mQUNVCJPQozNW8+56tcT3xBQRdyST+TtdofN 6aQVDm8qB+P0peHjMopsOkAnsDRNVTuhtdxqS/foiFNvdOhcnMYrGMGKT/mzK9WNVO1G N8M9QrKMdhpOP4ky420YcyyzL8ytpEgge0AeLQsgfnmJAl62FlDuW3z91MYHQ8A/V+Og PXBuq8Na36DW9SPhSgEy96wS/WulOkbdRybfHurvhL0W7v/hgmQ/OKXksBtW7wHc2/Nf N9Gg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-38735-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38735-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id n43-20020a056a000d6b00b006ddc793542asi1354403pfv.199.2024.01.25.06.46.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 06:46:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38735-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-38735-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38735-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 436FDB2383B for ; Thu, 25 Jan 2024 14:43:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 619846EB48; Thu, 25 Jan 2024 14:42:49 +0000 (UTC) Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21F606E2BE; Thu, 25 Jan 2024 14:42:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706193768; cv=none; b=j3r3DXqrfz30ufF3kd/DxqHHFm9HaviolvCyVunL78NRb0FpDDG4fAwOr4y7ggEtcVBrB5P3WDik8qyNDjaxa4lEdF0p/PNpE+OtWBp//gJJMYcPIqTMnOBBqT6U0lr3hz6S3QFoJmwm4L8UxOpnNUifvr4bYrW06gtbE16S45Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706193768; c=relaxed/simple; bh=JaK07Zkj3cT2yhn6Ow34x5ujcw/CKNJtlZf/Ls0PoA8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=pbZslrDJaKPlwZU1G/h2QbxCOX5IXjCYd0FuK7kpCBywYl9zdvdP2GwZmHkKlMDyVqxi2o6lB2TQL2FBbE9LtLoQ2orphGEFRwLn6bk8N4E1S9QAwaLQxLKzh3SkZIbo0RJon7wKVk4STGvKxys8SEIL5WLxkMudBbWKZj+XoF8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.167.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oi1-f178.google.com with SMTP id 5614622812f47-3bc21303a35so1267870b6e.0; Thu, 25 Jan 2024 06:42:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706193766; x=1706798566; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WansAIK1kV2qngBkKGzUZEv8a9oLEEFRWHM6D4Yzd+M=; b=IoiMUcqNl7waglleg4DMIDbjGLYPOtueAM47JFRrHhPGkxwxuLLsVS9de59v5QoP9B 5Uc5KkUmSuyqw8j1K7AmEDhnU4r287eMQqUbdfVvONklySaCn3eqHmds9fCpNOZUIMEf bMWfE0WQmvEOQ3JtfjtspI4FU9p6H8lllR+/9DfJwge3Lzkzs+mFM8/pl2eUbyx4nZ1o t9m1BHY3hwL4HBI5nMdY2oj8YImSrEwLyosoO/DZ9MB0WhNop5w6Hf2/0nEg1sTiG0gC s7em5sXAcOw5RfiDD//kODRQEDIXIvo7iPyUinOQTFFpFJVzB1j5GDcAFqurlHi4S/er RgTA== X-Gm-Message-State: AOJu0YyFgNwgV1M4/ZtQ2OUQEOPW6B+T/bT7jf4AzXMzJusQqhM/5GsG yedihfax1gzKbOeQSJpvXrPLZ+dbTEZWcrOSLDNkyylxlcX9nlcIPwPkztqeyFH7K8ejlVNKHyv uT616HujBtSTzsDE/UQwXwV2W3eg= X-Received: by 2002:a05:6870:618a:b0:214:dbdd:a173 with SMTP id a10-20020a056870618a00b00214dbdda173mr987239oah.3.1706193766071; Thu, 25 Jan 2024 06:42:46 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240122160227.00002d83@Huawei.com> <20240123092725.00004382@Huawei.com> <3A26D95F-7366-4354-A010-318A98660076@oracle.com> In-Reply-To: <3A26D95F-7366-4354-A010-318A98660076@oracle.com> From: "Rafael J. Wysocki" Date: Thu, 25 Jan 2024 15:42:34 +0100 Message-ID: Subject: Re: [PATCH RFC v3 03/21] ACPI: processor: Register CPUs that are online, but not described in the DSDT To: Miguel Luis Cc: Jonathan Cameron , "Russell King (Oracle)" , "Rafael J. Wysocki" , "linux-pm@vger.kernel.org" , "loongarch@lists.linux.dev" , "linux-acpi@vger.kernel.org" , "linux-arch@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-riscv@lists.infradead.org" , "kvmarm@lists.linux.dev" , "x86@kernel.org" , "acpica-devel@lists.linuxfoundation.org" , "linux-csky@vger.kernel.org" , "linux-doc@vger.kernel.org" , "linux-ia64@vger.kernel.org" , "linux-parisc@vger.kernel.org" , Salil Mehta , Jean-Philippe Brucker , "jianyong.wu@arm.com" , "justin.he@arm.com" , James Morse , "vishnu@os.amperecomputing.com" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Thu, Jan 25, 2024 at 2:56=E2=80=AFPM Miguel Luis wrote: > > Hi > > > On 23 Jan 2024, at 08:27, Jonathan Cameron wrote: > > > > On Mon, 22 Jan 2024 17:30:05 +0000 > > "Russell King (Oracle)" wrote: > > > >> On Mon, Jan 22, 2024 at 05:22:46PM +0100, Rafael J. Wysocki wrote: > >>> On Mon, Jan 22, 2024 at 5:02=E2=80=AFPM Jonathan Cameron > >>> wrote: > >>>> > >>>> 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: > >>>>>>> > >>>>>>> From: James Morse > >>>>>>> > >>>>>>> ACPI has two descriptions of CPUs, one in the MADT/APIC table, th= e other > >>>>>>> in the DSDT. Both are required. (ACPI 6.5's 8.4 "Declaring Proces= sors" > >>>>>>> says "Each processor in the system must be declared in the ACPI > >>>>>>> namespace"). Having two descriptions allows firmware authors to g= et > >>>>>>> this wrong. > >>>>>>> > >>>>>>> If CPUs are described in the MADT/APIC, they will be brought onli= ne > >>>>>>> early during boot. Once the register_cpu() calls are moved to ACP= I, > >>>>>>> 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 n= ot > >>>>>>> registered. > >>>>>>> > >>>>>>> Add a helper that runs after acpi_init() has completed to registe= r > >>>>>>> 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 ke= rnel > >>>>>>> taint. > >>>>>>> > >>>>>>> Qemu TCG only describes the first CPU in the DSDT, unless cpu-hot= plug > >>>>>>> is configured. > >>>>>> > >>>>>> So why is this a kernel problem? > >>>>> > >>>>> 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 any= way > >>>> but for current QEMU I'm not sure it's true. > >>>> > >>>> Helpfully there are a bunch of ACPI table tests so I've been checkin= g > >>>> 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 > >>>> 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 ve= ry > >>>> helpful. > >>> > >>> Yes, it would. > >>> > >>> Personally, I would prefer to assume that it is not necessary until i= t > >>> turns out that (1) there is firmware with this issue actually in use > >>> and (2) updating the firmware in question to follow the specification > >>> is not practical. > >>> > >>> Otherwise, we'd make it easier to ship non-compliant firmware for no > >>> good reason. > >> > >> If Salil can't come up with a reason, then I'm in favour of dropping > >> the patch like already done for patch 2. If the code change serves no > >> useful purpose, there's no point in making the change. > >> > > > > Salil's out today, but I've messaged him to follow up later in the week= . > > > > It 'might' be the odd cold plug path where QEMU half comes up, then ext= ra > > CPUs are added, then it boots. (used by some orchestration frameworks) > > I don't have a set up for that and I won't get to creating one today an= yway > > (we all love start of the year planning workshops!) > > > > I've +CC'd a few people have run tests on the various iterations of thi= s > > work in the past. Maybe one of them can shed some light on this? > > > > IIUC, this patch covers a scenario for non compliant firmware and in whic= h my > tests for AArch64 using RFC v2 have been unable to trigger its error mess= age so > far. This does not mean, however, this patch should not be taken forward = though. > > It seems benevolent enough detecting non compliant firmware and still pro= ceed > while having whoever uses that firmware to get to know that. There is one issue with this approach, though. If this is done by Linux and Linux is used as a main testing vehicle for whoever produced that firmware, it may pass the tests and be shipped causing a problem for the rest of the industry (because other operating systems will not support that firmware and now they will be put in an awkward position). I've seen enough breakage resulting from a similar policy in some other OS and with Linux on the receiving end that I'd rather avoid doing this to someone else. So if the firmware is not compliant, the best way to go is to ask whoever ships it to please fix their stuff, or if other OSes already work around the non-compliance, it's time to update the spec to reflect the reality (aka "industry practice"). Thanks!