From: Shrikanth Hegde <sshegde@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
driver-core@lists.linux.dev
Cc: christophe.leroy@csgroup.eu, maddy@linux.ibm.com,
gregkh@linuxfoundation.org, rafael@kernel.org, dakr@kernel.org,
johan@kernel.org, sudeep.holla@kernel.org, ritesh.list@gmail.com,
tim.c.chen@linux.intel.com, yu.c.chen@intel.com
Subject: Re: [PATCH 0/5] cacheinfo, powerpc: Move powerpc to generic cacheinfo
Date: Wed, 25 Nov 2026 14:39:33 +0530 [thread overview]
Message-ID: <35d3d17a-15ef-4204-a038-a9018e561535@linux.ibm.com> (raw)
In-Reply-To: <a2bd3564-0990-47ab-b922-6793dd1de144@linux.ibm.com>
>>
>> If this approach does not work, then I am afraid we might have to fallback to
>> arch_llc_bytes.
>
> Well, though it worked for normal boot and hotplug, LPM is broken and DLPAR is likely
> a problem too if the logical CPUid is reused with different device tree node.
>
> So I am afraid it is not straightforward to port.
>
> The current PowerPC implementation owns references to the device-tree cache nodes
> and destroys and rebuilds its cache objects during LPM. It also releases cache
> objects as CPUs are removed during DLPAR.
>
> Generic cacheinfo has a different lifetime model. Its per-CPU info_list is retained
> across CPU offline, and the leaves continue to contain fw_token pointers to the
> device-tree cache nodes. Replacing or freeing those leaves safely is not straightforward
> because scheduler and page allocator users can access them concurrently. Handling this properly
> would need a broader lifetime and synchronization mechanism in generic cacheinfo.
>
> Doing all that heavy lifting for the case of LPM/DLPAR is likely going to be overkill.
> That may still be worth doing independently, but it is substantially more involved than
> what is needed here.
>
> So I am planning to resort to something like below. Introduce a new arch
> specific hook (cacheinfo_get_arch_llc_info) to get the cache size and
> cpus of that cache.
>
> Hopefully should be able to send it out soon. Now would be the good to wake me up if
> there is a better way!!
>
After auditing the code again, the scope appears narrower.
The scheduler and page allocator consume cacheinfo only while refreshing
cached state during topology updates. their runtime paths use sd->llc_bytes and
PCP flags rather than retaining cacheinfo pointers.
The other runtime users relevant to this conversion participate in
CPU hotplug read-side locking, while early scheduler-domain construction cannot
overlap LPM or DLPAR.
So, let me give this approach another try to see if it holds good for LPM.
>
> @@ -XXX,15 +XXX,23 @@ static unsigned long get_effective_llc_bytes(int cpu,
> struct sched_domain *sd)
> {
> struct cacheinfo *llc;
> + unsigned long size;
> unsigned int hw_weight;
>
> llc = get_cpu_cacheinfo_llc(cpu);
> - if (!llc)
> - return 0;
> + if (llc) {
> + size = llc->size;
> + hw_weight = cpumask_weight(&llc->shared_cpu_map);
> + } else if (cacheinfo_get_arch_llc_info(cpu, &size, &hw_weight)) {
> + return 0;
> + }
>
> - hw_weight = cpumask_weight(&llc->shared_cpu_map);
> - if (!hw_weight)
> + if (!size || !hw_weight)
> return 0;
>
> - return llc->size * sd->span_weight / hw_weight;
> + return size * sd->span_weight / hw_weight;
>
prev parent reply other threads:[~2026-11-25 9:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 16:36 Shrikanth Hegde
2026-11-18 16:36 ` [PATCH 1/5] cacheinfo: Allow architectures to provide custom cache IDs Shrikanth Hegde
2026-11-19 6:36 ` Srikar Dronamraju
2026-11-19 9:21 ` Shrikanth Hegde
2026-11-18 16:36 ` [PATCH 2/5] cacheinfo: Support unified caches described by d-cache properties Shrikanth Hegde
2026-11-19 6:44 ` Srikar Dronamraju
2026-11-19 9:22 ` Shrikanth Hegde
2026-11-18 16:36 ` [PATCH 3/5] cacheinfo: Add teardown and rebuild helpers Shrikanth Hegde
2026-11-18 16:36 ` [PATCH 4/5] powerpc/cacheinfo: Move to generic cacheinfo Shrikanth Hegde
2026-11-19 8:24 ` Srikar Dronamraju
2026-11-19 9:25 ` Shrikanth Hegde
2026-11-18 16:36 ` [PATCH 5/5] sched/topology: Remove stale comment around llc_bytes on powerpc Shrikanth Hegde
2026-11-19 9:30 ` [PATCH 0/5] cacheinfo, powerpc: Move powerpc to generic cacheinfo Shrikanth Hegde
2026-11-24 9:35 ` Shrikanth Hegde
2026-11-25 9:09 ` Shrikanth Hegde [this message]
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=35d3d17a-15ef-4204-a038-a9018e561535@linux.ibm.com \
--to=sshegde@linux.ibm.com \
--cc=christophe.leroy@csgroup.eu \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=rafael@kernel.org \
--cc=ritesh.list@gmail.com \
--cc=sudeep.holla@kernel.org \
--cc=tim.c.chen@linux.intel.com \
--cc=yu.c.chen@intel.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
all inboxes | Powered by JetHome®