From: Pierre Gondois <pierre.gondois@arm.com>
To: Radu Rendec <rrendec@redhat.com>, Sudeep Holla <sudeep.holla@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
Adrien Thierry <athierry@redhat.com>,
Eric Chanudet <echanude@redhat.com>
Subject: Re: [RFC PATCH] arch_topology: Pre-allocate cacheinfo from primary CPU
Date: Thu, 30 Mar 2023 08:57:24 +0200 [thread overview]
Message-ID: <a7b7b716-bc56-d2b8-4db8-c921f38f5827@arm.com> (raw)
In-Reply-To: <b3d5ee2d28c43e79000036e594b4b17ba44cada2.camel@redhat.com>
On 3/29/23 23:35, Radu Rendec wrote:
> On Wed, 2023-03-29 at 17:39 +0200, Pierre Gondois wrote:
>> On 3/29/23 17:03, Sudeep Holla wrote:
>>> On Wed, Mar 29, 2023 at 04:42:07PM +0200, Pierre Gondois wrote:
>>>>
>>>> This would mean that for all architectures, the cacheinfo would come from
>>>> ACPI/DT first.....
>>>
>>> x86 doesn't fall into the above category. So we need to ensure it continues
>>> to work with no errors.
>>
>> Ok, then maybe having a second arch specific function like
>> init_cache_level() would work.
>>
>> This function would be called in fetch_cache_info() after
>> init_of_cache_level()/acpi_get_cache_info() fail. It would fetch
>> cache info anywhere but in DT/ACPI.
>> Archs that don't want it would not implement it, and it would
>> allow the others to get the num_leaves/levels during early boot.
>
> Hello Pierre,
>
> If I understand correctly, in the case of arm64 this new function would
> use CLIDR_EL1 to detect the number of leaves/levels, right? But since
> init_cpu_topology() calls fetch_cache_info() for each CPU, doesn't this
> mean we would end up doing CLIDR_EL1 based detection for the secondary
> CPUs by running the (arch specific) detection code on the primary CPU?
Yes indeed, this would rely on the assumption made in the RFC that
the platform is symmetrical (i.e. all CPUs have the same number/level
of caches).
>
> My intimate knowledge of arm64 is very limited, but I *assumed* one of
> the reasons why detect_cache_attributes() (and init_cache_level()) run
> on the secondary CPU today is because not all CPUs are necessarily
> identical. Another possible reason I can think of is because maybe on
> some architectures auto-detection isn't possible altogether before the
> secondary CPU is brought up.
Yes I think you are right.
>
> In particular, for arm64 is it possible that CLIDR_EL1 may not look the
> same depending on the CPU that reads it? What about SoC's with
> asymmetrical CPU cores? (no concrete example here, just assuming this
> is a real/possible thing)
This would indeed be an issue if all the CPUs don't have the same number/level
of caches. In case there is no DT/ACPI, it should be possible to:
- from the primary CPU using CLIDR_EL1, allocate the cacheinfo (making the
assumption the platform is symmetrical)
- from the secondary CPUs, if we know a pre-allocation has been made,
run init_cache_level() and check the pre-allocation was correct.
If not, re-allocate the cacheinfo (and trigger a warning).
I think this is more or less what was done in the RFC, the only difference
being there is no call from smp_prepare_cpus(), or did I miss something ?
Regards,
Pierre
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-03-30 6:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-23 22:42 [RFC PATCH] arch_topology: Pre-allocate cacheinfo from primary CPU Radu Rendec
2023-03-27 12:02 ` Pierre Gondois
2023-03-27 14:23 ` Radu Rendec
2023-03-29 14:42 ` Pierre Gondois
2023-03-29 15:03 ` Sudeep Holla
2023-03-29 15:39 ` Pierre Gondois
2023-03-29 21:35 ` Radu Rendec
2023-03-30 6:57 ` Pierre Gondois [this message]
2023-03-30 23:32 ` Radu Rendec
2023-03-31 14:49 ` Pierre Gondois
2023-04-03 21:25 ` Radu Rendec
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=a7b7b716-bc56-d2b8-4db8-c921f38f5827@arm.com \
--to=pierre.gondois@arm.com \
--cc=athierry@redhat.com \
--cc=echanude@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=rrendec@redhat.com \
--cc=sudeep.holla@arm.com \
/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