cacheinfo: don't propagate DT/ACPI error when arch supplies info (arm64)
PATCH 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.
---
Cc; [email protected]
--- drivers/base/cacheinfo.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/base/cacheinfo.c +11 -2
@@ -401,9 +401,18 @@ 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 ()) +/* +* If DT/ACPI lacks cache nodes but the arch can derive the topology +* from CPU registers (e.g. arm64 reading CLIDR_EL1), fall back to +* that path instead of propagating the error. Otherwise the very +* first CPU processed trips a misleading "Unable to detect cache +* hierarchy" warning, because use_arch_info is only set after the +* first failure. +*/ +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]>
Quoted 33 lines · Breno Leitao
cache_setup_properties()setsuse_arch_info= true when DT/ACPI provide no cache nodes and the arch can derive the topology from CPU registers (e.g. arm64 readingCLIDR_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 becauseuse_arch_infois 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_infoso the caller proceeds and populates the shared cpu map via the arch-supplied leaves.Fixes ef9f643a9f8b ("cacheinfo: Add use_arch[|_cache]_info field/function")Signed-off-by Breno Leitao <[email protected]>---
Cc; [email protected]--- drivers/base/cacheinfo.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)drivers/base/cacheinfo.c +0
-0@@ -401,9 +401,18 @@ static int cache_setup_properties(unsigned int cpu)else if (!acpi_disabled) ret =cache_setup_acpi (cpu);
drivers/base/cacheinfo.c static int cache_setup_properties(unsigned int cpu) · line 411
Quoted 10 lines
drivers/base/cacheinfo.c +8
-2-// Assume there is no cache information available in DT/ACPI from now. -if (ret &&use_arch_cache_info ()) +/* +* If DT/ACPI lacks cache nodes but the arch can derive the topology +* from CPU registers (e.g. arm64 reading CLIDR_EL1), fall back to +* that path instead of propagating the error. Otherwise the very +* first CPU processed trips a misleading "Unable to detect cache +* hierarchy" warning, because use_arch_info is only set after the +* first failure. +*/
NIT: Maybe the comment is a bit long/verbose,
but maybe also not worth a v2
Quoted 13 lines
drivers/base/cacheinfo.c +3
-1+if (ret &&use_arch_cache_info ()) { use_arch_info = true; + ret =0 ; + }return ret; } ---base-commit:
a87737435cfa134f9cdcc696ba3080759d04cf72
change-id: 20260609-cacheinfo-b2a8d27a19ceBest regards,
Hello Pierre,
Quoted 47 lines · Pierre Gondois
Quoted 32 lines · Breno Leitao
cache_setup_properties()setsuse_arch_info= true when DT/ACPI provide no cache nodes and the arch can derive the topology from CPU registers (e.g. arm64 readingCLIDR_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 becauseuse_arch_infois 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_infoso the caller proceeds and populates the shared cpu map via the arch-supplied leaves.Fixes ef9f643a9f8b ("cacheinfo: Add use_arch[|_cache]_info field/function")Signed-off-by Breno Leitao <[email protected]>---
Cc; [email protected]--- drivers/base/cacheinfo.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)drivers/base/cacheinfo.c +0
-0@@ -401,9 +401,18 @@ static int cache_setup_properties(unsigned int cpu)else if (!acpi_disabled) ret =cache_setup_acpi (cpu);drivers/base/cacheinfo.c static int cache_setup_properties(unsigned int cpu) · line 410
Quoted 10 lines
drivers/base/cacheinfo.c +8
-2-// Assume there is no cache information available in DT/ACPI from now. -if (ret &&use_arch_cache_info ()) +/* +* If DT/ACPI lacks cache nodes but the arch can derive the topology +* from CPU registers (e.g. arm64 reading CLIDR_EL1), fall back to +* that path instead of propagating the error. Otherwise the very +* first CPU processed trips a misleading "Unable to detect cache +* hierarchy" warning, because use_arch_info is only set after the +* first failure. +*/ NIT: Maybe the comment is a bit long/verbose,
but maybe also not worth a v2
Quoted 1 line
Reviewed-by Pierre Gondois <[email protected]>
Thanks for the review, let me shirnk the comment above and send a v2. It will be painless.
--breno