Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1814928rdd; Thu, 11 Jan 2024 10:00:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IGPr6ElYSJnz9s/UR8qin74WnwW+2jX/eSF2EgKKBZy5Tv5+VxGiAHtQtPr8QHSkL+4sYAE X-Received: by 2002:a05:6a00:1d18:b0:6db:10a:6679 with SMTP id a24-20020a056a001d1800b006db010a6679mr110734pfx.51.1704996003540; Thu, 11 Jan 2024 10:00:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704996003; cv=none; d=google.com; s=arc-20160816; b=YxQFv67gbr1JTbojaq1ZQvNTrYWGsP7sq801l+hfQq3ESsmiKnzb+dA3JzdkEmw3yK 6vRpqOnaEDlFUNjU4yYlNu4X+ZQXIsyAuUpnDzSMogYvalHLMkOKa+oFniu7PL6ujATz Kro49Cd8Cw+WdFJdJIiArwDzQiEJmqIz9aZ+fv10UvbVkfTjoQHsI64+4UoRyrWOb15x UpfVyttItBDrcUQWJmqht6DAxBC+cb2c8fQA/lW+cSFjI7+Hcanv5wh4xl+giH+AT2M0 HcQvSKS6uYQUvM8NbGzrcoDacJc/tioRpdJbs8fGNYjf/UFlKnixXij4Qd2Kh+RNxSdx P0zA== ARC-Message-Signature: i=1; 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=966ueSSAHVDO7R57yp4F0UcZKnl+JBcRqx8HXFN54xc=; fh=Bjs3PnFfMvs+BFTyJ9y6tLyJi212q6uorkDK9SVVmsE=; b=HEMKCl0msMR0twoN2ETdznMJ9sNt4+rkTcX91PcvvgV0CzGQqzrsatpEXdlW571abx NpNdveirAOJElTJXd08S1/qC4R2aMs3pjt5Uf3wtmp7MS+oxEmbo/pXPqA8RI7c/fhcf 0HSxd1n26FBI+pVvcFTqDANd9iCkMBQCB9SdDerp3sDSaIIbEHe4MNuqZRH0shr2vHZr AuTfKoBtdeHSQj1sucFyU0UFwiigcRQorHjWvkABLhyMLEduMw6WrnNaCUkSlWTQNhWd breFH/SWeSs9G4EuHisFjOLwhTDiQD9tPgNq6BPu3Wwm6WRn+NWgeSfPHg4/5EAAE8Ua dPBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-23954-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23954-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id x42-20020a056a0018aa00b006d0e1cc26a8si1542952pfh.197.2024.01.11.10.00.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 10:00:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23954-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-23954-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23954-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id CB474B222D3 for ; Thu, 11 Jan 2024 17:59:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6694A53813; Thu, 11 Jan 2024 17:59:17 +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 1F05852F6A; Thu, 11 Jan 2024 17:59:12 +0000 (UTC) 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 4T9snT06zPz6J6XT; Fri, 12 Jan 2024 01:57:17 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 48896140595; Fri, 12 Jan 2024 01:59:10 +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; Thu, 11 Jan 2024 17:59:09 +0000 Date: Thu, 11 Jan 2024 17:59:08 +0000 From: Jonathan Cameron To: "Rafael J. Wysocki" CC: Russell King , , , , , , , , , , , , , , , Salil Mehta , Jean-Philippe Brucker , , , James Morse Subject: Re: [PATCH RFC v3 02/21] ACPI: processor: Add support for processors described as container packages Message-ID: <20240111175908.00002f46@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: lhrpeml100001.china.huawei.com (7.191.160.183) To lhrpeml500005.china.huawei.com (7.191.163.240) On Mon, 18 Dec 2023 21:17:34 +0100 "Rafael J. Wysocki" wrote: > On Wed, Dec 13, 2023 at 1:49=E2=80=AFPM Russell King wrote: > > > > From: James Morse Done some digging + machine faking. This is mid stage results at best. Summary: I don't think this patch is necessary. If anyone happens to be in the mood for testing on various platforms, can you drop this patch and see if everything still works. With this patch in place, and a processor container containing Processor() objects acpi_process_add is called twice - once via the path added here and once via acpi_bus_attach etc. Maybe it's a left over from earlier approaches to some of this? > > > > ACPI has two ways of describing processors in the DSDT. From ACPI v6.5, > > 5.2.12: > > > > "Starting with ACPI Specification 6.3, the use of the Processor() object > > was deprecated. Only legacy systems should continue with this usage. On > > the Itanium architecture only, a _UID is provided for the Processor() > > that is a string object. This usage of _UID is also deprecated since it > > can preclude an OSPM from being able to match a processor to a > > non-enumerable device, such as those defined in the MADT. From ACPI > > Specification 6.3 onward, all processor objects for all architectures > > except Itanium must now use Device() objects with an _HID of ACPI0007, > > and use only integer _UID values." Well, we definitely don't care about Itanium any more so most of this is ir= relevant and can be scrubbed going forwards! Otherwise I think we only care about Device() and Processor() being two thi= ngs that might be seen to describe CPUs and they may or may not be in a Processor container. > > > > Also see https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and= _Control.html#declaring-processors > > > > Duplicate descriptions are not allowed, the ACPI processor driver alrea= dy > > parses the UID from both devices and containers. acpi_processor_get_inf= o() > > returns an error if the UID exists twice in the DSDT. =20 >=20 > I'm not really sure how the above is related to the actual patch. This is nasty. They key is that with this patch in place, we are actually adding them twice if they are are instantiated via Processor() in a process= or container. So this reference is explaining why we don't get two lots regis= tered. This patch should call out explicitly why we want to do it twice (I'm assuming on a temporary baseis). >=20 > > The missing probe for CPUs described as packages =20 >=20 > It is unclear what exactly is meant by "CPUs described as packages". >=20 > From the patch, it looks like those would be Processor() objects > defined under a processor container device. Agreed. >=20 > > creates a problem for > > moving the cpu_register() calls into the acpi_processor driver, as CPUs > > described like this don't get registered, leading to errors from other > > subsystems when they try to add new sysfs entries to the CPU node. > > (e.g. topology_sysfs_init()'s use of topology_add_dev() via cpuhp) > > > > To fix this, parse the processor container and call acpi_processor_add() > > for each processor that is discovered like this. =20 >=20 > Discovered like what? Doesn't add any info. "To fix this, parse the processor container and call acpi_processor_add() f= or each processor found." >=20 > > The processor container > > handler is added with acpi_scan_add_handler(), so no detach call will > > arrive. =20 >=20 > The above requires clarification too. >=20 > > Qemu TCG describes CPUs using processor devices in a processor containe= r. Hmm. This isn't so clear cut. For ARM it does it nicely with ACPI0007 etc. For x86 it is still Processor() under some circumstances... (why exactly doesn't matter here - it's all legacy mess). To poke this I hacked the arm virt qemu platform to use Processor() in a container so I could like for like comparisons. The logic that injects a HID into Processor() objects means the existing handlers get fired without this patch. I'm going to assume that might not be the case later in this patch set, but I've not found where it is broken yet :( > > For more information, see build_cpus_aml() in Qemu hw/acpi/cpu.c and > > https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control.= html#processor-container-device > > > > Signed-off-by: James Morse > > Tested-by: Miguel Luis > > Tested-by: Vishnu Pajjuri > > Tested-by: Jianyong Wu > > --- > > Outstanding comments: > > https://lore.kernel.org/r/20230914145353.000072e2@Huawei.com > > https://lore.kernel.org/r/50571c2f-aa3c-baeb-3add-cd59e0eddc02@redhat.= com > > --- > > drivers/acpi/acpi_processor.c | 22 ++++++++++++++++++++++ > > 1 file changed, 22 insertions(+) > > > > diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processo= r.c > > index 4fe2ef54088c..6a542e0ce396 100644 > > --- a/drivers/acpi/acpi_processor.c > > +++ b/drivers/acpi/acpi_processor.c > > @@ -626,9 +626,31 @@ static struct acpi_scan_handler processor_handler = =3D { > > }, > > }; > > > > +static acpi_status acpi_processor_container_walk(acpi_handle handle, > > + u32 lvl, > > + void *context, > > + void **rv) > > +{ > > + struct acpi_device *adev; > > + acpi_status status; > > + > > + adev =3D acpi_get_acpi_dev(handle); > > + if (!adev) > > + return AE_ERROR; =20 >=20 > Why is the reference counting needed here? >=20 > Wouldn't acpi_fetch_acpi_dev() suffice? You are the expert here :) I can't see why the reference is needed so would be fine with dropping it. >=20 > Also, should the walk really be terminated on the first error? If this patch makes sense things will probably blow up later but no worse than before so sure, keep going. >=20 > > + > > + status =3D acpi_processor_add(adev, &processor_device_ids[0]); > > + acpi_put_acpi_dev(adev); > > + > > + return status; > > +} > > + > > static int acpi_processor_container_attach(struct acpi_device *dev, > > const struct acpi_device_id = *id) > > { > > + acpi_walk_namespace(ACPI_TYPE_PROCESSOR, dev->handle, > > + ACPI_UINT32_MAX, acpi_processor_container_w= alk, > > + NULL, NULL, NULL); =20 >=20 > This covers processor objects only, so why is this not needed for > processor devices defined under a processor container object? Both cases are covered by the existing handling without this. I'm far from clear on why we need this patch. Presumably it's the reference in the description on it breaking for Processor Package containing Processor() objects that matters after a move... I'm struggling to find that move though! >=20 > It is not obvious, so it would be nice to add a comment explaining the > difference. >=20 > > + > > return 1; > > } > > > > -- =20 >=20 > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel