mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gavin Shan <gshan@redhat.com>
To: Jinjie Ruan <ruanjinjie@huawei.com>,
	james.morse@arm.com, ben.horgan@arm.com,
	reinette.chatre@intel.com, fenghuay@nvidia.com,
	zengheng4@huawei.com, tan.shaopeng@jp.fujitsu.com,
	jic23@kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 3/3] arm_mpam: resctrl: Limit num_rmids to the CLOSIDs in use
Date: Fri, 13 Nov 2026 09:46:32 +1000	[thread overview]
Message-ID: <da4c6658-a4a0-43ae-92da-14d8463dfc08@redhat.com> (raw)
In-Reply-To: <20261111081316.3828283-4-ruanjinjie@huawei.com>

On 11/11/26 6:13 PM, Jinjie Ruan wrote:
> On MPAM an RMID is a PMG within a PARTID, so resctrl can only allocate
> the PMGs of the CLOSIDs it uses. info/L3_MON/num_rmids is instead set
> to the whole PARTID and PMG space when the monitors are initialised,
> and halved when CDP is enabled. It reports more RMIDs than resctrl can
> allocate in two cases:
> 
> - With CDP each CLOSID takes two PARTIDs, and resctrl halves the
>    CLOSID count rounding down, while MPAM halves the whole RMID space.
>    With 5 PARTIDs and 2 PMGs resctrl has 2 CLOSIDs and 4 RMIDs, but
>    num_rmids reads 5. The count is too high whenever the number of
>    PARTIDs is odd and there is more than one PMG.
> 
> - On a monitor-only system there are no control groups and resctrl
>    only uses the default CLOSID, but num_rmids still covers every
>    PARTID. With 5 PARTIDs and 2 PMGs it reads 10 while only 2 RMIDs
>    can be allocated.
> 
> RMID allocation is limited to the CLOSIDs in use, so only the value
> reported to userspace is too high. Creating as many monitor groups as
> num_rmids allows fails with -ENOSPC before that number is reached.
> 
> Count the CLOSIDs resctrl uses instead: every resource has
> mpam_partid_max + 1 CLOSIDs, halved and rounded down while CDP is
> enabled, and a system with no resource that can allocate uses only the
> default CLOSID. Report (pmg_max + 1) RMIDs for each of those CLOSIDs.
> Count at monitor initialisation and from resctrl_arch_set_cdp_enabled(),
> which resctrl calls whenever a mount or unmount enables or disables
> CDP.
> 
> 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+
> 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>
> ---
> v4:
> - Simplify the fix with mpam_partid_max, cdp_enabled
>    and resctrl_arch_alloc_capable() as Ben suggested.
> v3:
> - Drop resctrl_arch_set_mon_rmid_count() and count the CLOSIDs in the
>    MPAM driver instead, as Ben suggested.
> - v2: https://lore.kernel.org/all/20261105123304.2281987-1-ruanjinjie@huawei.com/
> v2:
> - Also fix num_rmids on monitor-only systems, as Ben suggested.
> - Retitle from "arm_mpam: Round the CDP RMID count down to whole CLOSIDs".
> - v1: https://lore.kernel.org/all/20261104101622.563280-1-ruanjinjie@huawei.com/
> ---
>   drivers/resctrl/mpam_resctrl.c | 30 +++++++++++++++++-------------
>   1 file changed, 17 insertions(+), 13 deletions(-)

Reviewed-by: Gavin Shan <gshan@redhat.com>


      reply	other threads:[~2026-11-12 23:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11  8:13 [PATCH v4 0/3] arm_mpam: resctrl: Fix several CDP bugs Jinjie Ruan
2026-11-11  8:13 ` [PATCH v4 1/3] arm_mpam: resctrl: Leave CDP off when there are too few PARTIDs Jinjie Ruan
2026-11-12 23:28   ` Gavin Shan
2026-11-11  8:13 ` [PATCH v4 2/3] arm_mpam: resctrl: Only enable CDP on a resource that supports it Jinjie Ruan
2026-11-12 23:42   ` Gavin Shan
2026-11-11  8:13 ` [PATCH v4 3/3] arm_mpam: resctrl: Limit num_rmids to the CLOSIDs in use Jinjie Ruan
2026-11-12 23:46   ` Gavin Shan [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=da4c6658-a4a0-43ae-92da-14d8463dfc08@redhat.com \
    --to=gshan@redhat.com \
    --cc=ben.horgan@arm.com \
    --cc=fenghuay@nvidia.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=ruanjinjie@huawei.com \
    --cc=tan.shaopeng@jp.fujitsu.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®