From: Jinjie Ruan <ruanjinjie@huawei.com>
To: Ben Horgan <ben.horgan@arm.com>, <tony.luck@intel.com>,
<reinette.chatre@intel.com>, <Dave.Martin@arm.com>,
<james.morse@arm.com>, <babu.moger@amd.com>, <corbet@lwn.net>,
<skhan@linuxfoundation.org>, <rdunlap@infradead.org>,
<bp@alien8.de>, <tan.shaopeng@fujitsu.com>, <gshan@redhat.com>,
<jic23@kernel.org>, <fenghuay@nvidia.com>, <zengheng4@huawei.com>,
<x86@kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-doc@vger.kernel.org>
Subject: Re: [PATCH v6 3/6] fs/resctrl: Clear the CDP state after the cleanup
Date: Thu, 19 Nov 2026 20:15:40 +0800 [thread overview]
Message-ID: <382b27cd-2667-44d0-a5c6-006655015f69@huawei.com> (raw)
In-Reply-To: <6b0ccb0d-487a-4985-ac7b-81808848fd0b@arm.com>
在 2026/11/19 19:21, Ben Horgan 写道:
> Hi Jinjie,
>
> On 19/11/2026 09:48, Jinjie Ruan wrote:
>> To support CDP, resctrl halves the number of CLOSIDs available to
>> resource groups and gives each remaining CLOSID two hardware
>> configurations instead of one, distinguished by index: 2 * CLOSID for
>> data and 2 * CLOSID + 1 for code. Without CDP a CLOSID has a single
>> configuration, at index CLOSID. Every architecture computes these
>> indices the same way.
>>
>> Unmounting clears the CDP state before it undoes what the groups were
>> given, so the cleanup computes index CLOSID where the group was set up
>> with 2 * CLOSID and 2 * CLOSID + 1. The group's two configurations are
>> left in place and index CLOSID is cleared instead, which with CDP
>> enabled is a configuration of a different CLOSID. The architecture may
>> keep this state for as long as the resource exists.
>>
>> Only MPAM can reach this today. Of everything the cleanup has to undo,
>> MPAM addresses only the MBM counter assignment by the translated CLOSID,
>> and it only began doing so when it implemented assignable counters.
>
> This is clearly not ideal but even in MPAM we get away without any usable visible effect. Or am I
> missing something? We are left with some assigned counters from the MPAM driver point of view but
> the resctrl is in charge of the assignments and MPAM doesn't check if a counter is already assigned
> when resctrl asks for a new assignment. The change looks good to me.
I agree with your analysis, and I have also confirmed it:
- __config_cntr() only performs an overwrite write and does not modify
the allocation of assigned_counters[].
if (assign)
mon->mbwu_idx_to_mon[mbwu_idx] = mon->assigned_counters[mon_idx];
else
mon->mbwu_idx_to_mon[mbwu_idx] = -1;
- When umount, the resctrl cntr_cfg[] is destroyed along with the
domain, and cross-mounting does not exist.
- When the mbm_cntr_get() is used to read, cntr_cfg[] of the resctrl is
checked first. If no record is found, the value is directly set to
Unassigned, so the stale mbwu_idx_to_mon will not be read between
unmounted and the next time it is mounted.
- Each time a new allocation is performed, the same
mbwu_idx_to_mon[mbwu_idx] is overwritten.
so there is no observable error. It is a silent error.
Best regards,
Jinjie
>
> Thanks,
>
> Ben
>
>
> x86
>> addresses its counters by RMID alone.
>>
>> Clear the CDP state after the cleanup, so that the cleanup runs with the
>> CDP state the groups were set up under.
>>
>> Fixes: 6e0e538a75ce ("arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use")
>> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
>> Cc: <stable@vger.kernel.org>
>> ---
>> v6:
>> - Describe the CDP indices as resctrl filesystem behavior that applies
>> to every architecture, and the flow instead of the code (Reinette).
>> - Drop the stable version range, the Fixes tag already gives it.
>> ---
>> fs/resctrl/rdtgroup.c | 10 ++++++++--
>> 1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
>> index 5d0351453c2f..3312637fb514 100644
>> --- a/fs/resctrl/rdtgroup.c
>> +++ b/fs/resctrl/rdtgroup.c
>> @@ -3150,13 +3150,19 @@ static void resctrl_unmount(void)
>> cpus_read_lock();
>> mutex_lock(&rdtgroup_mutex);
>>
>> - rdt_disable_ctx();
>> -
>> /* Put everything back to default values. */
>> for_each_alloc_capable_rdt_resource(r)
>> resctrl_arch_reset_all_ctrls(r);
>>
>> resctrl_fs_teardown();
>> +
>> + /*
>> + * Clear the CDP state after the cleanup. The CDP state decides
>> + * which hardware configuration a CLOSID refers to, so the teardown
>> + * must run with the state the configuration was created under.
>> + */
>> + rdt_disable_ctx();
>> +
>> if (resctrl_arch_alloc_capable())
>> resctrl_arch_disable_alloc();
>> if (resctrl_arch_mon_capable())
>
next prev parent reply other threads:[~2026-11-19 12:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 9:48 [PATCH v6 0/6] fs/resctrl: Fix some resctl bugs related to mpam Jinjie Ruan
2026-11-19 9:48 ` [PATCH v6 1/6] fs/resctrl: Report a temporary RMID shortage per CLOSID Jinjie Ruan
2026-11-19 9:48 ` [PATCH v6 2/6] fs/resctrl: Do not allocate a monitor context when releasing limbo RMIDs Jinjie Ruan
2026-11-19 9:48 ` [PATCH v6 3/6] fs/resctrl: Clear the CDP state after the cleanup Jinjie Ruan
2026-11-19 11:21 ` Ben Horgan
2026-11-19 12:15 ` Jinjie Ruan [this message]
2026-11-19 9:48 ` [PATCH v6 4/6] fs/resctrl: Stop the limbo handler while resctrl is unmounted Jinjie Ruan
2026-11-19 12:34 ` Ben Horgan
2026-11-19 9:48 ` [PATCH v6 5/6] fs/resctrl: Release the limbo RMIDs when the CDP state changes Jinjie Ruan
2026-11-19 9:48 ` [PATCH v6 6/6] fs/resctrl: Disallow monitor group move when the RMID index changes Jinjie Ruan
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=382b27cd-2667-44d0-a5c6-006655015f69@huawei.com \
--to=ruanjinjie@huawei.com \
--cc=Dave.Martin@arm.com \
--cc=babu.moger@amd.com \
--cc=ben.horgan@arm.com \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--cc=fenghuay@nvidia.com \
--cc=gshan@redhat.com \
--cc=james.morse@arm.com \
--cc=jic23@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@infradead.org \
--cc=reinette.chatre@intel.com \
--cc=skhan@linuxfoundation.org \
--cc=tan.shaopeng@fujitsu.com \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
--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®