Skip to contentSkip to conversation

arm_mpam: Relax num_rmids parameter advertised to userspace

PATCH In review Dave Martin 3 participants 4 messages Aug 20, 2025 – Sep 8, 2025 arm64 platform drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm_mpam: Relax num_rmids parameter advertised to userspace

On MPAM systems, monitoring groups are identified in the hardware by a (PARTID, PMG) pair. Two monitoring group identifiers are the same only if the PARTIDs and PMGs both match. This means that the number of monitoring groups that can be created in each control group is the same as the number of distinct PMG values supported by the hardware. The number of monitoring groups that exist in other control groups at the same time makes no difference to this.

Currently, the MPAM driver takes the cautious approach and always num_rmids = 1.

Relax this limit, by advertising the number of distinct PMG values supported by the hardware.

Code/Data Prioritization (CDP) makes no difference, since although this doubles the number of (PARTID, PMG) pairs available to a control group, each monitoring group now consumes two pairs instead of one.

---

This patch is based on:

git://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git mpam/snapshot/v6.16-rc5

 drivers/platform/arm64/mpam/mpam_resctrl.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/platform/arm64/mpam/mpam_resctrl.c +10 -5
index f1e565cd1aac..f4f6fa9acfff 100644
@@ -1208,12 +1208,17 @@ static void mpam_resctrl_monitor_init(struct mpam_class *class,
 		/*
 		 * Unfortunately, num_rmid doesn't mean anything for
 		 * mpam, and its exposed to user-space!
-		 * num-rmid is supposed to mean the number of groups
-		 * that can be created, both control or monitor groups.
-		 * For mpam, each control group has its own pmg/rmid
-		 * space.
+		 *
+		 * num-rmid is supposed to mean the minimum number of
+		 * monitoring groups that can exist simultaneously, including
+		 * the default monitoring group for each control group.
+		 *
+		 * For mpam, each control group has its own pmg/rmid space, so
+		 * it is not appropriate to advertise the whole rmid_idx space
+		 * here.  But the pmgs corresponding to the parent control
+		 * group can be allocated freely:
 		 */
-		l3->num_rmid = 1;
+		l3->num_rmid = mpam_pmg_max + 1;
 
 		switch (type) {
 		case QOS_L3_MBM_LOCAL_EVENT_ID:

base-commit: b8e4905233fe45814b3c73be7e091f172cfb86ce

Signature · 1 line
2.34.1
#1 lore raw

Hi Dave,

Quoted 11 lines · Dave Martin

On MPAM systems, monitoring groups are identified in the hardware by a (PARTID, PMG) pair. Two monitoring group identifiers are the same only if the PARTIDs and PMGs both match. This means that the number of monitoring groups that can be created in each control group is the same as the number of distinct PMG values supported by the hardware. The number of monitoring groups that exist in other control groups at the same time makes no difference to this.

Currently, the MPAM driver takes the cautious approach and always num_rmids = 1.

Quoted 6 lines

Relax this limit, by advertising the number of distinct PMG values supported by the hardware.

Code/Data Prioritization (CDP) makes no difference, since although this doubles the number of (PARTID, PMG) pairs available to a control group, each monitoring group now consumes two pairs instead of one.

Thanks, I've picked this up. It may get squashed into the patch that adds these lines before going upstream...

Thanks,

James

#2 lore raw

Hi James,

Quoted 21 lines · James Morse

Hi Dave,

Quoted 11 lines · Dave Martin

On MPAM systems, monitoring groups are identified in the hardware by a (PARTID, PMG) pair. Two monitoring group identifiers are the same only if the PARTIDs and PMGs both match. This means that the number of monitoring groups that can be created in each control group is the same as the number of distinct PMG values supported by the hardware. The number of monitoring groups that exist in other control groups at the same time makes no difference to this.

Currently, the MPAM driver takes the cautious approach and always num_rmids = 1.

Quoted 6 lines

Relax this limit, by advertising the number of distinct PMG values supported by the hardware.

Code/Data Prioritization (CDP) makes no difference, since although this doubles the number of (PARTID, PMG) pairs available to a control group, each monitoring group now consumes two pairs instead of one.

Quoted 7 lines

Thanks, I've picked this up. It may get squashed into the patch that adds these lines before going upstream...

Thanks,

James

Thanks for picking this up.

Will that be in the next snapshot?

Cheers
---Dave

Quoted 1 line
Reviewed-by Shaopeng Tan on v1 1/1
#3 lore raw
In reply to Dave Martin
Quoted 61 lines

On MPAM systems, monitoring groups are identified in the hardware by a (PARTID, PMG) pair. Two monitoring group identifiers are the same only if the PARTIDs and PMGs both match. This means that the number of monitoring groups that can be created in each control group is the same as the number of distinct PMG values supported by the hardware. The number of monitoring groups that exist in other control groups at the same time makes no difference to this.

Currently, the MPAM driver takes the cautious approach and always num_rmids = 1.

Relax this limit, by advertising the number of distinct PMG values supported by the hardware.

Code/Data Prioritization (CDP) makes no difference, since although this doubles the number of (PARTID, PMG) pairs available to a control group, each monitoring group now consumes two pairs instead of one.

---

This patch is based on:

git://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git
mpam/snapshot/v6.16-rc5

 drivers/platform/arm64/mpam/mpam_resctrl.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/platform/arm64/mpam/mpam_resctrl.c +6 -4
index f1e565cd1aac..f4f6fa9acfff 100644
@@ -1208,12 +1208,17 @@ static void mpam_resctrl_monitor_init(struct
 mpam_class *class,
 		/*
 		 * Unfortunately, num_rmid doesn't mean anything for
 		 * mpam, and its exposed to user-space!
-		 * num-rmid is supposed to mean the number of groups
-		 * that can be created, both control or monitor groups.
-		 * For mpam, each control group has its own pmg/rmid
-		 * space.
+		 *
+		 * num-rmid is supposed to mean the minimum number of
+		 * monitoring groups that can exist simultaneously, including
+		 * the default monitoring group for each control group.
+		 *
+		 * For mpam, each control group has its own pmg/rmid space,

so

drivers/platform/arm64/mpam/mpam_resctrl.c +4 -1
+		 * it is not appropriate to advertise the whole rmid_idx space
+		 * here.  But the pmgs corresponding to the parent control
+		 * group can be allocated freely:
 		 */
-		l3->num_rmid = 1;
+		l3->num_rmid = mpam_pmg_max + 1;
 
 		switch (type) {
 		case QOS_L3_MBM_LOCAL_EVENT_ID:
Quoted 3 lines

base-commit: b8e4905233fe45814b3c73be7e091f172cfb86ce --
2.34.1

Thanks,
Shaopeng TAN