Linux driver-core infrastructure
 help / color / mirror / Atom feed
* [PATCH v2] cacheinfo: don't propagate DT/ACPI error when arch supplies info (arm64)
@ 2026-06-11 11:55 Breno Leitao
  2026-06-12 12:48 ` Sudeep Holla
  0 siblings, 1 reply; 3+ messages in thread
From: Breno Leitao @ 2026-06-11 11:55 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Sudeep Holla, Pierre Gondois
  Cc: driver-core, linux-kernel, kernel-team, Breno Leitao

cache_setup_properties() sets use_arch_info = true when DT/ACPI
provide no cache nodes and the arch can derive the topology from
CPU registers (e.g. arm64 reading CLIDR_EL1), but still returns the
original -ENOENT. cache_shared_cpu_map_setup() bails on that error
before the new flag can take effect, so the first CPU brought online
always trips a misleading warning:

  cacheinfo: Unable to detect cache hierarchy for CPU 0

Subsequent CPUs skip cache_setup_properties() entirely because
use_arch_info is now true, which is why only CPU0 hits it. This is
reproducible on arm64 with the QEMU 'virt' machine, whose default DT
has no cache nodes.

Clear ret after setting use_arch_info so the caller proceeds and
populates the shared cpu map via the arch-supplied leaves.

Fixes: ef9f643a9f8b ("cacheinfo: Add use_arch[|_cache]_info field/function")
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Signed-off-by: Breno Leitao <leitao@debian.org>
---
Cc; hruben@meta.com
---
Changes in v2:
- EDITME: describe what is new in this series revision.
- EDITME: use bulletpoints and terse descriptions.
- Link to v1: https://lore.kernel.org/r/20260609-cacheinfo-v1-1-35864c9a8f0c@debian.org
---
 drivers/base/cacheinfo.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c
index 70701d3bc81c6..9f9c72727a059 100644
--- a/drivers/base/cacheinfo.c
+++ b/drivers/base/cacheinfo.c
@@ -401,9 +401,14 @@ static int cache_setup_properties(unsigned int cpu)
 	else if (!acpi_disabled)
 		ret = cache_setup_acpi(cpu);
 
-	// Assume there is no cache information available in DT/ACPI from now.
-	if (ret && use_arch_cache_info())
+	/*
+	 * No DT/ACPI cache nodes; fall back to arch-derived topology (e.g.
+	 * arm64 CLIDR_EL1) and clear the error to avoid a spurious warning.
+	 */
+	if (ret && use_arch_cache_info()) {
 		use_arch_info = true;
+		ret = 0;
+	}
 
 	return ret;
 }

---
base-commit: a87737435cfa134f9cdcc696ba3080759d04cf72
change-id: 20260609-cacheinfo-b2a8d27a19ce

Best regards,
-- 
Breno Leitao <leitao@debian.org>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] cacheinfo: don't propagate DT/ACPI error when arch supplies info (arm64)
  2026-06-11 11:55 [PATCH v2] cacheinfo: don't propagate DT/ACPI error when arch supplies info (arm64) Breno Leitao
@ 2026-06-12 12:48 ` Sudeep Holla
  2026-06-12 14:14   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Sudeep Holla @ 2026-06-12 12:48 UTC (permalink / raw)
  To: Breno Leitao
  Cc: Greg Kroah-Hartman, Sudeep Holla, Rafael J. Wysocki,
	Danilo Krummrich, Pierre Gondois, driver-core, linux-kernel,
	kernel-team

On Thu, Jun 11, 2026 at 04:55:13AM -0700, Breno Leitao wrote:
> cache_setup_properties() sets use_arch_info = true when DT/ACPI
> provide no cache nodes and the arch can derive the topology from
> CPU registers (e.g. arm64 reading CLIDR_EL1), but still returns the
> original -ENOENT. cache_shared_cpu_map_setup() bails on that error
> before the new flag can take effect, so the first CPU brought online
> always trips a misleading warning:
> 
>   cacheinfo: Unable to detect cache hierarchy for CPU 0
> 
> Subsequent CPUs skip cache_setup_properties() entirely because
> use_arch_info is now true, which is why only CPU0 hits it. This is
> reproducible on arm64 with the QEMU 'virt' machine, whose default DT
> has no cache nodes.
> 
> Clear ret after setting use_arch_info so the caller proceeds and
> populates the shared cpu map via the arch-supplied leaves.
> 

LGTM,

Reviewed-by: Sudeep Holla <sudeep.holla@kernel.org>

Greg,

Can you pick up this one as part of your next round of fixes if any or
for v7.2 ?

> Fixes: ef9f643a9f8b ("cacheinfo: Add use_arch[|_cache]_info field/function")
> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
> Cc; hruben@meta.com
> ---
> Changes in v2:
> - EDITME: describe what is new in this series revision.
> - EDITME: use bulletpoints and terse descriptions.

Ideally, good to update this or atleast drop these 😄.

-- 
Regards,
Sudeep

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] cacheinfo: don't propagate DT/ACPI error when arch supplies info (arm64)
  2026-06-12 12:48 ` Sudeep Holla
@ 2026-06-12 14:14   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2026-06-12 14:14 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: Breno Leitao, Rafael J. Wysocki, Danilo Krummrich, Pierre Gondois,
	driver-core, linux-kernel, kernel-team

On Fri, Jun 12, 2026 at 01:48:36PM +0100, Sudeep Holla wrote:
> On Thu, Jun 11, 2026 at 04:55:13AM -0700, Breno Leitao wrote:
> > cache_setup_properties() sets use_arch_info = true when DT/ACPI
> > provide no cache nodes and the arch can derive the topology from
> > CPU registers (e.g. arm64 reading CLIDR_EL1), but still returns the
> > original -ENOENT. cache_shared_cpu_map_setup() bails on that error
> > before the new flag can take effect, so the first CPU brought online
> > always trips a misleading warning:
> > 
> >   cacheinfo: Unable to detect cache hierarchy for CPU 0
> > 
> > Subsequent CPUs skip cache_setup_properties() entirely because
> > use_arch_info is now true, which is why only CPU0 hits it. This is
> > reproducible on arm64 with the QEMU 'virt' machine, whose default DT
> > has no cache nodes.
> > 
> > Clear ret after setting use_arch_info so the caller proceeds and
> > populates the shared cpu map via the arch-supplied leaves.
> > 
> 
> LGTM,
> 
> Reviewed-by: Sudeep Holla <sudeep.holla@kernel.org>
> 
> Greg,
> 
> Can you pick up this one as part of your next round of fixes if any or
> for v7.2 ?

I'll get to it after 7.2-rc1 is out, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-12 14:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-11 11:55 [PATCH v2] cacheinfo: don't propagate DT/ACPI error when arch supplies info (arm64) Breno Leitao
2026-06-12 12:48 ` Sudeep Holla
2026-06-12 14:14   ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox