mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pierre Gondois <pierre.gondois@arm.com>
To: Breno Leitao <leitao@debian.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	Sudeep Holla <sudeep.holla@kernel.org>
Cc: driver-core@lists.linux.dev, linux-kernel@vger.kernel.org,
	kernel-team@meta.com
Subject: Re: [PATCH] cacheinfo: don't propagate DT/ACPI error when arch supplies info (arm64)
Date: Thu, 11 Jun 2026 12:30:24 +0200	[thread overview]
Message-ID: <437997dc-7ad1-43dd-9626-6cad37c5258d@arm.com> (raw)
In-Reply-To: <20260609-cacheinfo-v1-1-35864c9a8f0c@debian.org>

On 6/9/26 18:23, 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.
>
> Fixes: ef9f643a9f8b ("cacheinfo: Add use_arch[|_cache]_info field/function")
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
> Cc; hruben@meta.com
> ---
>   drivers/base/cacheinfo.c | 13 +++++++++++--
>   1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c
> index 70701d3bc81c..4e11d36f127e 100644
> --- a/drivers/base/cacheinfo.c
> +++ b/drivers/base/cacheinfo.c
> @@ -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.
> +	 */

NIT: Maybe the comment is a bit long/verbose,
but maybe also not worth a v2

Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>

> +	if (ret && use_arch_cache_info()) {
>   		use_arch_info = true;
> +		ret = 0;
> +	}
>   
>   	return ret;
>   }
>
> ---
> base-commit: a87737435cfa134f9cdcc696ba3080759d04cf72
> change-id: 20260609-cacheinfo-b2a8d27a19ce
>
> Best regards,

  reply	other threads:[~2026-06-11 10:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09 16:23 Breno Leitao
2026-06-11 10:30 ` Pierre Gondois [this message]
2026-06-11 11:05   ` Breno Leitao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=437997dc-7ad1-43dd-9626-6cad37c5258d@arm.com \
    --to=pierre.gondois@arm.com \
    --cc=dakr@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-team@meta.com \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=sudeep.holla@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®