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 2/3] arm_mpam: resctrl: Only enable CDP on a resource that supports it
Date: Tue, 17 Nov 2026 13:49:48 +1000 [thread overview]
Message-ID: <cc2d1a43-d8be-4ed0-ac96-30b326b67280@redhat.com> (raw)
In-Reply-To: <b1fd5fa8-bf03-4575-bc05-540a288b609d@huawei.com>
Hi Jinjie,
On 11/17/26 1:31 PM, Jinjie Ruan wrote:
> 在 2026/11/13 7:42, Gavin Shan 写道:
>> On 11/11/26 6:13 PM, Jinjie Ruan wrote:
>>> resctrl_arch_set_cdp_enabled() enables CDP for any cache level that is
>>> requested, even one that has no MPAM cache controls. Mounting resctrl
>>> with -o cdpl2 when only L3 can allocate still turns CDP emulation on for
>>> the whole system, so every CLOSID takes two PARTIDs while resctrl keeps
>>> its CLOSID count at the number of PARTIDs. Control groups in the upper
>>> half then map to PARTIDs beyond mpam_partid_max, which index past the
>>> configuration and monitor arrays and program out of range PARTIDs into
>>> the MSCs. On QEMU with 5 PARTIDs the first monitor read after creating
>>> 2 control groups raises MSMONCFG_ID_RANGE for PARTID 5, and MPAM is
>>> disabled.
>>>
>>> Do not enable CDP when a resource cannot allocate or is not CDP capable,
>>> as x86 does, so the mount fails instead. Only the enable path is checked,
>>> since unmount disables CDP on both cache levels to restore the MBA
>>> control.
>>>
>>> A system where only MBA can allocate, or that only has monitors, now
>>> fails a mount with CDP as well: CDP hides the MBA control because
>>> mbw_max is a per-PARTID maximum, leaving nothing for CDP to apply to.
>>>
>>> Fixes: 6789fb99282c ("arm_mpam: resctrl: Add CDP emulation")
>>> Link: https://sashiko.dev/#/bug/linux-05c19551-0bba-4a06-
>>> aa2c-3c90fab5853d
>>> Suggested-by: Ben Horgan <ben.horgan@arm.com>
>>> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
>>> Cc: <stable@vger.kernel.org> # 7.1+
>>> ---
>>> drivers/resctrl/mpam_resctrl.c | 4 ++++
>>> 1 file changed, 4 insertions(+)
>>>
>>> diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/
>>> mpam_resctrl.c
>>> index 573617ba09df..afa3c084c475 100644
>>> --- a/drivers/resctrl/mpam_resctrl.c
>>> +++ b/drivers/resctrl/mpam_resctrl.c
>>> @@ -222,6 +222,10 @@ int resctrl_arch_set_cdp_enabled(enum
>>> resctrl_res_level rid, bool enable)
>>> if (enable && mpam_partid_max < 1)
>>> return -EINVAL;
>>> + if (enable && (!
>>> mpam_resctrl_controls[rid].resctrl_res.alloc_capable ||
>>> + !mpam_resctrl_controls[rid].resctrl_res.cdp_capable))
>>> + return -EINVAL;
>>> +
>>
>> x86 only checks 'cdp_capable', so this check isn't exactly same as to
>> what's
>> done on x86, as claimed in the commit log?
>
> Sorry, the commit message is somewhat misleading and need updated.
>
> In my opinion, CDP is a feature related to resource allocation, and it
> is always reasonable to check alloc_capable.
Making sense, with the commit log improved:
Reviewed-by: Gavin Shan <gshan@redhat.com>
>
> Best regards,
> Jinjie
>
>>
>> int resctrl_arch_set_cdp_enabled(enum resctrl_res_level l, bool enable)
>> {
>> struct rdt_hw_resource *hw_res = &rdt_resources_all[l];
>>
>> if (!hw_res->r_resctrl.cdp_capable)
>> return -EINVAL;
>>
>> :
>> }
>>
>>
>>> /*
>>> * resctrl_arch_set_cdp_enabled() is only called with enable set to
>>> * false on error and unmount.
>>
Thanks,
Gavin
next prev parent reply other threads:[~2026-11-17 3:50 UTC|newest]
Thread overview: 9+ 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-17 3:31 ` Jinjie Ruan
2026-11-17 3:49 ` Gavin Shan [this message]
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
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=cc2d1a43-d8be-4ed0-ac96-30b326b67280@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