[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <adcc278e-6be6-4658-821a-eb8995d65512@arm.com>
Date: Thu, 8 Jan 2026 10:52:00 +0000
From: Ben Horgan <ben.horgan@....com>
To: "Shaopeng Tan (Fujitsu)" <tan.shaopeng@...itsu.com>
Cc: "amitsinght@...vell.com" <amitsinght@...vell.com>,
"baisheng.gao@...soc.com" <baisheng.gao@...soc.com>,
"baolin.wang@...ux.alibaba.com" <baolin.wang@...ux.alibaba.com>,
"carl@...amperecomputing.com" <carl@...amperecomputing.com>,
"dave.martin@....com" <dave.martin@....com>,
"david@...nel.org" <david@...nel.org>,
"dfustini@...libre.com" <dfustini@...libre.com>,
"fenghuay@...dia.com" <fenghuay@...dia.com>,
"gshan@...hat.com" <gshan@...hat.com>,
"james.morse@....com" <james.morse@....com>,
"jonathan.cameron@...wei.com" <jonathan.cameron@...wei.com>,
"kobak@...dia.com" <kobak@...dia.com>,
"lcherian@...vell.com" <lcherian@...vell.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"peternewman@...gle.com" <peternewman@...gle.com>,
"punit.agrawal@....qualcomm.com" <punit.agrawal@....qualcomm.com>,
"quic_jiles@...cinc.com" <quic_jiles@...cinc.com>,
"reinette.chatre@...el.com" <reinette.chatre@...el.com>,
"rohit.mathew@....com" <rohit.mathew@....com>,
"scott@...amperecomputing.com" <scott@...amperecomputing.com>,
"sdonthineni@...dia.com" <sdonthineni@...dia.com>,
"xhao@...ux.alibaba.com" <xhao@...ux.alibaba.com>,
"catalin.marinas@....com" <catalin.marinas@....com>,
"will@...nel.org" <will@...nel.org>, "corbet@....net" <corbet@....net>,
"maz@...nel.org" <maz@...nel.org>, "oupton@...nel.org" <oupton@...nel.org>,
"joey.gouly@....com" <joey.gouly@....com>,
"suzuki.poulose@....com" <suzuki.poulose@....com>,
"kvmarm@...ts.linux.dev" <kvmarm@...ts.linux.dev>
Subject: Re: [PATCH v2 27/45] arm_mpam: resctrl: Add support for csu counters
Hi Shaopeng,
On 1/8/26 10:44, Shaopeng Tan (Fujitsu) wrote:
> Hello Ben,
>
>> From: James Morse <james.morse@....com>
>>
>> resctrl exposes a counter via a file named llc_occupancy. This isn't really
>> a counter as its value goes up and down, this is a snapshot of the cache
>> storage usage monitor.
>>
>> Add some picking code to find a cache as close as possible to the L3 that
>> supports the CSU monitor.
>>
>> If there is an L3, but it doesn't have any controls, force the L3 resource
>> to exist. The existing topology_matches_l3() and
>> mpam_resctrl_domain_hdr_init() code will ensure this looks like the L3,
>> even if the class belongs to a later cache.
>>
>> Signed-off-by: James Morse <james.morse@....com>
>> Signed-off-by: Ben Horgan <ben.horgan@....com>
>> ---
>> Changes since rfc:
>> Allow csu counters however many partid or pmg there are
>> else if -> if
>> reduce scope of local variables
>> drop has_csu
>> ---
>> drivers/resctrl/mpam_internal.h | 6 ++
>> drivers/resctrl/mpam_resctrl.c | 148 ++++++++++++++++++++++++++++++++
>> 2 files changed, 154 insertions(+)
[...]
>> diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
>> index f8d8c241797a..5fde610cc9d7 100644
>> --- a/drivers/resctrl/mpam_resctrl.c
>> +++ b/drivers/resctrl/mpam_resctrl.c
[...]
>>
>> +static void mpam_resctrl_monitor_init(struct mpam_resctrl_mon *mon,
>> + enum resctrl_event_id type)
>> +{
>> + struct mpam_resctrl_res *res = &mpam_resctrl_controls[RDT_RESOURCE_L3];
>> + struct rdt_resource *l3 = &res->resctrl_res;
>> +
>> + lockdep_assert_cpus_held();
>> +
>> + /* There also needs to be an L3 cache present */
>> + if (get_cpu_cacheinfo_id(smp_processor_id(), 3) == -1)
>> + return;
>> +
>> + /*
>> + * If there are no MPAM resources on L3, force it into existence.
>> + * topology_matches_l3() already ensures this looks like the L3.
>> + * The domain-ids will be fixed up by mpam_resctrl_domain_hdr_init().
>> + */
>> + if (!res->class) {
>> + pr_warn_once("Faking L3 MSC to enable counters.\n");
>> + res->class = mpam_resctrl_counters[type].class;
>> + }
>> +
>> + /* Called multiple times!, once per event type */
>> + if (exposed_mon_capable) {
>> + l3->mon_capable = true;
>> +
>> + /* Setting name is necessary on monitor only platforms */
>> + l3->name = "L3";
>> + l3->mon_scope = RESCTRL_L3_CACHE;
>> +
>> + resctrl_enable_mon_event(type);
>> +
>> + /*
>> + * Unfortunately, num_rmid doesn't mean anything for
>> + * mpam, and its exposed to user-space!
>> + * num-rmid is supposed to mean the number of groups
>> + * that can be created, both control or monitor groups.
>> + * For mpam, each control group has its own pmg/rmid
>> + * space.
>> + */
>> + l3->mon.num_rmid = 1;
>> + }
>> +}
>
> Dave posted the following patch, Will you apply it?
> https://lore.kernel.org/lkml/20250820131621.54983-1-Dave.Martin@arm.com/
Thanks for the reminder. I'll squash that into this patch.
>
> Best regards,
> Shaopeng TAN
>
>
Thanks,
Ben
Powered by blists - more mailing lists