[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251024151519.000058a8@huawei.com>
Date: Fri, 24 Oct 2025 15:15:19 +0100
From: Jonathan Cameron <jonathan.cameron@...wei.com>
To: James Morse <james.morse@....com>
CC: <linux-kernel@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
<linux-acpi@...r.kernel.org>, D Scott Phillips OS
<scott@...amperecomputing.com>, <carl@...amperecomputing.com>,
<lcherian@...vell.com>, <bobo.shaobowang@...wei.com>,
<tan.shaopeng@...itsu.com>, <baolin.wang@...ux.alibaba.com>, Jamie Iles
<quic_jiles@...cinc.com>, Xin Hao <xhao@...ux.alibaba.com>,
<peternewman@...gle.com>, <dfustini@...libre.com>, <amitsinght@...vell.com>,
David Hildenbrand <david@...hat.com>, Dave Martin <dave.martin@....com>, Koba
Ko <kobak@...dia.com>, Shanker Donthineni <sdonthineni@...dia.com>,
<fenghuay@...dia.com>, <baisheng.gao@...soc.com>, Rob Herring
<robh@...nel.org>, Rohit Mathew <rohit.mathew@....com>, "Rafael Wysocki"
<rafael@...nel.org>, Len Brown <lenb@...nel.org>, Lorenzo Pieralisi
<lpieralisi@...nel.org>, Hanjun Guo <guohanjun@...wei.com>, Sudeep Holla
<sudeep.holla@....com>, Catalin Marinas <catalin.marinas@....com>, "Will
Deacon" <will@...nel.org>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Danilo Krummrich <dakr@...nel.org>, Jeremy Linton <jeremy.linton@....com>,
Gavin Shan <gshan@...hat.com>
Subject: Re: [PATCH v3 03/29] ACPI / PPTT: Find cache level by cache-id
On Fri, 17 Oct 2025 18:56:19 +0000
James Morse <james.morse@....com> wrote:
> The MPAM table identifies caches by id. The MPAM driver also wants to know
> the cache level to determine if the platform is of the shape that can be
> managed via resctrl. Cacheinfo has this information, but only for CPUs that
> are online.
>
> Waiting for all CPUs to come online is a problem for platforms where
> CPUs are brought online late by user-space.
>
> Add a helper that walks every possible cache, until it finds the one
> identified by cache-id, then return the level.
>
> Signed-off-by: James Morse <james.morse@....com>
> Reviewed-by: Fenghua Yu <fenghuay@...dia.com>
> Reviewed-by: Gavin Shan <gshan@...hat.com>
> Tested-by: Fenghua Yu <fenghuay@...dia.com>
> ---
> Changes sinec v2:
> * Search all caches, not just unified caches. This removes the need to count
> the caches first, but means a failure to find the table walks the table
> three times for different cache types.
Fwiw that sentence doesn't make sense to me. Too many tables.
> * Fixed return value of the no-acpi stub.
> * Punctuation typo in a comment,
> * Keep trying to parse the table even if a bogus CPU is encountered.
> * Specified CPUs share caches with other CPUs.
Trivial comment only from me. Ben's question on matching an ID against an
l1 instruction cache needs addressing (or ruling out as a 'won't fix')
though before an RB is appropriate.
> /**
> * update_cache_properties() - Update cacheinfo for the given processor
> * @this_leaf: Kernel cache info structure being updated
> @@ -903,3 +924,64 @@ void acpi_pptt_get_cpus_from_container(u32 acpi_cpu_id, cpumask_t *cpus)
> entry->length);
> }
> }
> +
> +/*
Smells like kernel doc. Why not /** ?
Then can at least verify formatting etc.
> + * find_acpi_cache_level_from_id() - Get the level of the specified cache
> + * @cache_id: The id field of the cache
> + *
> + * Determine the level relative to any CPU for the cache identified by
> + * cache_id. This allows the property to be found even if the CPUs are offline.
> + *
> + * The returned level can be used to group caches that are peers.
> + *
> + * The PPTT table must be rev 3 or later.
> + *
> + * If one CPU's L2 is shared with another CPU as L3, this function will return
> + * an unpredictable value.
> + *
> + * Return: -ENOENT if the PPTT doesn't exist, the revision isn't supported or
> + * the cache cannot be found.
> + * Otherwise returns a value which represents the level of the specified cache.
> + */
Powered by blists - more mailing lists