mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jinjie Ruan <ruanjinjie@huawei.com>
To: Ben Horgan <ben.horgan@arm.com>, <james.morse@arm.com>,
	<reinette.chatre@intel.com>, <fenghuay@nvidia.com>,
	<zengheng4@huawei.com>, <gshan@redhat.com>, <jic23@kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] arm_mpam: Round the CDP RMID count down to whole CLOSIDs
Date: Thu, 5 Nov 2026 15:16:17 +0800	[thread overview]
Message-ID: <b2d59ec8-31f3-4454-9127-0cea58d27716@huawei.com> (raw)
In-Reply-To: <45efa783-21b4-4f67-a0fd-c6772d5cb038@arm.com>



在 2026/11/4 22:21, Ben Horgan 写道:
> Hi Jinjie,

Hi Ben,

> 
> For patches touching the glue between MPAM and resctrl, essentially mpam_resctrl.c, the prefix used
> is 'arm_mpam: resctrl' rather than just 'arm_mpam'.

The following will be done in this format.

> 
> On 04/11/2026 10:16, Jinjie Ruan wrote:
>> resctrl_arch_set_cdp_enabled() halves the whole RMID index space, while
>> the resctrl core halves the CLOSID count: schemata_list_add() divides a
>> CDP resource's schema by two, and closid_init() takes the smallest
>> across the schemata.
>>
>> When the PMG count and the CLOSID count are both odd, halving the
>> product counts RMIDs that belong to a CLOSID resctrl never allocates.
>> With 3 PMGs and 5 CLOSIDs MPAM reports 7 RMIDs, but the 2 CLOSIDs that
>> resctrl has times 3 PMGs only allow 6. The count is visible in
>> /sys/fs/resctrl/info/L3_MON/num_rmids, so userspace reads a value that
>> includes RMIDs no CLOSID can use; 
> 
> Good spot.
> 
> It occurs to me that 'num_rmids' is also too high on a monitor only system too as there is only one
> PARTID that can be used.  Can you see a clean way to fix this in one go?

I will have a try to fix both problems in a clean way, thank you very much.

> 
> Thanks,
> 
> Ben
> 
> RMID allocation itself is bounded by
>> the free list.
>>
>> Derive the number of RMID groups from the index space and halve that, so
>> the count follows resctrl_arch_system_num_rmid_idx().
>>
>> Fixes: 264c285999fc ("arm_mpam: resctrl: Add monitor initialisation and domain boilerplate")
>> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
>> Cc: <stable@vger.kernel.org> # 7.1.x
>> Cc: James Morse <james.morse@arm.com>
>> Cc: Ben Horgan <ben.horgan@arm.com>
>> Cc: Reinette Chatre <reinette.chatre@intel.com>
>> Cc: Fenghua Yu <fenghuay@nvidia.com>
>> ---
>>  drivers/resctrl/mpam_resctrl.c | 12 +++++++++---
>>  1 file changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
>> index 5468367776e2..d3f957162b68 100644
>> --- a/drivers/resctrl/mpam_resctrl.c
>> +++ b/drivers/resctrl/mpam_resctrl.c
>> @@ -217,10 +217,16 @@ int resctrl_arch_set_cdp_enabled(enum resctrl_res_level rid, bool enable)
>>  	cdp_enabled = enable;
>>  	mpam_resctrl_controls[rid].cdp_enabled = enable;
>>  
>> -	if (enable)
>> -		l3->mon.num_rmid = resctrl_arch_system_num_rmid_idx() / 2;
>> -	else
>> +	if (enable) {
>> +		u32 num_group;
>> +
>> +		/* Halve the number of RMID groups, keeping whole PMG rows. */
>> +		num_group = resctrl_arch_system_num_rmid_idx() /
>> +			    (mpam_pmg_max + 1);
>> +		l3->mon.num_rmid = (mpam_pmg_max + 1) * (num_group / 2);
>> +	} else {
>>  		l3->mon.num_rmid = resctrl_arch_system_num_rmid_idx();
>> +	}
>>  
>>  	/* The mbw_max feature can't hide cdp as it's a per-partid maximum. */
>>  	if (cdp_enabled && !mpam_resctrl_controls[RDT_RESOURCE_MBA].cdp_enabled)
> 

-- 
Best regards,
Jinjie


      reply	other threads:[~2026-11-05  7:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 10:16 Jinjie Ruan
2026-11-04 14:21 ` Ben Horgan
2026-11-05  7:16   ` Jinjie Ruan [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=b2d59ec8-31f3-4454-9127-0cea58d27716@huawei.com \
    --to=ruanjinjie@huawei.com \
    --cc=ben.horgan@arm.com \
    --cc=fenghuay@nvidia.com \
    --cc=gshan@redhat.com \
    --cc=james.morse@arm.com \
    --cc=jic23@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reinette.chatre@intel.com \
    --cc=zengheng4@huawei.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®