mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Martin <Dave.Martin@arm.com>
To: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
	James Morse <james.morse@arm.com>,
	Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Subject: [PATCH] arm_mpam: Relax num_rmids parameter advertised to userspace
Date: Wed, 20 Aug 2025 14:15:21 +0100	[thread overview]
Message-ID: <20250820131621.54983-1-Dave.Martin@arm.com> (raw)

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.

Suggested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
---

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(-)

diff --git a/drivers/platform/arm64/mpam/mpam_resctrl.c b/drivers/platform/arm64/mpam/mpam_resctrl.c
index f1e565cd1aac..f4f6fa9acfff 100644
--- a/drivers/platform/arm64/mpam/mpam_resctrl.c
+++ b/drivers/platform/arm64/mpam/mpam_resctrl.c
@@ -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
-- 
2.34.1


             reply	other threads:[~2025-08-20 13:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-20 13:15 Dave Martin [this message]
2025-08-27 17:16 ` James Morse
2025-08-29 12:26   ` Dave Martin
2025-09-08  8:31 ` Shaopeng Tan (Fujitsu)

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=20250820131621.54983-1-Dave.Martin@arm.com \
    --to=dave.martin@arm.com \
    --cc=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tan.shaopeng@jp.fujitsu.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®