* [PATCH v7 1/6] fs/resctrl: Report a temporary RMID shortage per CLOSID
2026-11-26 9:50 [PATCH v7 0/6] fs/resctrl: Fix some resctl bugs related to mpam Jinjie Ruan
@ 2026-11-26 9:50 ` Jinjie Ruan
2026-11-26 9:50 ` [PATCH v7 2/6] fs/resctrl: Do not allocate a monitor context when releasing limbo RMIDs Jinjie Ruan
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Jinjie Ruan @ 2026-11-26 9:50 UTC (permalink / raw)
To: tony.luck, reinette.chatre, Dave.Martin, james.morse, babu.moger,
corbet, skhan, rdunlap, bp, tan.shaopeng, fenghuay, will, gshan,
jic23, ben.horgan, zengheng4, x86, linux-kernel, linux-doc
Cc: ruanjinjie
An RMID that is freed is held in limbo until its cache occupancy drops
below the threshold, after which it returns to the free list. A request
that fails because of limbo is thus temporary and worth retrying, which
resctrl reports to userspace as -EBUSY. A request that fails because
every RMID is in use is permanent and reported as -ENOSPC.
Where an RMID is only meaningful together with a CLOSID, a request can
only be satisfied by an RMID belonging to the requested CLOSID, so the
distinction has to be drawn per CLOSID. Instead it is drawn system wide.
-ENOSPC is reported when the free list holds no RMID for the requested
CLOSID, even when that CLOSID has RMIDs in limbo. -EBUSY is reported
when the free list is empty and another CLOSID has an RMID in limbo,
even when the requested CLOSID has none. Userspace is thus told to give
up on a shortage that may clear on its own, and to retry one that cannot
clear until it removes a group itself.
Architectures where the RMID is independent of the CLOSID always match
the first entry on the free list, so neither case arises there and only
MPAM systems are affected.
Draw the distinction from the number of RMIDs the requested CLOSID has
in limbo where the RMID depends on the CLOSID, and from the system wide
count otherwise. Drop the separate test for an empty free list, which
the search handles on its own.
Fixes: c4c0376eefe1 ("x86/resctrl: Allow RMID allocation to be scoped by CLOSID")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: Ben Horgan <ben.horgan@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Reinette Chatre <reinette.chatre@intel.com>
Cc: Babu Moger <babu.moger@amd.com>
Cc: <stable@vger.kernel.org> # 7.1.x
---
fs/resctrl/monitor.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
index 04e4ea612b7c..b8f4e1ff4083 100644
--- a/fs/resctrl/monitor.c
+++ b/fs/resctrl/monitor.c
@@ -207,9 +207,6 @@ static struct rmid_entry *resctrl_find_free_rmid(u32 closid)
struct rmid_entry *itr;
u32 itr_idx, cmp_idx;
- if (list_empty(&rmid_free_lru))
- return rmid_limbo_count ? ERR_PTR(-EBUSY) : ERR_PTR(-ENOSPC);
-
list_for_each_entry(itr, &rmid_free_lru, list) {
/*
* Get the index of this free RMID, and the index it would need
@@ -225,7 +222,17 @@ static struct rmid_entry *resctrl_find_free_rmid(u32 closid)
return itr;
}
- return ERR_PTR(-ENOSPC);
+ /*
+ * No free RMID matched. If this CLOSID has RMIDs in limbo, return
+ * -EBUSY so userspace can retry. Otherwise, the CLOSID is genuinely
+ * out of RMIDs. When RMIDs are not per-CLOSID, any RMID in limbo
+ * delays the allocation.
+ */
+ if (IS_ENABLED(CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID))
+ return closid_num_dirty_rmid[closid] ? ERR_PTR(-EBUSY) :
+ ERR_PTR(-ENOSPC);
+
+ return rmid_limbo_count ? ERR_PTR(-EBUSY) : ERR_PTR(-ENOSPC);
}
/**
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v7 2/6] fs/resctrl: Do not allocate a monitor context when releasing limbo RMIDs
2026-11-26 9:50 [PATCH v7 0/6] fs/resctrl: Fix some resctl bugs related to mpam Jinjie Ruan
2026-11-26 9:50 ` [PATCH v7 1/6] fs/resctrl: Report a temporary RMID shortage per CLOSID Jinjie Ruan
@ 2026-11-26 9:50 ` Jinjie Ruan
2026-11-26 9:50 ` [PATCH v7 3/6] fs/resctrl: Clear the CDP state after the cleanup Jinjie Ruan
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Jinjie Ruan @ 2026-11-26 9:50 UTC (permalink / raw)
To: tony.luck, reinette.chatre, Dave.Martin, james.morse, babu.moger,
corbet, skhan, rdunlap, bp, tan.shaopeng, fenghuay, will, gshan,
jic23, ben.horgan, zengheng4, x86, linux-kernel, linux-doc
Cc: ruanjinjie
Busy RMIDs of a monitor domain are normally released by the limbo
handler once their cache occupancy drops below the threshold. When a
domain goes offline, its busy RMIDs are released without checking
occupancy, since the domain is going away and the RMIDs would otherwise
never return to the free list.
On the monitor domain offline path, __check_limbo() allocates the
monitor context that an occupancy check needs before it scans the busy
RMIDs, but without using it, and returns early when that allocation
fails. Then the caller destroys the domain's monitoring state, including
the bitmap that records which RMIDs are busy, so nothing can clear those
bits afterwards and the busy counts never reach zero. Those RMIDs never
return to the free list and, where the RMID depends on the CLOSID, the
dirty count of their CLOSID never decreases. The allocation can also
wait for a monitor to become free, which stalls the CPU offline path on
a context that is not going to be used.
Only MPAM systems are affected. An architecture that can always read an
RMID allocates nothing for the monitor context, so the allocation can
neither fail nor wait there.
Move the release of busy RMIDs into a separate function that does not
take a monitor context and leave the occupancy check to __check_limbo().
Fixes: e557999f80a5 ("x86/resctrl: Allow arch to allocate memory needed in resctrl_arch_rmid_read()")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: Ben Horgan <ben.horgan@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Reinette Chatre <reinette.chatre@intel.com>
Cc: <stable@vger.kernel.org> # 7.1.x
---
fs/resctrl/internal.h | 2 +-
fs/resctrl/monitor.c | 72 ++++++++++++++++++++++++++++---------------
fs/resctrl/rdtgroup.c | 2 +-
3 files changed, 49 insertions(+), 27 deletions(-)
diff --git a/fs/resctrl/internal.h b/fs/resctrl/internal.h
index e62a277dee85..1c85e06f09bf 100644
--- a/fs/resctrl/internal.h
+++ b/fs/resctrl/internal.h
@@ -405,7 +405,7 @@ void cqm_handle_limbo(struct work_struct *work);
bool has_busy_rmid(struct rdt_l3_mon_domain *d);
-void __check_limbo(struct rdt_l3_mon_domain *d, bool force_free);
+void release_limbo_rmids(struct rdt_l3_mon_domain *d);
void resctrl_file_fflags_init(const char *config, unsigned long fflags);
diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
index b8f4e1ff4083..ae9ddd380515 100644
--- a/fs/resctrl/monitor.c
+++ b/fs/resctrl/monitor.c
@@ -124,21 +124,45 @@ static void limbo_release_entry(struct rmid_entry *entry)
closid_num_dirty_rmid[entry->closid]--;
}
+/*
+ * Release the RMIDs that are marked as busy for this domain without
+ * checking their LLC occupancy. Cache lines may still be tagged with
+ * these RMIDs and will be accounted to the next user of each RMID.
+ */
+void release_limbo_rmids(struct rdt_l3_mon_domain *d)
+{
+ u32 idx_limit = resctrl_arch_system_num_rmid_idx();
+ struct rmid_entry *entry;
+ u32 idx, cur_idx = 1;
+
+ for (;;) {
+ idx = find_next_bit(d->rmid_busy_llc, idx_limit, cur_idx);
+ if (idx >= idx_limit)
+ break;
+
+ entry = __rmid_entry(idx);
+ clear_bit(idx, d->rmid_busy_llc);
+ if (!--entry->busy)
+ limbo_release_entry(entry);
+ cur_idx = idx + 1;
+ }
+}
+
/*
* Check the RMIDs that are marked as busy for this domain. If the
* reported LLC occupancy is below the threshold clear the busy bit and
* decrement the count. If the busy count gets to zero on an RMID, we
* free the RMID
*/
-void __check_limbo(struct rdt_l3_mon_domain *d, bool force_free)
+static void __check_limbo(struct rdt_l3_mon_domain *d)
{
struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3);
u32 idx_limit = resctrl_arch_system_num_rmid_idx();
struct rmid_entry *entry;
- bool rmid_dirty = true;
u32 idx, cur_idx = 1;
void *arch_mon_ctx;
void *arch_priv;
+ bool rmid_dirty;
u64 val = 0;
arch_priv = mon_event_all[QOS_L3_OCCUP_EVENT_ID].arch_priv;
@@ -161,30 +185,28 @@ void __check_limbo(struct rdt_l3_mon_domain *d, bool force_free)
break;
entry = __rmid_entry(idx);
- if (!force_free) {
- if (resctrl_arch_rmid_read(r, &d->hdr, entry->closid,
- entry->rmid, QOS_L3_OCCUP_EVENT_ID,
- arch_priv, &val, arch_mon_ctx)) {
- rmid_dirty = true;
- } else {
- rmid_dirty = (val >= resctrl_rmid_realloc_threshold);
-
- /*
- * x86's CLOSID and RMID are independent numbers,
- * so the entry's CLOSID is an empty CLOSID
- * (X86_RESCTRL_EMPTY_CLOSID). On Arm the RMID
- * (PMG) extends the CLOSID (PARTID) space with
- * bits that aren't used to select the configuration.
- * It is thus necessary to track both CLOSID and
- * RMID because there may be dependencies between
- * them on some architectures.
- */
- trace_mon_llc_occupancy_limbo(entry->closid, entry->rmid,
- d->hdr.id, val);
- }
+ if (resctrl_arch_rmid_read(r, &d->hdr, entry->closid,
+ entry->rmid, QOS_L3_OCCUP_EVENT_ID,
+ arch_priv, &val, arch_mon_ctx)) {
+ rmid_dirty = true;
+ } else {
+ rmid_dirty = (val >= resctrl_rmid_realloc_threshold);
+
+ /*
+ * x86's CLOSID and RMID are independent numbers,
+ * so the entry's CLOSID is an empty CLOSID
+ * (X86_RESCTRL_EMPTY_CLOSID). On Arm the RMID
+ * (PMG) extends the CLOSID (PARTID) space with
+ * bits that aren't used to select the configuration.
+ * It is thus necessary to track both CLOSID and
+ * RMID because there may be dependencies between
+ * them on some architectures.
+ */
+ trace_mon_llc_occupancy_limbo(entry->closid, entry->rmid,
+ d->hdr.id, val);
}
- if (force_free || !rmid_dirty) {
+ if (!rmid_dirty) {
clear_bit(idx, d->rmid_busy_llc);
if (!--entry->busy)
limbo_release_entry(entry);
@@ -843,7 +865,7 @@ void cqm_handle_limbo(struct work_struct *work)
if (cpumask_empty(&d->hdr.cpu_mask))
goto out_unlock;
- __check_limbo(d, false);
+ __check_limbo(d);
if (has_busy_rmid(d)) {
d->cqm_work_cpu = cpumask_any_housekeeping(&d->hdr.cpu_mask,
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 57ab090072c2..5d0351453c2f 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -4590,7 +4590,7 @@ void resctrl_offline_mon_domain(struct rdt_resource *r, struct rdt_domain_hdr *h
* the RMID as busy creates RMID leaks if the
* package never comes back.
*/
- __check_limbo(d, true);
+ release_limbo_rmids(d);
}
domain_destroy_l3_mon_state(d);
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v7 3/6] fs/resctrl: Clear the CDP state after the cleanup
2026-11-26 9:50 [PATCH v7 0/6] fs/resctrl: Fix some resctl bugs related to mpam Jinjie Ruan
2026-11-26 9:50 ` [PATCH v7 1/6] fs/resctrl: Report a temporary RMID shortage per CLOSID Jinjie Ruan
2026-11-26 9:50 ` [PATCH v7 2/6] fs/resctrl: Do not allocate a monitor context when releasing limbo RMIDs Jinjie Ruan
@ 2026-11-26 9:50 ` Jinjie Ruan
2026-11-26 9:50 ` [PATCH v7 4/6] fs/resctrl: Stop the limbo handler while resctrl is unmounted Jinjie Ruan
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Jinjie Ruan @ 2026-11-26 9:50 UTC (permalink / raw)
To: tony.luck, reinette.chatre, Dave.Martin, james.morse, babu.moger,
corbet, skhan, rdunlap, bp, tan.shaopeng, fenghuay, will, gshan,
jic23, ben.horgan, zengheng4, x86, linux-kernel, linux-doc
Cc: ruanjinjie
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.
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. x86
addresses its counters by RMID alone.
Nothing visible goes wrong. resctrl keeps its own record of the counter
assignments, discards it on unmount and only reads a counter it has
assigned, and each new assignment overwrites the architecture's mapping.
The architecture is still left holding assignments that resctrl no
longer knows about.
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>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
---
v7:
- State that the stale assignments have no visible effect (Ben).
- Drop the stable tag, as nothing visible goes wrong.
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())
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v7 4/6] fs/resctrl: Stop the limbo handler while resctrl is unmounted
2026-11-26 9:50 [PATCH v7 0/6] fs/resctrl: Fix some resctl bugs related to mpam Jinjie Ruan
` (2 preceding siblings ...)
2026-11-26 9:50 ` [PATCH v7 3/6] fs/resctrl: Clear the CDP state after the cleanup Jinjie Ruan
@ 2026-11-26 9:50 ` Jinjie Ruan
2026-11-26 9:50 ` [PATCH v7 5/6] fs/resctrl: Recreate the dirty RMIDs when the CDP state changes Jinjie Ruan
` (2 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Jinjie Ruan @ 2026-11-26 9:50 UTC (permalink / raw)
To: tony.luck, reinette.chatre, Dave.Martin, james.morse, babu.moger,
corbet, skhan, rdunlap, bp, tan.shaopeng, fenghuay, will, gshan,
jic23, ben.horgan, zengheng4, x86, linux-kernel, linux-doc
Cc: ruanjinjie
A monitoring group's RMID is not returned to the free list when the
group is removed. It stays in limbo until the cache occupancy still
counted against it has dropped low enough for the RMID to be reused,
which the limbo handler checks once a second.
The limbo handler keeps running after resctrl is unmounted, where there
is nothing for it to achieve. An RMID is only allocated when a group is
created, which needs resctrl to be mounted, so no RMID the limbo handler
returns to the free list can be used before the next mount, and that
mount can check them itself. The MBM overflow handler already stops for
this reason once resctrl_mounted is cleared.
Reading the RMIDs in limbo while resctrl is unmounted is not safe on
every architecture. On MPAM the counter of an RMID is selected by the
CLOSID that owns it, and the CLOSID depends on the CDP state. Unmount
clears the CDP state, so the limbo handler that keeps running reads the
RMIDs freed under CDP through the CLOSIDs of the cleared state.
Stop the limbo handler while resctrl is unmounted, as the overflow
handler does, and restart it after a mount on every domain that still
has RMIDs in limbo. The worker can stay queued across the unmount, so
cancel it before queuing it again.
Fixes: 6789fb99282c ("arm_mpam: resctrl: Add CDP emulation")
Suggested-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Reviewed-by: Ben Horgan <ben.horgan@arm.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Cc: <stable@vger.kernel.org>
---
v6:
- Explain first why stopping the limbo handler is fine on every
architecture, and describe MPAM by CLOSID only (Reinette).
- Rename resctrl_limbo_resume() to cqm_resume_limbo_handler() and declare
it with the other limbo handler helpers (Reinette).
- Return early when the L3 resource is not mon_capable (Reinette).
- Drop the stable version range, the Fixes tag already gives it.
---
fs/resctrl/internal.h | 2 ++
fs/resctrl/monitor.c | 41 +++++++++++++++++++++++++++++++++++++++--
fs/resctrl/rdtgroup.c | 2 ++
3 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/fs/resctrl/internal.h b/fs/resctrl/internal.h
index 1c85e06f09bf..f52e0937702a 100644
--- a/fs/resctrl/internal.h
+++ b/fs/resctrl/internal.h
@@ -401,6 +401,8 @@ bool is_mba_sc(struct rdt_resource *r);
void cqm_setup_limbo_handler(struct rdt_l3_mon_domain *dom, unsigned long delay_ms,
int exclude_cpu);
+void cqm_resume_limbo_handler(void);
+
void cqm_handle_limbo(struct work_struct *work);
bool has_busy_rmid(struct rdt_l3_mon_domain *d);
diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
index ae9ddd380515..5f3d39f0d3ed 100644
--- a/fs/resctrl/monitor.c
+++ b/fs/resctrl/monitor.c
@@ -852,6 +852,13 @@ void cqm_handle_limbo(struct work_struct *work)
*/
mutex_lock(&rdtgroup_mutex);
+ /*
+ * If the filesystem has been unmounted this work no longer needs to
+ * run. cqm_resume_limbo_handler() restarts it on the next mount.
+ */
+ if (!resctrl_mounted)
+ goto out_unlock;
+
/*
* Ensure the worker is dedicated to a CPU as intended and not
* relocated by workqueue subsystem as part of CPU going offline.
@@ -1001,8 +1008,8 @@ int setup_rmid_lru_list(void)
/*
* Called on every mount, but the number of RMIDs cannot change
* after the first mount, so keep using the same set of rmid_ptrs[]
- * until resctrl_exit(). Note that the limbo handler continues to
- * access rmid_ptrs[] after resctrl is unmounted.
+ * until resctrl_exit(). Note that the RMIDs in limbo stay in limbo
+ * across an unmount and are checked again after the next mount.
*/
if (rmid_ptrs)
return 0;
@@ -1033,6 +1040,36 @@ int setup_rmid_lru_list(void)
return 0;
}
+/**
+ * cqm_resume_limbo_handler() - Restart the limbo handler after a mount.
+ *
+ * The limbo handler stops while resctrl is unmounted. Restart it on every
+ * domain that still has RMIDs in limbo.
+ */
+void cqm_resume_limbo_handler(void)
+{
+ struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3);
+ struct rdt_l3_mon_domain *d;
+
+ lockdep_assert_cpus_held();
+ lockdep_assert_held(&rdtgroup_mutex);
+
+ if (!r->mon_capable || !resctrl_is_mon_event_enabled(QOS_L3_OCCUP_EVENT_ID))
+ return;
+
+ list_for_each_entry_rcu(d, &r->mon_domains, hdr.list, lockdep_is_cpus_held()) {
+ if (!has_busy_rmid(d))
+ continue;
+
+ /*
+ * The unmount may have left the worker queued. Cancel it so
+ * it is queued again on a CPU picked now.
+ */
+ cancel_delayed_work(&d->cqm_limbo);
+ cqm_setup_limbo_handler(d, 0, RESCTRL_PICK_ANY_CPU);
+ }
+}
+
void free_rmid_lru_list(void)
{
if (!resctrl_arch_mon_capable())
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 3312637fb514..c7c4f618208d 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -3267,6 +3267,8 @@ static int rdt_get_tree(struct fs_context *fc)
RESCTRL_PICK_ANY_CPU);
}
+ cqm_resume_limbo_handler();
+
/*
* Ensure root remains accessible after mutex is unlocked so that
* kernfs_kill_sb() can run safely if called by kernfs_get_tree()'s
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v7 5/6] fs/resctrl: Recreate the dirty RMIDs when the CDP state changes
2026-11-26 9:50 [PATCH v7 0/6] fs/resctrl: Fix some resctl bugs related to mpam Jinjie Ruan
` (3 preceding siblings ...)
2026-11-26 9:50 ` [PATCH v7 4/6] fs/resctrl: Stop the limbo handler while resctrl is unmounted Jinjie Ruan
@ 2026-11-26 9:50 ` Jinjie Ruan
2026-12-03 20:15 ` Reinette Chatre
2026-11-26 9:50 ` [PATCH v7 6/6] fs/resctrl: Disallow monitor group move when the RMID index changes Jinjie Ruan
2026-12-03 20:05 ` [PATCH v7 0/6] fs/resctrl: Fix some resctl bugs related to mpam Reinette Chatre
6 siblings, 1 reply; 9+ messages in thread
From: Jinjie Ruan @ 2026-11-26 9:50 UTC (permalink / raw)
To: tony.luck, reinette.chatre, Dave.Martin, james.morse, babu.moger,
corbet, skhan, rdunlap, bp, tan.shaopeng, fenghuay, will, gshan,
jic23, ben.horgan, zengheng4, x86, linux-kernel, linux-doc
Cc: ruanjinjie
On MPAM an RMID is read through the PARTIDs of its CLOSID: CLOSID c is
PARTID c without CDP, and PARTIDs 2c and 2c+1 with CDP. A mount that
changes the CDP state changes how every RMID is read, but the RMIDs keep
the dirty state they had under the previous CDP state.
With 5 PARTIDs:
mount CDP off, CLOSID c -> PARTID c
mkdir g1..g4 CLOSIDs 1..4
umount RMIDs enter limbo with CLOSIDs 1..4
mount -o cdp CDP on, CLOSID c -> PARTIDs 2c, 2c+1
limbo handler reads CLOSID 2 as PARTID 5 > PARTID_MAX 4
mpam:__mpam_irq_handler: error irq from msc:1 'MSMONCFG_ID_RANGE', partid:5, pmg: 0, ris: 0
mpam:mpam_disable: MPAM disabled due to hardware error interrupt
The other direction fails silently, and the free RMIDs are affected too.
With CDP the default group's code accesses tag cache lines with PARTID 1.
Mounted again without CDP, a new group given CLOSID 1 and RMID 0 starts
out counting those lines, although that RMID was never in limbo.
When a mount changes the CDP state, put every RMID that can be allocated
back in limbo, so that each one is checked as it is now read before it
is reused. Until then, creating a group may fail with -EBUSY. The RMIDs
of a CLOSID that is out of range under the new CDP state can neither be
read nor allocated, and stay free. CDP on any resource changes how every
CLOSID is monitored, so the CDP state of every resource is compared.
Where the RMID does not depend on the CLOSID, as on x86, nothing changes.
Fixes: 6789fb99282c ("arm_mpam: resctrl: Add CDP emulation")
Suggested-by: Ben Horgan <ben.horgan@arm.com>
Suggested-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Cc: <stable@vger.kernel.org>
---
v7:
- Recreate the dirty RMIDs instead of releasing the ones in limbo: the
cache lines of every RMID may now be accounted to a different RMID,
including the RMIDs that were free, so all of them are checked with
the new mapping before they can be reused (Ben, Reinette).
- Trigger the recreation on the CDP change alone, without testing
whether a domain has RMIDs in limbo (Reinette).
- Leave the RMIDs of a CLOSID that is out of range under the new CDP
state on the free list instead of reading them.
- Do not recreate the dirty RMIDs on the first mount, before which only
the default RMID is used, so that a group can be created right after
the first mount with CDP.
- Link to v6: https://lore.kernel.org/all/6dd79d09-576b-4086-ba5c-7f8663292a6e@arm.com/
---
fs/resctrl/monitor.c | 57 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 56 insertions(+), 1 deletion(-)
diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
index 5f3d39f0d3ed..8d78360efda8 100644
--- a/fs/resctrl/monitor.c
+++ b/fs/resctrl/monitor.c
@@ -70,6 +70,13 @@ static u32 *closid_num_dirty_rmid;
*/
static unsigned int rmid_limbo_count;
+/*
+ * @limbo_cdp_state - 1 if the RMIDs were last checked with CDP enabled, 0 if
+ * not, -1 before the first mount, when only the default RMID has been
+ * used. Only used when CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID is defined.
+ */
+static int limbo_cdp_state = -1;
+
/*
* @rmid_entry - The entry in the limbo and free lists.
*/
@@ -1040,11 +1047,42 @@ int setup_rmid_lru_list(void)
return 0;
}
+/*
+ * A change of the CDP state changes how every RMID is read, so any RMID, free
+ * or in limbo, may now count cache lines left by another. Put every RMID that
+ * can be allocated back in limbo. The others can neither be read nor
+ * allocated until the CDP state changes back.
+ */
+static void recreate_dirty_rmids(struct rdt_resource *r)
+{
+ u32 idx_limit = resctrl_arch_system_num_rmid_idx();
+ struct rdt_l3_mon_domain *d;
+
+ lockdep_assert_cpus_held();
+ lockdep_assert_held(&rdtgroup_mutex);
+
+ /* Only the default group exists, so this frees every other RMID. */
+ list_for_each_entry_rcu(d, &r->mon_domains, hdr.list, lockdep_is_cpus_held())
+ release_limbo_rmids(d);
+
+ /* Skip the default RMID, which stays allocated. */
+ for (u32 idx = 1; idx < idx_limit; idx++) {
+ struct rmid_entry *entry = __rmid_entry(idx);
+
+ if (entry->closid >= closids_supported())
+ continue;
+
+ list_del(&entry->list);
+ add_rmid_to_limbo(entry);
+ }
+}
+
/**
* cqm_resume_limbo_handler() - Restart the limbo handler after a mount.
*
* The limbo handler stops while resctrl is unmounted. Restart it on every
- * domain that still has RMIDs in limbo.
+ * domain that still has RMIDs in limbo, after checking every RMID again if
+ * the mount changed how they are read.
*/
void cqm_resume_limbo_handler(void)
{
@@ -1057,6 +1095,23 @@ void cqm_resume_limbo_handler(void)
if (!r->mon_capable || !resctrl_is_mon_event_enabled(QOS_L3_OCCUP_EVENT_ID))
return;
+ /*
+ * Where the RMID depends on the CLOSID, the CDP state decides how an
+ * RMID is read. CDP on any resource changes how every CLOSID is
+ * monitored, including by the L3.
+ */
+ if (IS_ENABLED(CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID)) {
+ struct rdt_resource *res;
+ bool cdp_enabled = false;
+
+ for_each_rdt_resource(res)
+ cdp_enabled |= resctrl_arch_get_cdp_enabled(res->rid);
+
+ if (limbo_cdp_state >= 0 && cdp_enabled != limbo_cdp_state)
+ recreate_dirty_rmids(r);
+ limbo_cdp_state = cdp_enabled;
+ }
+
list_for_each_entry_rcu(d, &r->mon_domains, hdr.list, lockdep_is_cpus_held()) {
if (!has_busy_rmid(d))
continue;
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v7 5/6] fs/resctrl: Recreate the dirty RMIDs when the CDP state changes
2026-11-26 9:50 ` [PATCH v7 5/6] fs/resctrl: Recreate the dirty RMIDs when the CDP state changes Jinjie Ruan
@ 2026-12-03 20:15 ` Reinette Chatre
0 siblings, 0 replies; 9+ messages in thread
From: Reinette Chatre @ 2026-12-03 20:15 UTC (permalink / raw)
To: Jinjie Ruan, tony.luck, Dave.Martin, james.morse, babu.moger,
corbet, skhan, rdunlap, bp, tan.shaopeng, fenghuay, will, gshan,
jic23, ben.horgan, zengheng4, x86, linux-kernel, linux-doc
Hi Jinjie,
Thank you for this redesign. I find rebuilding the dirty RMIDs
to be the right approach.
On 11/26/26 1:50 AM, Jinjie Ruan wrote:
> On MPAM an RMID is read through the PARTIDs of its CLOSID: CLOSID c is
> PARTID c without CDP, and PARTIDs 2c and 2c+1 with CDP. A mount that
> changes the CDP state changes how every RMID is read, but the RMIDs keep
> the dirty state they had under the previous CDP state.
>
> With 5 PARTIDs:
>
> mount CDP off, CLOSID c -> PARTID c
> mkdir g1..g4 CLOSIDs 1..4
> umount RMIDs enter limbo with CLOSIDs 1..4
> mount -o cdp CDP on, CLOSID c -> PARTIDs 2c, 2c+1
> limbo handler reads CLOSID 2 as PARTID 5 > PARTID_MAX 4
>
> mpam:__mpam_irq_handler: error irq from msc:1 'MSMONCFG_ID_RANGE', partid:5, pmg: 0, ris: 0
> mpam:mpam_disable: MPAM disabled due to hardware error interrupt
>
> The other direction fails silently, and the free RMIDs are affected too.
> With CDP the default group's code accesses tag cache lines with PARTID 1.
> Mounted again without CDP, a new group given CLOSID 1 and RMID 0 starts
> out counting those lines, although that RMID was never in limbo.
>
> When a mount changes the CDP state, put every RMID that can be allocated
> back in limbo, so that each one is checked as it is now read before it
"back in limbo" is not quite accurate since the RMIDs may be on free list.
This could perhaps just be "put every RMID that can be allocated in limbo"?
> is reused. Until then, creating a group may fail with -EBUSY. The RMIDs
> of a CLOSID that is out of range under the new CDP state can neither be
> read nor allocated, and stay free. CDP on any resource changes how every
> CLOSID is monitored, so the CDP state of every resource is compared.
> Where the RMID does not depend on the CLOSID, as on x86, nothing changes.
Please write with imperative tone. For example,
Compare the CDP state of every resource, since CDP on any resource
changes how every CLOSID is monitored. Leave the limbo handling
unchanged where the RMID does not depend on the CLOSID, as on x86.
...
> ---
> fs/resctrl/monitor.c | 57 +++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 56 insertions(+), 1 deletion(-)
>
> diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
> index 5f3d39f0d3ed..8d78360efda8 100644
> --- a/fs/resctrl/monitor.c
> +++ b/fs/resctrl/monitor.c
> @@ -70,6 +70,13 @@ static u32 *closid_num_dirty_rmid;
> */
> static unsigned int rmid_limbo_count;
>
> +/*
> + * @limbo_cdp_state - 1 if the RMIDs were last checked with CDP enabled, 0 if
> + * not, -1 before the first mount, when only the default RMID has been
> + * used. Only used when CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID is defined.
> + */
> +static int limbo_cdp_state = -1;
This is a big change. Previously this was a simple boolean named "limbo_cdp_enabled"
that tracked just the CDP state but now this becomes an int that tracks two different
things, the CDP state as well as the mount state. Having a single variable overloaded
like this is not ideal. The types are also inconsistent with it later being assigned
a boolean.
Not rebuilding the list on first mount is right, but I think this can be accomplished
without adding a third value here.
setup_rmid_lru_list() already knows which mount is the first, since that is the one that
allocates rmid_ptrs[]. If its call in rdt_get_tree() moved after closid_init(), both things
the rebuild needs would be known when it runs: the CDP state from rdt_enable_ctx() and the
number of CLOSIDs from closid_init(). Nothing between the two calls uses rmid_ptrs[] or
the free list. The first mount could then record the CDP state, later mounts compare against
it and rebuild if it changed, and this could go back to a bool just like it was in v6.
> +
> /*
> * @rmid_entry - The entry in the limbo and free lists.
> */
> @@ -1040,11 +1047,42 @@ int setup_rmid_lru_list(void)
> return 0;
> }
>
> +/*
> + * A change of the CDP state changes how every RMID is read, so any RMID, free
> + * or in limbo, may now count cache lines left by another. Put every RMID that
> + * can be allocated back in limbo. The others can neither be read nor
> + * allocated until the CDP state changes back.
> + */
> +static void recreate_dirty_rmids(struct rdt_resource *r)
Could this be named more specific, for example "limbo_redirty_all()"?
> +{
> + u32 idx_limit = resctrl_arch_system_num_rmid_idx();
> + struct rdt_l3_mon_domain *d;
> +
> + lockdep_assert_cpus_held();
> + lockdep_assert_held(&rdtgroup_mutex);
> +
> + /* Only the default group exists, so this frees every other RMID. */
> + list_for_each_entry_rcu(d, &r->mon_domains, hdr.list, lockdep_is_cpus_held())
> + release_limbo_rmids(d);
> +
After this every RMID other than the default one is on the free list, and the loop below
depends on that. Could it be enforced, for example with WARN_ON_ONCE(rmid_limbo_count)
here? Something left in limbo would otherwise be skipped by the rebuild without any sign.
> + /* Skip the default RMID, which stays allocated. */
> + for (u32 idx = 1; idx < idx_limit; idx++) {
Having the loop managed by the index and then removing the list entry for each
creates an implicit dependency here on how the limbo entries were freed. I think
walking the free list that release_limbo_rmids() just created will be more robust:
list_for_each_entry_safe(entry, tmp, &rmid_free_lru, list) {
if (entry->closid >= num_closid)
continue;
list_del(&entry->list);
...
}
> + struct rmid_entry *entry = __rmid_entry(idx);
> +
> + if (entry->closid >= closids_supported())
closids_supported() may be zero on a monitor-only system. This will mean that
no RMIDs are placed back?
How about:
/* Without allocation, only the default CLOSID is in use. */
num_closid = resctrl_arch_alloc_capable() ? closids_supported() : 1;
> + continue;
> +
> + list_del(&entry->list);
> + add_rmid_to_limbo(entry);
add_rmid_to_limbo() also arms the limbo handler with the default CQM_LIMBOCHECK_INTERVAL,
just for cqm_resume_limbo_handler() to cancel and re-queue it. This is very difficult to
follow.
Could the rebuild only mark the RMIDs dirty, and leave starting the handler to
cqm_resume_limbo_handler()? A new "limbo_add_entry()" that splits out all but
arming the limbo handler would complements existing "limbo_release_entry()" and
keep entry->busy, rmid_limbo_count and closid_num_dirty_rmid[] updated in one place:
/* Mark an RMID dirty in every domain, without arming the limbo handler. */
static void limbo_add_entry(struct rmid_entry *entry)
{
struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3);
struct rdt_l3_mon_domain *d;
u32 idx;
lockdep_assert_held(&rdtgroup_mutex);
lockdep_assert_cpus_held();
idx = resctrl_arch_rmid_idx_encode(entry->closid, entry->rmid);
entry->busy = 0;
list_for_each_entry_rcu(d, &r->mon_domains, hdr.list, lockdep_is_cpus_held()) {
set_bit(idx, d->rmid_busy_llc);
entry->busy++;
}
rmid_limbo_count++;
if (IS_ENABLED(CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID))
closid_num_dirty_rmid[entry->closid]++;
}
add_rmid_to_limbo() would then call limbo_add_entry() and only add arming of the limbo handler.
Above changes should ideally be split into a few preparatory patches, which
is now easier to manage with the CDP fixes not headed to stable. I see at least
two preparatory patches:
- moving setup_rmid_lru_list() to later in rdt_get_tree()
- new limbo_add_entry() helper.
> + }
> +}
> +
> /**
> * cqm_resume_limbo_handler() - Restart the limbo handler after a mount.
> *
> * The limbo handler stops while resctrl is unmounted. Restart it on every
> - * domain that still has RMIDs in limbo.
> + * domain that still has RMIDs in limbo, after checking every RMID again if
> + * the mount changed how they are read.
> */
> void cqm_resume_limbo_handler(void)
> {
> @@ -1057,6 +1095,23 @@ void cqm_resume_limbo_handler(void)
> if (!r->mon_capable || !resctrl_is_mon_event_enabled(QOS_L3_OCCUP_EVENT_ID))
> return;
>
> + /*
> + * Where the RMID depends on the CLOSID, the CDP state decides how an
> + * RMID is read. CDP on any resource changes how every CLOSID is
> + * monitored, including by the L3.
This reads as if resctrl in general linked the CDP state of one resource to the
monitoring of another. It does not; checking every resource is there for how MPAM
emulates CDP, which is fine here because only MPAM selects
CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID. Could the comment say so, wherever the check
ends up? For example:
/*
* Only MPAM selects CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID. Its CDP
* emulation gives every CLOSID two PARTIDs in every MSC as soon as CDP
* is enabled on any resource, so CDP enabled on the L2 alone also
* changes how the L3 monitors read an RMID. Check the CDP state of
* every resource to accommodate that.
*/
> + */
> + if (IS_ENABLED(CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID)) {
> + struct rdt_resource *res;
> + bool cdp_enabled = false;
> +
> + for_each_rdt_resource(res)
> + cdp_enabled |= resctrl_arch_get_cdp_enabled(res->rid);
> +
> + if (limbo_cdp_state >= 0 && cdp_enabled != limbo_cdp_state)
> + recreate_dirty_rmids(r);
> + limbo_cdp_state = cdp_enabled;
> + }
> +
> list_for_each_entry_rcu(d, &r->mon_domains, hdr.list, lockdep_is_cpus_held()) {
> if (!has_busy_rmid(d))
> continue;
Based on the examples it seems there may be scenarios where only limited PARTID are
available. If there is thus a system with only two PARTID and one PMG that is mounted
with CDP then only CLOSID 0 is left. A rebuild may then not put any RMID back while a
limbo worker is still queued.
Considering this, should above perhaps be:
list_for_each_entry_rcu(d, &r->mon_domains, hdr.list, lockdep_is_cpus_held()) {
/* Drop any worker the unmount left queued. */
cancel_delayed_work(&d->cqm_limbo);
if (has_busy_rmid(d))
cqm_setup_limbo_handler(d, 0, RESCTRL_PICK_ANY_CPU);
}
This may be
Reinette
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v7 6/6] fs/resctrl: Disallow monitor group move when the RMID index changes
2026-11-26 9:50 [PATCH v7 0/6] fs/resctrl: Fix some resctl bugs related to mpam Jinjie Ruan
` (4 preceding siblings ...)
2026-11-26 9:50 ` [PATCH v7 5/6] fs/resctrl: Recreate the dirty RMIDs when the CDP state changes Jinjie Ruan
@ 2026-11-26 9:50 ` Jinjie Ruan
2026-12-03 20:05 ` [PATCH v7 0/6] fs/resctrl: Fix some resctl bugs related to mpam Reinette Chatre
6 siblings, 0 replies; 9+ messages in thread
From: Jinjie Ruan @ 2026-11-26 9:50 UTC (permalink / raw)
To: tony.luck, reinette.chatre, Dave.Martin, james.morse, babu.moger,
corbet, skhan, rdunlap, bp, tan.shaopeng, fenghuay, will, gshan,
jic23, ben.horgan, zengheng4, x86, linux-kernel, linux-doc
Cc: ruanjinjie
From: Peter Newman <peternewman@google.com>
A MON group can be moved into the mon_groups directory of another
CTRL_MON group to move its tasks to that group's allocation while
keeping their monitoring data. Where the RMID is only meaningful
together with the CLOSID, as on arm64 MPAM where the RMID is a PMG that
extends the PARTID, the move changes the RMID index of the group. The
move succeeds, but:
- The group's monitoring data is reset. Its counters are identified by
the CLOSID and RMID together, so after the move the group reads the
counters of the new CLOSID instead of the ones its tasks used.
- The group uses an RMID index that was never allocated to it. When
the group is removed, free_rmid() puts an RMID index of the new CLOSID
into limbo without checking that the group owns it. If another group
of that CLOSID holds the index, the limbo handler tests and frees an
RMID that is still in use, while the RMID index allocated to the
moved group is never freed. If no other group holds it, the index is
in use while it is considered free for allocation.
- The tasks are not moved. mongrp_reparent() sets the new parent and
CLOSID of the group before rdt_move_group_tasks() looks for the tasks
to update, and the search then matches on the new CLOSID, which none
of the tasks carries yet. The tasks keep the old CLOSID and the old
CTRL_MON group's allocation, and the group does not count them.
Fixing the task move does not make the move work. The RMID index is the
hardware ID the counters count for, so a group whose CLOSID changes
cannot keep its monitoring data, and it would need a new RMID index
allocated for the new CLOSID, which fails when every RMID index of that
CLOSID is in use. The documentation promises that a move keeps the
monitoring data, so the move cannot be supported, as decided in the
thread at the Link tag.
Reject the move with -EOPNOTSUPP when it changes the RMID index of the
group, and document that a move is not allowed when the monitoring data
or assigned tasks would be impacted. Leave the move allowed where the
RMID does not depend on the CLOSID, such as on x86, and leave renaming
within the same CTRL_MON group allowed everywhere; neither changes the
RMID index.
Fixes: 3e9b35823aab ("arm_mpam: resctrl: Add rmid index helpers")
Signed-off-by: Peter Newman <peternewman@google.com>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: Ben Horgan <ben.horgan@arm.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/lkml/3a637631-c8ec-4e26-a03c-5ac80d16fab3@arm.com/
---
v6:
- Describe the RMID index that is used while it is considered free, and
keep the last paragraph imperative (Reinette).
v5:
- Retitle as the RMID index changes, not the RMID, and a rename within
the same CTRL_MON group is still allowed.
- Describe the RMID index that is freed without having been allocated,
and why the move cannot be fixed instead of being rejected.
- Drop the parent and resctrl_arch_mon_capable() checks, which the RMID
index comparison and the MON group check already cover.
- Use the resctrl.rst terms in the last_cmd_status message.
- Drop the stable version range and the Link tags the changelog did not
refer to, and link the decision to reject the move instead.
- Link to v2: https://lore.kernel.org/all/20261105123524.2282090-1-ruanjinjie@huawei.com/
v2:
- Drop the Suggested-by tag.
- Describe the systems by whether the RMID depends on the CLOSID rather
than by MPAM, in both the changelog and resctrl.rst.
- Explain that moving a monitor group is already broken on these systems
because the tasks are not moved, so no existing user relies on it.
- v1: https://lore.kernel.org/all/20261104101913.586595-1-ruanjinjie@huawei.com/
---
Documentation/filesystems/resctrl.rst | 8 ++++----
fs/resctrl/rdtgroup.c | 13 +++++++++++++
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesystems/resctrl.rst
index b52795e03303..fecb2cd2b343 100644
--- a/Documentation/filesystems/resctrl.rst
+++ b/Documentation/filesystems/resctrl.rst
@@ -551,10 +551,10 @@ will automatically remove all MON groups below it.
Moving MON group directories to a new parent CTRL_MON group is supported
for the purpose of changing the resource allocations of a MON group
-without impacting its monitoring data or assigned tasks. This operation
-is not allowed for MON groups which monitor CPUs. No other move
-operation is currently allowed other than simply renaming a CTRL_MON or
-MON group.
+without impacting its monitoring data or assigned tasks. This operation is
+not allowed for MON groups which monitor CPUs, or when the monitoring data
+or assigned tasks would be impacted. No other move operation is currently
+allowed other than simply renaming a CTRL_MON or MON group.
All groups contain the following files:
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index c7c4f618208d..e16ae5799e0b 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -4403,6 +4403,19 @@ static int rdtgroup_rename(struct kernfs_node *kn,
goto out;
}
+ /*
+ * Moving the group to another CTRL_MON group changes its CLOSID.
+ * Where the RMID is only meaningful together with the CLOSID, this
+ * changes the RMID index and the monitor state cannot follow the
+ * move. A rename within the same CTRL_MON group keeps the index.
+ */
+ if (resctrl_arch_rmid_idx_encode(rdtgrp->closid, rdtgrp->mon.rmid) !=
+ resctrl_arch_rmid_idx_encode(new_prdtgrp->closid, rdtgrp->mon.rmid)) {
+ rdt_last_cmd_puts("Moving a MON group to a new CTRL_MON group is not supported\n");
+ ret = -EOPNOTSUPP;
+ goto out;
+ }
+
/*
* If the MON group is monitoring CPUs, the CPUs must be assigned to the
* current parent CTRL_MON group and therefore cannot be assigned to
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v7 0/6] fs/resctrl: Fix some resctl bugs related to mpam
2026-11-26 9:50 [PATCH v7 0/6] fs/resctrl: Fix some resctl bugs related to mpam Jinjie Ruan
` (5 preceding siblings ...)
2026-11-26 9:50 ` [PATCH v7 6/6] fs/resctrl: Disallow monitor group move when the RMID index changes Jinjie Ruan
@ 2026-12-03 20:05 ` Reinette Chatre
6 siblings, 0 replies; 9+ messages in thread
From: Reinette Chatre @ 2026-12-03 20:05 UTC (permalink / raw)
To: Jinjie Ruan, tony.luck, Dave.Martin, james.morse, babu.moger,
corbet, skhan, rdunlap, bp, tan.shaopeng, fenghuay, will, gshan,
jic23, ben.horgan, zengheng4, x86, linux-kernel, linux-doc
Hi Jinjie,
On 11/26/26 1:50 AM, Jinjie Ruan wrote:
> Fix resctrl RMID allocation to report a retryable -EBUSY only when
> the target CLOSID actually has RMIDs in limbo.
>
> Split the domain-offline path out so it releases busy RMIDs without
> allocating a monitor context it never uses.
>
> Also unmount resctrl with the CDP state it was mounted with to fix
> another bug with mpam cdp.
>
> And do not allow monitor group move when the RMID index changes.
Looking at the series as a whole, I do not think most of it needs to go
to stable. The problems fixed by:
fs/resctrl: Clear the CDP state after the cleanup
fs/resctrl: Stop the limbo handler while resctrl is unmounted
fs/resctrl: Recreate the dirty RMIDs when the CDP state changes
all need CDP on MPAM. Ben reminded me in his recent message
https://lore.kernel.org/all/eafea8c3-589a-444d-9a2f-24a882456fb7@arm.com/
that for MPAM CDP is under CONFIG_EXPERT and looks like MPAM already
prints a warning if a user attempts to enable it:
pr_warn("CDP is an expert feature and may cause MPAM to malfunction.\n");
"fs/resctrl: Do not allocate a monitor context when releasing limbo RMIDs" is good
to have as robustness but if I understand current MPAM design this needs a small
GFP_KERNEL allocation to fail in the domain offline path, which in practice does not.
The two that stand out to me as stable candidates are:
"fs/resctrl: Report a temporary RMID shortage per CLOSID"
"fs/resctrl: Disallow monitor group move when the RMID index changes"
Could this series be re-ordered to start with the above two patches and only
they have "Cc: stable"? The remaining patches can keep their "Fixes:" tags.
Thank you.
Reinette
^ permalink raw reply [flat|nested] 9+ messages in thread