Skip to contentSkip to conversation

cacheinfo: don't propagate DT/ACPI error when arch supplies info (arm64)

PATCH In review Breno Leitao 3 participants 4 messages Jun 11 – Jul 15 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cacheinfo: don't propagate DT/ACPI error when arch supplies info (arm64)

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")

---
Cc; [email protected]
---
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/[email protected]

---
 drivers/base/cacheinfo.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/base/cacheinfo.c +7 -2
index 70701d3bc81c6..9f9c72727a059 100644
@@ -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,

Signature · 1 line
Breno Leitao <[email protected]>
Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · 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

Quoted 8 lines

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,

Greg,

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

Quoted 9 lines
Fixes ef9f643a9f8b ("cacheinfo: Add use_arch[|_cache]_info field/function")

---
Cc; [email protected]
---
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 😄.

Signature · 2 lines
Regards,
Sudeep
#2 lore raw
Quoted 19 lines · Sudeep Holla
Quoted 9 lines · 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

Quoted 8 lines

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.

Quoted 8 lines

LGTM,

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

#3 lore raw

Greg,

Quoted 7 lines · Greg Kroah-Hartman
Quoted 4 lines · Sudeep Holla

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.

Is this a good time to pick this one?

Thanks,
--breno