From: Jinjie Ruan <2118537295@qq.com>
To: babu.moger@amd.com, ben.horgan@arm.com, bp@alien8.de,
catalin.marinas@arm.com, dave.hansen@linux.intel.com,
Dave.Martin@arm.com, fenghuay@nvidia.com, gshan@redhat.com,
hpa@zytor.com, james.morse@arm.com, jic23@kernel.org,
mingo@redhat.com, reinette.chatre@intel.com,
ruanjinjie@huawei.com, tan.shaopeng@fujitsu.com, tglx@kernel.org,
tony.luck@intel.com, zengheng4@huawei.com, x86@kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v10 10/15] arm_mpam: Track the PARTID and internal PARTID limits per class
Date: Mon, 19 Oct 2026 15:33:36 +0800 [thread overview]
Message-ID: <tencent_A4124915CEC41FEBAD28A5294F8423BEDC0A@qq.com> (raw)
In-Reply-To: <20261019073453.2142856-1-2118537295@qq.com>
From: Jinjie Ruan <ruanjinjie@huawei.com>
The number of PARTIDs and PMGs a resource supports is global, and the
number of internal PARTIDs is not tracked at all. Tracking this per
class lets the resctrl glue code find the limits of the classes it will
use, and pick the number of control groups before it is initialised.
Resources that implement PARTID narrowing reduce msc->partid_max,
because they don't have one configuration per PARTID. Record the
internal PARTID limit alongside partid_max in struct mpam_props, and
take the smaller of the values a class's RIS advertise.
Cc: James Morse <james.morse@arm.com>
Cc: Ben Horgan <ben.horgan@arm.com>
Cc: Reinette Chatre <reinette.chatre@intel.com>
Cc: Fenghua Yu <fenghuay@nvidia.com>
Suggested-by: James Morse <james.morse@arm.com>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
v9->v10:
- Copy partid_max/intpartid_max on the first aliasing merge into a
zero-initialized parent instead of clamping to zero
---
drivers/resctrl/mpam_devices.c | 34 ++++++++++++++++++++++++---------
drivers/resctrl/mpam_internal.h | 2 ++
2 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
index a44d66a5733d..7f88a0170c05 100644
--- a/drivers/resctrl/mpam_devices.c
+++ b/drivers/resctrl/mpam_devices.c
@@ -793,7 +793,6 @@ static void mpam_ris_hw_probe(struct mpam_msc_ris *ris)
struct mpam_msc *msc = ris->vmsc->msc;
struct device *dev = &msc->pdev->dev;
struct mpam_props *props = &ris->props;
- struct mpam_class *class = ris->vmsc->comp->class;
lockdep_assert_held(&msc->probe_lock);
lockdep_assert_held(&msc->part_sel_lock);
@@ -938,18 +937,20 @@ static void mpam_ris_hw_probe(struct mpam_msc_ris *ris)
}
/*
- * RIS with PARTID narrowing don't have enough storage for one
- * configuration per PARTID. If these are in a class we could use,
- * reduce the supported partid_max to match the number of intpartid.
- * If the class is unknown, just ignore it.
+ * A RIS that implements PARTID narrowing has one configuration per
+ * internal PARTID, and several request PARTIDs share it. Record both
+ * limits in the resource properties.
*/
- if (FIELD_GET(MPAMF_IDR_HAS_PARTID_NRW, ris->idr) &&
- class->type != MPAM_CLASS_UNKNOWN) {
+ props->partid_max = msc->partid_max;
+ props->intpartid_max = msc->partid_max;
+
+ if (FIELD_GET(MPAMF_IDR_HAS_PARTID_NRW, ris->idr)) {
u32 nrwidr = mpam_read_partsel_reg(msc, PARTID_NRW_IDR);
- u16 partid_max = FIELD_GET(MPAMF_PARTID_NRW_IDR_INTPARTID_MAX, nrwidr);
+ u16 intpartid_max = FIELD_GET(MPAMF_PARTID_NRW_IDR_INTPARTID_MAX, nrwidr);
mpam_set_feature(mpam_feat_partid_nrw, props);
- msc->partid_max = min(msc->partid_max, partid_max);
+ props->intpartid_max = min(props->intpartid_max, intpartid_max);
+ msc->partid_max = min(msc->partid_max, intpartid_max);
}
}
@@ -2270,6 +2271,21 @@ static void __props_mismatch(struct mpam_props *parent,
child->num_mbwu_mon);
}
+ /*
+ * Take the smallest, so the result is safe for every RIS in the class.
+ * The first aliasing merge into a zero-initialized parent must copy
+ * the child's value, otherwise min() would clamp the limit to zero.
+ */
+ if (alias && !parent->partid_max)
+ parent->partid_max = child->partid_max;
+ else
+ parent->partid_max = min(parent->partid_max, child->partid_max);
+
+ if (alias && !parent->intpartid_max)
+ parent->intpartid_max = child->intpartid_max;
+ else
+ parent->intpartid_max = min(parent->intpartid_max, child->intpartid_max);
+
if (CAN_MERGE_FEAT(parent, child, mpam_feat_intpri_part, alias)) {
parent->intpri_wd = child->intpri_wd;
} else if (MISMATCHED_FEAT(parent, child, mpam_feat_intpri_part,
diff --git a/drivers/resctrl/mpam_internal.h b/drivers/resctrl/mpam_internal.h
index def0e3a65c23..0a2177241615 100644
--- a/drivers/resctrl/mpam_internal.h
+++ b/drivers/resctrl/mpam_internal.h
@@ -203,6 +203,8 @@ struct mpam_props {
u16 dspri_wd;
u16 num_csu_mon;
u16 num_mbwu_mon;
+ u16 partid_max;
+ u16 intpartid_max;
/*
* Kunit tests use memset() to set up feature combinations that should be
--
2.43.0
next prev parent reply other threads:[~2026-10-19 7:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20261019073453.2142856-1-2118537295@qq.com>
2026-10-19 7:33 ` [PATCH v10 01/15] fs/resctrl: Return -EBUSY when per-CLOSID RMIDs are in limbo Jinjie Ruan
2026-10-19 8:27 ` Jinjie Ruan
2026-10-19 7:33 ` [PATCH v10 02/15] fs/resctrl: Skip monitor context allocation when force-freeing RMIDs Jinjie Ruan
2026-10-19 7:33 ` [PATCH v10 03/15] arm_mpam: Fix error return in resctrl_arch_mon_ctx_alloc() Jinjie Ruan
2026-10-19 7:33 ` [PATCH v10 04/15] arm_mpam: Fix infinite PARTID reset loop when 65536 PARTIDs are supported Jinjie Ruan
2026-10-19 7:33 ` [PATCH v10 05/15] arm_mpam: Don't stall MPAM enable when an MSC fails to probe Jinjie Ruan
2026-10-19 7:33 ` [PATCH v10 06/15] fs/resctrl: Unmount resctrl with the CDP state it was mounted with Jinjie Ruan
2026-10-19 7:33 ` [PATCH v10 07/15] fs/resctrl: Add resctrl_arch_rmid_idx_match() helper Jinjie Ruan
2026-10-19 7:33 ` [PATCH v10 08/15] arm_mpam: resctrl: Add resctrl_closid_rmid_to_partid_pmg() helper Jinjie Ruan
2026-10-19 7:33 ` [PATCH v10 09/15] arm_mpam: Add a helper to check a PARTID is in a CLOSID Jinjie Ruan
2026-10-19 7:33 ` Jinjie Ruan [this message]
2026-10-19 7:33 ` [PATCH v10 11/15] arm_mpam: Divide the PARTIDs between the control groups Jinjie Ruan
2026-10-19 7:33 ` [PATCH v10 12/15] arm_mpam: Map resctrl RMIDs onto the request PARTIDs 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=tencent_A4124915CEC41FEBAD28A5294F8423BEDC0A@qq.com \
--to=2118537295@qq.com \
--cc=Dave.Martin@arm.com \
--cc=babu.moger@amd.com \
--cc=ben.horgan@arm.com \
--cc=bp@alien8.de \
--cc=catalin.marinas@arm.com \
--cc=dave.hansen@linux.intel.com \
--cc=fenghuay@nvidia.com \
--cc=gshan@redhat.com \
--cc=hpa@zytor.com \
--cc=james.morse@arm.com \
--cc=jic23@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=reinette.chatre@intel.com \
--cc=ruanjinjie@huawei.com \
--cc=tan.shaopeng@fujitsu.com \
--cc=tglx@kernel.org \
--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®