source
large_stringclasses 2
values | subject
large_stringclasses 112
values | code
large_stringclasses 112
values | critique
large_stringlengths 61
3.04M
⌀ | metadata
dict |
|---|---|---|---|---|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
From: James Morse <james.morse@arm.com>
When there are not enough monitors, MPAM is able to emulate ABMC by making
a smaller number of monitors assignable. These monitors still need to be
allocated from the driver, and mapped to whichever control/monitor group
resctrl wants to use them with.
Add a second array to hold the monitor values indexed by resctrl's cntr_id.
When CDP is in use, two monitors are needed so the available number of
counters halves. Platforms with one monitor will have zero monitors when
CDP is in use.
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
---
Changes since rfc:
Move __free
kmalloc -> kcalloc
Changes since v2:
kcalloc -> kmalloc_array
sizeof(*rmid_array)
Return error from resctrl_arch_mbm_cntr_assign_set()
---
drivers/resctrl/mpam_internal.h | 7 +++
drivers/resctrl/mpam_resctrl.c | 97 +++++++++++++++++++++++++++++++++
2 files changed, 104 insertions(+)
diff --git a/drivers/resctrl/mpam_internal.h b/drivers/resctrl/mpam_internal.h
index 89f9d374ded0..58076abd5de3 100644
--- a/drivers/resctrl/mpam_internal.h
+++ b/drivers/resctrl/mpam_internal.h
@@ -367,6 +367,13 @@ struct mpam_resctrl_mon {
* un-assigned (closid, rmid) are -1.
*/
int *mbwu_idx_to_mon;
+
+ /*
+ * Array of assigned MBWU monitors, indexed by idx argument.
+ * When ABMC is not in use, this array can be NULL. Otherwise
+ * it maps idx to the allocated monitor.
+ */
+ int *assigned_counters;
};
static inline int mpam_alloc_csu_mon(struct mpam_class *class)
diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index 3af12ad77fba..2a9efc6c6fae 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -68,6 +68,12 @@ static bool cdp_enabled;
static bool cacheinfo_ready;
static DECLARE_WAIT_QUEUE_HEAD(wait_cacheinfo_ready);
+/*
+ * L3 local/total may come from different classes - what is the number of MBWU
+ * 'on L3'?
+ */
+static unsigned int l3_num_allocated_mbwu = ~0;
+
/* Whether this num_mbw_mon could result in a free_running system */
static int __mpam_monitors_free_running(u16 num_mbwu_mon)
{
@@ -76,6 +82,15 @@ static int __mpam_monitors_free_running(u16 num_mbwu_mon)
return 0;
}
+/*
+ * If l3_num_allocated_mbwu is forced below PARTID * PMG, then the counters
+ * are not free running, and ABMC's user-interface must be used to assign them.
+ */
+static bool mpam_resctrl_abmc_enabled(void)
+{
+ return l3_num_allocated_mbwu < resctrl_arch_system_num_rmid_idx();
+}
+
bool resctrl_arch_alloc_capable(void)
{
return exposed_alloc_capable;
@@ -120,9 +135,26 @@ static void resctrl_reset_task_closids(void)
read_unlock(&tasklist_lock);
}
+static void mpam_resctrl_monitor_sync_abmc_vals(struct rdt_resource *l3)
+{
+ l3->mon.num_mbm_cntrs = l3_num_allocated_mbwu;
+ if (cdp_enabled)
+ l3->mon.num_mbm_cntrs /= 2;
+
+ if (l3->mon.num_mbm_cntrs) {
+ l3->mon.mbm_cntr_assignable = mpam_resctrl_abmc_enabled();
+ l3->mon.mbm_assign_on_mkdir = mpam_resctrl_abmc_enabled();
+ } else {
+ l3->mon.mbm_cntr_assignable = false;
+ l3->mon.mbm_assign_on_mkdir = false;
+ }
+}
+
int resctrl_arch_set_cdp_enabled(enum resctrl_res_level ignored, bool enable)
{
u32 partid_i = RESCTRL_RESERVED_CLOSID, partid_d = RESCTRL_RESERVED_CLOSID;
+ struct mpam_resctrl_res *res = &mpam_resctrl_controls[RDT_RESOURCE_L3];
+ struct rdt_resource *l3 = &res->resctrl_res;
cdp_enabled = enable;
@@ -138,6 +170,7 @@ int resctrl_arch_set_cdp_enabled(enum resctrl_res_level ignored, bool enable)
WRITE_ONCE(arm64_mpam_global_default, mpam_get_regval(current));
resctrl_reset_task_closids();
+ mpam_resctrl_monitor_sync_abmc_vals(l3);
return 0;
}
@@ -321,6 +354,11 @@ static bool class_has_usable_mbwu(struct mpam_class *class)
return true;
}
+ if (cprops->num_mbwu_mon) {
+ pr_debug("monitors usable via ABMC assignment\n");
+ return true;
+ }
+
return false;
}
@@ -597,6 +635,8 @@ static int __alloc_mbwu_mon(struct mpam_class *class, int *array,
array[i] = mbwu_mon;
}
+ l3_num_allocated_mbwu = min(l3_num_allocated_mbwu, num_mbwu_mon);
+
return 0;
}
@@ -736,6 +776,19 @@ static void mpam_resctrl_pick_counters(void)
mpam_resctrl_counters[QOS_L3_MBM_TOTAL_EVENT_ID].class);
}
+bool resctrl_arch_mbm_cntr_assign_enabled(struct rdt_resource *r)
+{
+ if (r != &mpam_resctrl_controls[RDT_RESOURCE_L3].resctrl_res)
+ return false;
+
+ return mpam_resctrl_abmc_enabled();
+}
+
+int resctrl_arch_mbm_cntr_assign_set(struct rdt_resource *r, bool enable)
+{
+ return -EINVAL;
+}
+
static int mpam_resctrl_control_init(struct mpam_resctrl_res *res)
{
struct mpam_class *class = res->class;
@@ -811,6 +864,42 @@ static int mpam_resctrl_pick_domain_id(int cpu, struct mpam_component *comp)
return comp->comp_id;
}
+/*
+ * This must run after all event counters have been picked so that any free
+ * running counters have already been allocated.
+ */
+static int mpam_resctrl_monitor_init_abmc(struct mpam_resctrl_mon *mon)
+{
+ struct mpam_resctrl_res *res = &mpam_resctrl_controls[RDT_RESOURCE_L3];
+ struct rdt_resource *l3 = &res->resctrl_res;
+ struct mpam_class *class = mon->class;
+ u16 num_mbwu_mon;
+
+ if (mon->mbwu_idx_to_mon) {
+ pr_debug("monitors free running\n");
+ return 0;
+ }
+
+ int *rmid_array __free(kfree) =
+ kmalloc_array(resctrl_arch_system_num_rmid_idx(), sizeof(*rmid_array), GFP_KERNEL);
+
+ if (!rmid_array) {
+ pr_debug("Failed to allocate RMID array\n");
+ return -ENOMEM;
+ }
+ memset(rmid_array, -1, resctrl_arch_system_num_rmid_idx() * sizeof(int));
+
+ num_mbwu_mon = class->props.num_mbwu_mon;
+ mon->assigned_counters = __alloc_mbwu_array(mon->class, num_mbwu_mon);
+ if (IS_ERR(mon->assigned_counters))
+ return PTR_ERR(mon->assigned_counters);
+ mon->mbwu_idx_to_mon = no_free_ptr(rmid_array);
+
+ mpam_resctrl_monitor_sync_abmc_vals(l3);
+
+ return 0;
+}
+
static int mpam_resctrl_monitor_init(struct mpam_resctrl_mon *mon,
enum resctrl_event_id type)
{
@@ -857,6 +946,14 @@ static int mpam_resctrl_monitor_init(struct mpam_resctrl_mon *mon,
* group can be allocated freely:
*/
l3->mon.num_rmid = mpam_pmg_max + 1;
+
+ switch (type) {
+ case QOS_L3_MBM_LOCAL_EVENT_ID:
+ case QOS_L3_MBM_TOTAL_EVENT_ID:
+ return mpam_resctrl_monitor_init_abmc(mon);
+ default:
+ return 0;
+ }
}
return 0;
--
2.43.0
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 12 Jan 2026 16:58:58 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
From: James Morse <james.morse@arm.com>
ABMC exposes a fun corner case where a platform with one monitor can use
ABMC for assignable counters - but not when CDP is enabled.
Add some tests.
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
---
drivers/resctrl/test_mpam_resctrl.c | 62 +++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
diff --git a/drivers/resctrl/test_mpam_resctrl.c b/drivers/resctrl/test_mpam_resctrl.c
index a20da161d965..fd63f7bbb147 100644
--- a/drivers/resctrl/test_mpam_resctrl.c
+++ b/drivers/resctrl/test_mpam_resctrl.c
@@ -344,6 +344,67 @@ static void test_rmid_idx_encoding(struct kunit *test)
mpam_pmg_max = orig_mpam_pmg_max;
}
+static void test_num_assignable_counters(struct kunit *test)
+{
+ unsigned int orig_l3_num_allocated_mbwu = l3_num_allocated_mbwu;
+ u32 orig_mpam_partid_max = mpam_partid_max;
+ u32 orig_mpam_pmg_max = mpam_pmg_max;
+ bool orig_cdp_enabled = cdp_enabled;
+ struct rdt_resource fake_l3;
+
+ /* Force there to be some PARTID/PMG */
+ mpam_partid_max = 3;
+ mpam_pmg_max = 1;
+
+ cdp_enabled = false;
+
+ /* ABMC off, CDP off */
+ l3_num_allocated_mbwu = resctrl_arch_system_num_rmid_idx();
+ mpam_resctrl_monitor_sync_abmc_vals(&fake_l3);
+ KUNIT_EXPECT_EQ(test, fake_l3.mon.num_mbm_cntrs, resctrl_arch_system_num_rmid_idx());
+ KUNIT_EXPECT_FALSE(test, fake_l3.mon.mbm_cntr_assignable);
+ KUNIT_EXPECT_FALSE(test, fake_l3.mon.mbm_assign_on_mkdir);
+
+ /* ABMC on, CDP off */
+ l3_num_allocated_mbwu = 4;
+ mpam_resctrl_monitor_sync_abmc_vals(&fake_l3);
+ KUNIT_EXPECT_EQ(test, fake_l3.mon.num_mbm_cntrs, 4);
+ KUNIT_EXPECT_TRUE(test, fake_l3.mon.mbm_cntr_assignable);
+ KUNIT_EXPECT_TRUE(test, fake_l3.mon.mbm_assign_on_mkdir);
+
+ cdp_enabled = true;
+
+ /* ABMC off, CDP on */
+ l3_num_allocated_mbwu = resctrl_arch_system_num_rmid_idx();
+ mpam_resctrl_monitor_sync_abmc_vals(&fake_l3);
+
+ /* (value not consumed by resctrl) */
+ KUNIT_EXPECT_EQ(test, fake_l3.mon.num_mbm_cntrs, resctrl_arch_system_num_rmid_idx() / 2);
+
+ KUNIT_EXPECT_FALSE(test, fake_l3.mon.mbm_cntr_assignable);
+ KUNIT_EXPECT_FALSE(test, fake_l3.mon.mbm_assign_on_mkdir);
+
+ /* ABMC on, CDP on */
+ l3_num_allocated_mbwu = 4;
+ mpam_resctrl_monitor_sync_abmc_vals(&fake_l3);
+ KUNIT_EXPECT_EQ(test, fake_l3.mon.num_mbm_cntrs, 2);
+ KUNIT_EXPECT_TRUE(test, fake_l3.mon.mbm_cntr_assignable);
+ KUNIT_EXPECT_TRUE(test, fake_l3.mon.mbm_assign_on_mkdir);
+
+ /* ABMC 'on', CDP on - but not enough counters */
+ l3_num_allocated_mbwu = 1;
+ mpam_resctrl_monitor_sync_abmc_vals(&fake_l3);
+ KUNIT_EXPECT_EQ(test, fake_l3.mon.num_mbm_cntrs, 0);
+ KUNIT_EXPECT_FALSE(test, fake_l3.mon.mbm_cntr_assignable);
+ KUNIT_EXPECT_FALSE(test, fake_l3.mon.mbm_assign_on_mkdir);
+
+ /* Restore global variables that were messed with */
+ l3_num_allocated_mbwu = orig_l3_num_allocated_mbwu;
+ mpam_partid_max = orig_mpam_partid_max;
+ mpam_pmg_max = orig_mpam_pmg_max;
+ cdp_enabled = orig_cdp_enabled;
+}
+
static struct kunit_case mpam_resctrl_test_cases[] = {
KUNIT_CASE(test_get_mba_granularity),
KUNIT_CASE_PARAM(test_mbw_max_to_percent, test_percent_value_gen_params),
@@ -353,6 +414,7 @@ static struct kunit_case mpam_resctrl_test_cases[] = {
KUNIT_CASE_PARAM(test_percent_max_roundtrip_stability,
test_all_bwa_wd_gen_params),
KUNIT_CASE_PARAM(test_rmid_idx_encoding, test_rmid_idx_gen_params),
+ KUNIT_CASE(test_num_assignable_counters),
{}
};
--
2.43.0
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 12 Jan 2026 16:58:59 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
From: James Morse <james.morse@arm.com>
ABMC has a helper resctrl_arch_config_cntr() for changing the mapping
between 'cntr_id' and a CLOSID/RMID pair.
Add the helper.
For MPAM this is done by updating the mon->mbwu_idx_to_mon[] array, and as
usual CDP means it needs doing in three different ways.
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
---
drivers/resctrl/mpam_resctrl.c | 37 ++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index 2a9efc6c6fae..9198af3221d5 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -776,6 +776,43 @@ static void mpam_resctrl_pick_counters(void)
mpam_resctrl_counters[QOS_L3_MBM_TOTAL_EVENT_ID].class);
}
+static void __config_cntr(struct mpam_resctrl_mon *mon, u32 cntr_id,
+ enum resctrl_conf_type cdp_type, u32 closid, u32 rmid,
+ bool assign)
+{
+ u32 mbwu_idx, mon_idx = resctrl_get_config_index(cntr_id, cdp_type);
+
+ closid = resctrl_get_config_index(closid, cdp_type);
+ mbwu_idx = resctrl_arch_rmid_idx_encode(closid, rmid);
+ WARN_ON_ONCE(mon_idx > l3_num_allocated_mbwu);
+
+ if (assign)
+ mon->mbwu_idx_to_mon[mbwu_idx] = mon->assigned_counters[mon_idx];
+ else
+ mon->mbwu_idx_to_mon[mbwu_idx] = -1;
+}
+
+void resctrl_arch_config_cntr(struct rdt_resource *r, struct rdt_mon_domain *d,
+ enum resctrl_event_id evtid, u32 rmid, u32 closid,
+ u32 cntr_id, bool assign)
+{
+ struct mpam_resctrl_mon *mon = &mpam_resctrl_counters[evtid];
+
+ if (!mon->mbwu_idx_to_mon || !mon->assigned_counters) {
+ pr_debug("monitor arrays not allocated\n");
+ return;
+ }
+
+ if (cdp_enabled) {
+ __config_cntr(mon, cntr_id, CDP_CODE, closid, rmid, assign);
+ __config_cntr(mon, cntr_id, CDP_DATA, closid, rmid, assign);
+ } else {
+ __config_cntr(mon, cntr_id, CDP_NONE, closid, rmid, assign);
+ }
+
+ resctrl_arch_reset_rmid(r, d, closid, rmid, evtid);
+}
+
bool resctrl_arch_mbm_cntr_assign_enabled(struct rdt_resource *r)
{
if (r != &mpam_resctrl_controls[RDT_RESOURCE_L3].resctrl_res)
--
2.43.0
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 12 Jan 2026 16:59:00 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
From: James Morse <james.morse@arm.com>
When resctrl wants to read a domain's 'QOS_L3_OCCUP', it needs to allocate
a monitor on the corresponding resource. Monitors are allocated by class
instead of component.
MBM monitors are much more complicated, if there are enough monitors, they
will be pre-allocated and free-running. If ABMC is in use instead then
'some' are pre-allocated in a different way, and need assigning.
Add helpers to allocate a CSU monitor. These helper return an out of range
value for MBM counters.
Allocating a montitor context is expected to block until hardware resources
become available. This only makes sense for QOS_L3_OCCUP as unallocated MBM
counters are losing data.
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
---
Changes since rfc:
USE_RMID_IDX -> USE_PRE_ALLOCATED in comment
Remove unnecessary arch_mon_ctx = NULL
Changes since v2:
Add include of resctrl_types.h as dropped from earlier patch
---
drivers/resctrl/mpam_internal.h | 14 ++++++-
drivers/resctrl/mpam_resctrl.c | 67 +++++++++++++++++++++++++++++++++
include/linux/arm_mpam.h | 5 +++
3 files changed, 85 insertions(+), 1 deletion(-)
diff --git a/drivers/resctrl/mpam_internal.h b/drivers/resctrl/mpam_internal.h
index 58076abd5de3..8f73528414af 100644
--- a/drivers/resctrl/mpam_internal.h
+++ b/drivers/resctrl/mpam_internal.h
@@ -29,6 +29,14 @@ struct platform_device;
#define PACKED_FOR_KUNIT
#endif
+/*
+ * This 'mon' values must not alias an actual monitor, so must be larger than
+ * U16_MAX, but not be confused with an errno value, so smaller than
+ * (u32)-SZ_4K.
+ * USE_PRE_ALLOCATED is used to avoid confusion with an actual monitor.
+ */
+#define USE_PRE_ALLOCATED (U16_MAX + 1)
+
static inline bool mpam_is_enabled(void)
{
return static_branch_likely(&mpam_enabled);
@@ -216,7 +224,11 @@ enum mon_filter_options {
};
struct mon_cfg {
- u16 mon;
+ /*
+ * mon must be large enough to hold out of range values like
+ * USE_PRE_ALLOCATED
+ */
+ u32 mon;
u8 pmg;
bool match_pmg;
bool csu_exclude_clean;
diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index 9198af3221d5..c01419c1a381 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -22,6 +22,8 @@
#include "mpam_internal.h"
+DECLARE_WAIT_QUEUE_HEAD(resctrl_mon_ctx_waiters);
+
/*
* The classes we've picked to map to resctrl resources, wrapped
* in with their resctrl structure.
@@ -293,6 +295,71 @@ struct rdt_resource *resctrl_arch_get_resource(enum resctrl_res_level l)
return &mpam_resctrl_controls[l].resctrl_res;
}
+static int resctrl_arch_mon_ctx_alloc_no_wait(enum resctrl_event_id evtid)
+{
+ struct mpam_resctrl_mon *mon = &mpam_resctrl_counters[evtid];
+
+ if (!mon->class)
+ return -EINVAL;
+
+ switch (evtid) {
+ case QOS_L3_OCCUP_EVENT_ID:
+ /* With CDP, one monitor gets used for both code/data reads */
+ return mpam_alloc_csu_mon(mon->class);
+ case QOS_L3_MBM_LOCAL_EVENT_ID:
+ case QOS_L3_MBM_TOTAL_EVENT_ID:
+ return USE_PRE_ALLOCATED;
+ default:
+ return -EOPNOTSUPP;
+ }
+}
+
+void *resctrl_arch_mon_ctx_alloc(struct rdt_resource *r,
+ enum resctrl_event_id evtid)
+{
+ DEFINE_WAIT(wait);
+ int *ret;
+
+ ret = kmalloc(sizeof(*ret), GFP_KERNEL);
+ if (!ret)
+ return ERR_PTR(-ENOMEM);
+
+ do {
+ prepare_to_wait(&resctrl_mon_ctx_waiters, &wait,
+ TASK_INTERRUPTIBLE);
+ *ret = resctrl_arch_mon_ctx_alloc_no_wait(evtid);
+ if (*ret == -ENOSPC)
+ schedule();
+ } while (*ret == -ENOSPC && !signal_pending(current));
+ finish_wait(&resctrl_mon_ctx_waiters, &wait);
+
+ return ret;
+}
+
+static void resctrl_arch_mon_ctx_free_no_wait(enum resctrl_event_id evtid,
+ u32 mon_idx)
+{
+ struct mpam_resctrl_mon *mon = &mpam_resctrl_counters[evtid];
+
+ if (!mon->class)
+ return;
+
+ if (evtid == QOS_L3_OCCUP_EVENT_ID)
+ mpam_free_csu_mon(mon->class, mon_idx);
+
+ wake_up(&resctrl_mon_ctx_waiters);
+}
+
+void resctrl_arch_mon_ctx_free(struct rdt_resource *r,
+ enum resctrl_event_id evtid, void *arch_mon_ctx)
+{
+ u32 mon_idx = *(u32 *)arch_mon_ctx;
+
+ kfree(arch_mon_ctx);
+
+ resctrl_arch_mon_ctx_free_no_wait(evtid, mon_idx);
+}
+
static bool cache_has_usable_cpor(struct mpam_class *class)
{
struct mpam_props *cprops = &class->props;
diff --git a/include/linux/arm_mpam.h b/include/linux/arm_mpam.h
index 7d23c90f077d..e1461e32af75 100644
--- a/include/linux/arm_mpam.h
+++ b/include/linux/arm_mpam.h
@@ -5,6 +5,7 @@
#define __LINUX_ARM_MPAM_H
#include <linux/acpi.h>
+#include <linux/resctrl_types.h>
#include <linux/types.h>
struct mpam_msc;
@@ -62,6 +63,10 @@ u32 resctrl_arch_rmid_idx_encode(u32 closid, u32 rmid);
void resctrl_arch_rmid_idx_decode(u32 idx, u32 *closid, u32 *rmid);
u32 resctrl_arch_system_num_rmid_idx(void);
+struct rdt_resource;
+void *resctrl_arch_mon_ctx_alloc(struct rdt_resource *r, enum resctrl_event_id evtid);
+void resctrl_arch_mon_ctx_free(struct rdt_resource *r, enum resctrl_event_id evtid, void *ctx);
+
/**
* mpam_register_requestor() - Register a requestor with the MPAM driver
* @partid_max: The maximum PARTID value the requestor can generate.
--
2.43.0
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 12 Jan 2026 16:59:01 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
From: James Morse <james.morse@arm.com>
resctrl uses resctrl_arch_rmid_read() to read counters. CDP emulation means
the counter may need reading in three different ways. The same goes for
reset.
The helpers behind the resctrl_arch_ functions will be re-used for the ABMC
equivalent functions.
Add the rounding helper for checking monitor values while we're here.
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
---
Changes since rfc:
cfg intialisation style
code flow at end of read_mon_cdp_safe()
Changes since v2:
Whitespace changes
---
drivers/resctrl/mpam_resctrl.c | 158 +++++++++++++++++++++++++++++++++
include/linux/arm_mpam.h | 5 ++
2 files changed, 163 insertions(+)
diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index c01419c1a381..921be9b53c00 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -360,6 +360,164 @@ void resctrl_arch_mon_ctx_free(struct rdt_resource *r,
resctrl_arch_mon_ctx_free_no_wait(evtid, mon_idx);
}
+static int __read_mon(struct mpam_resctrl_mon *mon, struct mpam_component *mon_comp,
+ enum mpam_device_features mon_type,
+ int mon_idx,
+ enum resctrl_conf_type cdp_type, u32 closid, u32 rmid, u64 *val)
+{
+ struct mon_cfg cfg;
+
+ if (!mpam_is_enabled())
+ return -EINVAL;
+
+ /* Shift closid to account for CDP */
+ closid = resctrl_get_config_index(closid, cdp_type);
+
+ if (mon_idx == USE_PRE_ALLOCATED) {
+ int mbwu_idx = resctrl_arch_rmid_idx_encode(closid, rmid);
+
+ mon_idx = mon->mbwu_idx_to_mon[mbwu_idx];
+ if (mon_idx == -1) {
+ if (mpam_resctrl_abmc_enabled()) {
+ /* Report Unassigned */
+ return -ENOENT;
+ }
+ /* Report Unavailable */
+ return -EINVAL;
+ }
+ }
+
+ if (irqs_disabled()) {
+ /* Check if we can access this domain without an IPI */
+ return -EIO;
+ }
+
+ cfg = (struct mon_cfg) {
+ .mon = mon_idx,
+ .match_pmg = true,
+ .partid = closid,
+ .pmg = rmid,
+ };
+
+ return mpam_msmon_read(mon_comp, &cfg, mon_type, val);
+}
+
+static int read_mon_cdp_safe(struct mpam_resctrl_mon *mon, struct mpam_component *mon_comp,
+ enum mpam_device_features mon_type,
+ int mon_idx, u32 closid, u32 rmid, u64 *val)
+{
+ if (cdp_enabled) {
+ u64 code_val = 0, data_val = 0;
+ int err;
+
+ err = __read_mon(mon, mon_comp, mon_type, mon_idx,
+ CDP_CODE, closid, rmid, &code_val);
+ if (err)
+ return err;
+
+ err = __read_mon(mon, mon_comp, mon_type, mon_idx,
+ CDP_DATA, closid, rmid, &data_val);
+ if (err)
+ return err;
+
+ *val += code_val + data_val;
+ return 0;
+ }
+
+ return __read_mon(mon, mon_comp, mon_type, mon_idx,
+ CDP_NONE, closid, rmid, val);
+}
+
+/* MBWU when not in ABMC mode, and CSU counters. */
+int resctrl_arch_rmid_read(struct rdt_resource *r, struct rdt_mon_domain *d,
+ u32 closid, u32 rmid, enum resctrl_event_id eventid,
+ u64 *val, void *arch_mon_ctx)
+{
+ struct mpam_resctrl_dom *l3_dom;
+ struct mpam_component *mon_comp;
+ u32 mon_idx = *(u32 *)arch_mon_ctx;
+ enum mpam_device_features mon_type;
+ struct mpam_resctrl_mon *mon = &mpam_resctrl_counters[eventid];
+
+ resctrl_arch_rmid_read_context_check();
+
+ if (eventid >= QOS_NUM_EVENTS || !mon->class)
+ return -EINVAL;
+
+ l3_dom = container_of(d, struct mpam_resctrl_dom, resctrl_mon_dom);
+ mon_comp = l3_dom->mon_comp[eventid];
+
+ switch (eventid) {
+ case QOS_L3_OCCUP_EVENT_ID:
+ mon_type = mpam_feat_msmon_csu;
+ break;
+ case QOS_L3_MBM_LOCAL_EVENT_ID:
+ case QOS_L3_MBM_TOTAL_EVENT_ID:
+ mon_type = mpam_feat_msmon_mbwu;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ return read_mon_cdp_safe(mon, mon_comp, mon_type, mon_idx,
+ closid, rmid, val);
+}
+
+static void __reset_mon(struct mpam_resctrl_mon *mon, struct mpam_component *mon_comp,
+ int mon_idx,
+ enum resctrl_conf_type cdp_type, u32 closid, u32 rmid)
+{
+ struct mon_cfg cfg = { };
+
+ if (!mpam_is_enabled())
+ return;
+
+ /* Shift closid to account for CDP */
+ closid = resctrl_get_config_index(closid, cdp_type);
+
+ if (mon_idx == USE_PRE_ALLOCATED) {
+ int mbwu_idx = resctrl_arch_rmid_idx_encode(closid, rmid);
+ mon_idx = mon->mbwu_idx_to_mon[mbwu_idx];
+ }
+
+ if (mon_idx == -1)
+ return;
+ cfg.mon = mon_idx;
+ mpam_msmon_reset_mbwu(mon_comp, &cfg);
+}
+
+static void reset_mon_cdp_safe(struct mpam_resctrl_mon *mon, struct mpam_component *mon_comp,
+ int mon_idx, u32 closid, u32 rmid)
+{
+ if (cdp_enabled) {
+ __reset_mon(mon, mon_comp, mon_idx, CDP_CODE, closid, rmid);
+ __reset_mon(mon, mon_comp, mon_idx, CDP_DATA, closid, rmid);
+ } else {
+ __reset_mon(mon, mon_comp, mon_idx, CDP_NONE, closid, rmid);
+ }
+}
+
+/* Called via IPI. Call with read_cpus_lock() held. */
+void resctrl_arch_reset_rmid(struct rdt_resource *r, struct rdt_mon_domain *d,
+ u32 closid, u32 rmid, enum resctrl_event_id eventid)
+{
+ struct mpam_resctrl_dom *l3_dom;
+ struct mpam_component *mon_comp;
+ struct mpam_resctrl_mon *mon = &mpam_resctrl_counters[eventid];
+
+ if (!mpam_is_enabled())
+ return;
+
+ /* Only MBWU counters are relevant, and for supported event types. */
+ if (eventid == QOS_L3_OCCUP_EVENT_ID || !mon->class)
+ return;
+
+ l3_dom = container_of(d, struct mpam_resctrl_dom, resctrl_mon_dom);
+ mon_comp = l3_dom->mon_comp[eventid];
+
+ reset_mon_cdp_safe(mon, mon_comp, USE_PRE_ALLOCATED, closid, rmid);
+}
+
static bool cache_has_usable_cpor(struct mpam_class *class)
{
struct mpam_props *cprops = &class->props;
diff --git a/include/linux/arm_mpam.h b/include/linux/arm_mpam.h
index e1461e32af75..86d5e326d2bd 100644
--- a/include/linux/arm_mpam.h
+++ b/include/linux/arm_mpam.h
@@ -67,6 +67,11 @@ struct rdt_resource;
void *resctrl_arch_mon_ctx_alloc(struct rdt_resource *r, enum resctrl_event_id evtid);
void resctrl_arch_mon_ctx_free(struct rdt_resource *r, enum resctrl_event_id evtid, void *ctx);
+static inline unsigned int resctrl_arch_round_mon_val(unsigned int val)
+{
+ return val;
+}
+
/**
* mpam_register_requestor() - Register a requestor with the MPAM driver
* @partid_max: The maximum PARTID value the requestor can generate.
--
2.43.0
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 12 Jan 2026 16:59:02 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
From: James Morse <james.morse@arm.com>
When used in ABMC mode, resctrl uses a different set of helpers to read and
reset the counters.
Add these.
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
---
drivers/resctrl/mpam_resctrl.c | 43 ++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index 921be9b53c00..5adc78f9c96f 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -463,6 +463,28 @@ int resctrl_arch_rmid_read(struct rdt_resource *r, struct rdt_mon_domain *d,
closid, rmid, val);
}
+/* MBWU counters when in ABMC mode */
+int resctrl_arch_cntr_read(struct rdt_resource *r, struct rdt_mon_domain *d,
+ u32 closid, u32 rmid, int mon_idx,
+ enum resctrl_event_id eventid, u64 *val)
+{
+ struct mpam_resctrl_mon *mon = &mpam_resctrl_counters[eventid];
+ struct mpam_resctrl_dom *l3_dom;
+ struct mpam_component *mon_comp;
+
+ if (!mpam_is_enabled())
+ return -EINVAL;
+
+ if (eventid == QOS_L3_OCCUP_EVENT_ID || !mon->class)
+ return -EINVAL;
+
+ l3_dom = container_of(d, struct mpam_resctrl_dom, resctrl_mon_dom);
+ mon_comp = l3_dom->mon_comp[eventid];
+
+ return read_mon_cdp_safe(mon, mon_comp, mpam_feat_msmon_mbwu, mon_idx,
+ closid, rmid, val);
+}
+
static void __reset_mon(struct mpam_resctrl_mon *mon, struct mpam_component *mon_comp,
int mon_idx,
enum resctrl_conf_type cdp_type, u32 closid, u32 rmid)
@@ -518,6 +540,27 @@ void resctrl_arch_reset_rmid(struct rdt_resource *r, struct rdt_mon_domain *d,
reset_mon_cdp_safe(mon, mon_comp, USE_PRE_ALLOCATED, closid, rmid);
}
+/* Reset an assigned counter */
+void resctrl_arch_reset_cntr(struct rdt_resource *r, struct rdt_mon_domain *d,
+ u32 closid, u32 rmid, int cntr_id,
+ enum resctrl_event_id eventid)
+{
+ struct mpam_resctrl_mon *mon = &mpam_resctrl_counters[eventid];
+ struct mpam_resctrl_dom *l3_dom;
+ struct mpam_component *mon_comp;
+
+ if (!mpam_is_enabled())
+ return;
+
+ if (eventid == QOS_L3_OCCUP_EVENT_ID || !mon->class)
+ return;
+
+ l3_dom = container_of(d, struct mpam_resctrl_dom, resctrl_mon_dom);
+ mon_comp = l3_dom->mon_comp[eventid];
+
+ reset_mon_cdp_safe(mon, mon_comp, USE_PRE_ALLOCATED, closid, rmid);
+}
+
static bool cache_has_usable_cpor(struct mpam_class *class)
{
struct mpam_props *cprops = &class->props;
--
2.43.0
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 12 Jan 2026 16:59:03 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
From: James Morse <james.morse@arm.com>
resctrl's limbo code needs to be told when the data left in a cache is
small enough for the partid+pmg value to be re-allocated.
x86 uses the cache size divided by the number of rmid users the cache may
have. Do the same, but for the smallest cache, and with the number of
partid-and-pmg users.
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
---
Changes since v2:
Move waiting for cache info into it's own patch
---
drivers/resctrl/mpam_resctrl.c | 35 ++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index 5adc78f9c96f..a6be3ce84241 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -561,6 +561,38 @@ void resctrl_arch_reset_cntr(struct rdt_resource *r, struct rdt_mon_domain *d,
reset_mon_cdp_safe(mon, mon_comp, USE_PRE_ALLOCATED, closid, rmid);
}
+/*
+ * The rmid realloc threshold should be for the smallest cache exposed to
+ * resctrl.
+ */
+static int update_rmid_limits(struct mpam_class *class)
+{
+ u32 num_unique_pmg = resctrl_arch_system_num_rmid_idx();
+ struct mpam_props *cprops = &class->props;
+ struct cacheinfo *ci;
+
+ lockdep_assert_cpus_held();
+
+ /* Assume cache levels are the same size for all CPUs... */
+ ci = get_cpu_cacheinfo_level(smp_processor_id(), class->level);
+ if (!ci || ci->size == 0) {
+ pr_debug("Could not read cache size for class %u\n",
+ class->level);
+ return -EINVAL;
+ }
+
+ if (!mpam_has_feature(mpam_feat_msmon_csu, cprops))
+ return 0;
+
+ if (!resctrl_rmid_realloc_limit ||
+ ci->size < resctrl_rmid_realloc_limit) {
+ resctrl_rmid_realloc_limit = ci->size;
+ resctrl_rmid_realloc_threshold = ci->size / num_unique_pmg;
+ }
+
+ return 0;
+}
+
static bool cache_has_usable_cpor(struct mpam_class *class)
{
struct mpam_props *cprops = &class->props;
@@ -1006,6 +1038,9 @@ static void mpam_resctrl_pick_counters(void)
/* CSU counters only make sense on a cache. */
switch (class->type) {
case MPAM_CLASS_CACHE:
+ if (update_rmid_limits(class))
+ continue;
+
counter_update_class(QOS_L3_OCCUP_EVENT_ID, class);
break;
default:
--
2.43.0
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 12 Jan 2026 16:59:04 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
From: James Morse <james.morse@arm.com>
A few resctrl features and hooks need to be provided, but aren't needed or
supported on MPAM platforms.
resctrl has individual hooks to separately enable and disable the
closid/partid and rmid/pmg context switching code. For MPAM this is all the
same thing, as the value in struct task_struct is used to cache the value
that should be written to hardware. arm64's context switching code is
enabled once MPAM is usable, but doesn't touch the hardware unless the
value has changed.
For now event configuration is not supported, and can be turned off by
returning 'false' from resctrl_arch_is_evt_configurable().
The new io_alloc feature is not supported either, always return false from
the enable helper to indicate and fail the enable.
Add this, and empty definitions for the other hooks.
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
---
drivers/resctrl/mpam_resctrl.c | 27 +++++++++++++++++++++++++++
include/linux/arm_mpam.h | 9 +++++++++
2 files changed, 36 insertions(+)
diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index a6be3ce84241..8e2fea2e51d3 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -103,6 +103,23 @@ bool resctrl_arch_mon_capable(void)
return exposed_mon_capable;
}
+bool resctrl_arch_is_evt_configurable(enum resctrl_event_id evt)
+{
+ return false;
+}
+
+void resctrl_arch_mon_event_config_read(void *info)
+{
+}
+
+void resctrl_arch_mon_event_config_write(void *info)
+{
+}
+
+void resctrl_arch_reset_rmid_all(struct rdt_resource *r, struct rdt_mon_domain *d)
+{
+}
+
bool resctrl_arch_get_cdp_enabled(enum resctrl_res_level rid)
{
switch (rid) {
@@ -1129,6 +1146,16 @@ int resctrl_arch_mbm_cntr_assign_set(struct rdt_resource *r, bool enable)
return -EINVAL;
}
+int resctrl_arch_io_alloc_enable(struct rdt_resource *r, bool enable)
+{
+ return -EOPNOTSUPP;
+}
+
+bool resctrl_arch_get_io_alloc_enabled(struct rdt_resource *r)
+{
+ return false;
+}
+
static int mpam_resctrl_control_init(struct mpam_resctrl_res *res)
{
struct mpam_class *class = res->class;
diff --git a/include/linux/arm_mpam.h b/include/linux/arm_mpam.h
index 86d5e326d2bd..f92a36187a52 100644
--- a/include/linux/arm_mpam.h
+++ b/include/linux/arm_mpam.h
@@ -67,6 +67,15 @@ struct rdt_resource;
void *resctrl_arch_mon_ctx_alloc(struct rdt_resource *r, enum resctrl_event_id evtid);
void resctrl_arch_mon_ctx_free(struct rdt_resource *r, enum resctrl_event_id evtid, void *ctx);
+/*
+ * The CPU configuration for MPAM is cheap to write, and is only written if it
+ * has changed. No need for fine grained enables.
+ */
+static inline void resctrl_arch_enable_mon(void) { }
+static inline void resctrl_arch_disable_mon(void) { }
+static inline void resctrl_arch_enable_alloc(void) { }
+static inline void resctrl_arch_disable_alloc(void) { }
+
static inline unsigned int resctrl_arch_round_mon_val(unsigned int val)
{
return val;
--
2.43.0
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 12 Jan 2026 16:59:05 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
From: James Morse <james.morse@arm.com>
Enough MPAM support is present to enable ARCH_HAS_CPU_RESCTRL. Let it
rip^Wlink!
ARCH_HAS_CPU_RESCTRL indicates resctrl can be enabled. It is enabled by the
arch code simply because it has 'arch' in its name.
This removes ARM_CPU_RESCTRL as a mimic of X86_CPU_RESCTRL. While here,
move the ACPI dependency to the driver's Kconfig file.
In anticipation of MPAM being useful remove the CONFIG_EXPERT restriction.
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
---
arch/arm64/Kconfig | 4 ++--
arch/arm64/include/asm/resctrl.h | 2 ++
drivers/resctrl/Kconfig | 9 ++++++++-
drivers/resctrl/Makefile | 2 +-
4 files changed, 13 insertions(+), 4 deletions(-)
create mode 100644 arch/arm64/include/asm/resctrl.h
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index cdcc5b76a110..baeecb88771d 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -2026,8 +2026,8 @@ config ARM64_TLB_RANGE
config ARM64_MPAM
bool "Enable support for MPAM"
- select ARM64_MPAM_DRIVER if EXPERT # does nothing yet
- select ACPI_MPAM if ACPI
+ select ARM64_MPAM_DRIVER
+ select ARCH_HAS_CPU_RESCTRL
help
Memory System Resource Partitioning and Monitoring (MPAM) is an
optional extension to the Arm architecture that allows each
diff --git a/arch/arm64/include/asm/resctrl.h b/arch/arm64/include/asm/resctrl.h
new file mode 100644
index 000000000000..b506e95cf6e3
--- /dev/null
+++ b/arch/arm64/include/asm/resctrl.h
@@ -0,0 +1,2 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#include <linux/arm_mpam.h>
diff --git a/drivers/resctrl/Kconfig b/drivers/resctrl/Kconfig
index c808e0470394..672abea3b03c 100644
--- a/drivers/resctrl/Kconfig
+++ b/drivers/resctrl/Kconfig
@@ -1,6 +1,7 @@
menuconfig ARM64_MPAM_DRIVER
bool "MPAM driver"
- depends on ARM64 && ARM64_MPAM && EXPERT
+ depends on ARM64 && ARM64_MPAM
+ select ACPI_MPAM if ACPI
help
Memory System Resource Partitioning and Monitoring (MPAM) driver for
System IP, e.g. caches and memory controllers.
@@ -22,3 +23,9 @@ config MPAM_KUNIT_TEST
If unsure, say N.
endif
+
+config ARM64_MPAM_RESCTRL_FS
+ bool
+ default y if ARM64_MPAM_DRIVER && RESCTRL_FS
+ select RESCTRL_RMID_DEPENDS_ON_CLOSID
+ select RESCTRL_ASSIGN_FIXED
diff --git a/drivers/resctrl/Makefile b/drivers/resctrl/Makefile
index 40beaf999582..4f6d0e81f9b8 100644
--- a/drivers/resctrl/Makefile
+++ b/drivers/resctrl/Makefile
@@ -1,5 +1,5 @@
obj-$(CONFIG_ARM64_MPAM_DRIVER) += mpam.o
mpam-y += mpam_devices.o
-mpam-$(CONFIG_ARM_CPU_RESCTRL) += mpam_resctrl.o
+mpam-$(CONFIG_ARM64_MPAM_RESCTRL_FS) += mpam_resctrl.o
ccflags-$(CONFIG_ARM64_MPAM_DRIVER_DEBUG) += -DDEBUG
--
2.43.0
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 12 Jan 2026 16:59:06 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
From: James Morse <james.morse@arm.com>
Now that MPAM links against resctrl, call resctrl_init() to register the
filesystem and setup resctrl's structures.
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
---
Changes since v2:
Use for_each_mpam...
error path tidying
---
drivers/resctrl/mpam_devices.c | 32 +++++++++++--
drivers/resctrl/mpam_internal.h | 4 ++
drivers/resctrl/mpam_resctrl.c | 82 ++++++++++++++++++++++++++++++++-
3 files changed, 113 insertions(+), 5 deletions(-)
diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
index c2127570cf37..9fbe4fe3b13a 100644
--- a/drivers/resctrl/mpam_devices.c
+++ b/drivers/resctrl/mpam_devices.c
@@ -73,6 +73,14 @@ static DECLARE_WORK(mpam_broken_work, &mpam_disable);
/* When mpam is disabled, the printed reason to aid debugging */
static char *mpam_disable_reason;
+/*
+ * Whether resctrl has been setup. Used by cpuhp in preference to
+ * mpam_is_enabled(). The disable call after an error interrupt makes
+ * mpam_is_enabled() false before the cpuhp callbacks are made.
+ * Reads/writes should hold mpam_cpuhp_state_lock, (or be cpuhp callbacks).
+ */
+static bool mpam_resctrl_enabled;
+
/*
* An MSC is a physical container for controls and monitors, each identified by
* their RIS index. These share a base-address, interrupts and some MMIO
@@ -1635,7 +1643,7 @@ static int mpam_cpu_online(unsigned int cpu)
mpam_reprogram_msc(msc);
}
- if (mpam_is_enabled())
+ if (mpam_resctrl_enabled)
return mpam_resctrl_online_cpu(cpu);
return 0;
@@ -1681,7 +1689,7 @@ static int mpam_cpu_offline(unsigned int cpu)
{
struct mpam_msc *msc;
- if (mpam_is_enabled())
+ if (mpam_resctrl_enabled)
mpam_resctrl_offline_cpu(cpu);
guard(srcu)(&mpam_srcu);
@@ -2543,6 +2551,7 @@ static void mpam_enable_once(void)
}
static_branch_enable(&mpam_enabled);
+ mpam_resctrl_enabled = true;
mpam_register_cpuhp_callbacks(mpam_cpu_online, mpam_cpu_offline,
"mpam:online");
@@ -2602,24 +2611,39 @@ static void mpam_reset_class(struct mpam_class *class)
void mpam_disable(struct work_struct *ignored)
{
int idx;
+ bool do_resctrl_exit;
struct mpam_class *class;
struct mpam_msc *msc, *tmp;
+ if (mpam_is_enabled())
+ static_branch_disable(&mpam_enabled);
+
mutex_lock(&mpam_cpuhp_state_lock);
if (mpam_cpuhp_state) {
cpuhp_remove_state(mpam_cpuhp_state);
mpam_cpuhp_state = 0;
}
+
+ /*
+ * Removing the cpuhp state called mpam_cpu_offline() and told resctrl
+ * all the CPUs are offline.
+ */
+ do_resctrl_exit = mpam_resctrl_enabled;
+ mpam_resctrl_enabled = false;
mutex_unlock(&mpam_cpuhp_state_lock);
- static_branch_disable(&mpam_enabled);
+ if (do_resctrl_exit)
+ mpam_resctrl_exit();
mpam_unregister_irqs();
idx = srcu_read_lock(&mpam_srcu);
list_for_each_entry_srcu(class, &mpam_classes, classes_list,
- srcu_read_lock_held(&mpam_srcu))
+ srcu_read_lock_held(&mpam_srcu)) {
mpam_reset_class(class);
+ if (do_resctrl_exit)
+ mpam_resctrl_teardown_class(class);
+ }
srcu_read_unlock(&mpam_srcu, idx);
mutex_lock(&mpam_list_lock);
diff --git a/drivers/resctrl/mpam_internal.h b/drivers/resctrl/mpam_internal.h
index 8f73528414af..d9f52023d730 100644
--- a/drivers/resctrl/mpam_internal.h
+++ b/drivers/resctrl/mpam_internal.h
@@ -450,12 +450,16 @@ int mpam_get_cpumask_from_cache_id(unsigned long cache_id, u32 cache_level,
#ifdef CONFIG_RESCTRL_FS
int mpam_resctrl_setup(void);
+void mpam_resctrl_exit(void);
int mpam_resctrl_online_cpu(unsigned int cpu);
void mpam_resctrl_offline_cpu(unsigned int cpu);
+void mpam_resctrl_teardown_class(struct mpam_class *class);
#else
static inline int mpam_resctrl_setup(void) { return 0; }
+static inline void mpam_resctrl_exit(void) { }
static inline int mpam_resctrl_online_cpu(unsigned int cpu) { return 0; }
static inline void mpam_resctrl_offline_cpu(unsigned int cpu) { }
+static inline void mpam_resctrl_teardown_class(struct mpam_class *class) { }
#endif /* CONFIG_RESCTRL_FS */
/*
diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index 8e2fea2e51d3..e7b839c478fd 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -70,6 +70,12 @@ static bool cdp_enabled;
static bool cacheinfo_ready;
static DECLARE_WAIT_QUEUE_HEAD(wait_cacheinfo_ready);
+/*
+ * If resctrl_init() succeeded, resctrl_exit() can be used to remove support
+ * for the filesystem in the event of an error.
+ */
+static bool resctrl_enabled;
+
/*
* L3 local/total may come from different classes - what is the number of MBWU
* 'on L3'?
@@ -316,6 +322,9 @@ static int resctrl_arch_mon_ctx_alloc_no_wait(enum resctrl_event_id evtid)
{
struct mpam_resctrl_mon *mon = &mpam_resctrl_counters[evtid];
+ if (!mpam_is_enabled())
+ return -EINVAL;
+
if (!mon->class)
return -EINVAL;
@@ -358,6 +367,9 @@ static void resctrl_arch_mon_ctx_free_no_wait(enum resctrl_event_id evtid,
{
struct mpam_resctrl_mon *mon = &mpam_resctrl_counters[evtid];
+ if (!mpam_is_enabled())
+ return;
+
if (!mon->class)
return;
@@ -458,6 +470,9 @@ int resctrl_arch_rmid_read(struct rdt_resource *r, struct rdt_mon_domain *d,
resctrl_arch_rmid_read_context_check();
+ if (!mpam_is_enabled())
+ return -EINVAL;
+
if (eventid >= QOS_NUM_EVENTS || !mon->class)
return -EINVAL;
@@ -1398,6 +1413,9 @@ int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_ctrl_domain *d,
lockdep_assert_cpus_held();
lockdep_assert_irqs_enabled();
+ if (!mpam_is_enabled())
+ return -EINVAL;
+
/*
* No need to check the CPU as mpam_apply_config() doesn't care, and
* resctrl_arch_update_domains() relies on this.
@@ -1460,6 +1478,9 @@ int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid)
lockdep_assert_cpus_held();
lockdep_assert_irqs_enabled();
+ if (!mpam_is_enabled())
+ return -EINVAL;
+
list_for_each_entry_rcu(d, &r->ctrl_domains, hdr.list) {
for (enum resctrl_conf_type t = 0; t < CDP_NUM_TYPES; t++) {
struct resctrl_staged_config *cfg = &d->staged_config[t];
@@ -1824,7 +1845,11 @@ int mpam_resctrl_setup(void)
return -EOPNOTSUPP;
}
- /* TODO: call resctrl_init() */
+ err = resctrl_init();
+ if (err)
+ return err;
+
+ WRITE_ONCE(resctrl_enabled, true);
return 0;
@@ -1834,6 +1859,61 @@ int mpam_resctrl_setup(void)
return err;
}
+void mpam_resctrl_exit(void)
+{
+ if (!READ_ONCE(resctrl_enabled))
+ return;
+
+ WRITE_ONCE(resctrl_enabled, false);
+ resctrl_exit();
+}
+
+static void mpam_resctrl_teardown_mon(struct mpam_resctrl_mon *mon, struct mpam_class *class)
+{
+ u32 num_mbwu_mon = l3_num_allocated_mbwu;
+
+ if (!mon->mbwu_idx_to_mon)
+ return;
+
+ if (mon->assigned_counters) {
+ __free_mbwu_mon(class, mon->assigned_counters, num_mbwu_mon);
+ mon->assigned_counters = NULL;
+ kfree(mon->mbwu_idx_to_mon);
+ } else {
+ __free_mbwu_mon(class, mon->mbwu_idx_to_mon, num_mbwu_mon);
+ }
+ mon->mbwu_idx_to_mon = NULL;
+}
+
+/*
+ * The driver is detaching an MSC from this class, if resctrl was using it,
+ * pull on resctrl_exit().
+ */
+void mpam_resctrl_teardown_class(struct mpam_class *class)
+{
+ struct mpam_resctrl_res *res;
+ enum resctrl_res_level rid;
+ struct mpam_resctrl_mon *mon;
+ enum resctrl_event_id eventid;
+
+ might_sleep();
+
+ for_each_mpam_resctrl_control(res, rid) {
+ if (res->class == class) {
+ res->class = NULL;
+ break;
+ }
+ }
+ for_each_mpam_resctrl_mon(mon, eventid) {
+ if (mon->class == class) {
+ mon->class = NULL;
+
+ mpam_resctrl_teardown_mon(mon, class);
+ break;
+ }
+ }
+}
+
static int __init __cacheinfo_ready(void)
{
cacheinfo_ready = true;
--
2.43.0
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 12 Jan 2026 16:59:07 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
From: James Morse <james.morse@arm.com>
MPAM supports a minimum and maximum control for memory bandwidth. The
purpose of the minimum control is to give priority to tasks that are below
their minimum value. Resctrl only provides one value for the bandwidth
configuration, which is used for the maximum.
The minimum control is always programmed to zero on hardware that supports
it.
Generate a minimum bandwidth value that is 5% lower than the value provided
by resctrl. This means tasks that are not receiving their target bandwidth
can be prioritised by the hardware.
For component reset reuse the same calculation so that the default is a
value resctrl can set.
CC: Zeng Heng <zengheng4@huawei.com>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
---
Changes since rfc:
Add reset_mbw_min
Clear min cfg when setting max
use mpam_extend_config on component reset
Changes since v2:
bwa_wd limit to 16 moved to earlier patch
restrict scope of min and delta variables
move code out of loop so smaller change for quirking min
move testing into its own commit
---
drivers/resctrl/mpam_devices.c | 69 ++++++++++++++++++++++++++++++---
drivers/resctrl/mpam_internal.h | 3 ++
drivers/resctrl/mpam_resctrl.c | 2 +
3 files changed, 69 insertions(+), 5 deletions(-)
diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
index 9fbe4fe3b13a..37bd8efc6ecf 100644
--- a/drivers/resctrl/mpam_devices.c
+++ b/drivers/resctrl/mpam_devices.c
@@ -1394,8 +1394,12 @@ static void mpam_reprogram_ris_partid(struct mpam_msc_ris *ris, u16 partid,
}
if (mpam_has_feature(mpam_feat_mbw_min, rprops) &&
- mpam_has_feature(mpam_feat_mbw_min, cfg))
- mpam_write_partsel_reg(msc, MBW_MIN, 0);
+ mpam_has_feature(mpam_feat_mbw_min, cfg)) {
+ if (cfg->reset_mbw_min)
+ mpam_write_partsel_reg(msc, MBW_MIN, 0);
+ else
+ mpam_write_partsel_reg(msc, MBW_MIN, cfg->mbw_min);
+ }
if (mpam_has_feature(mpam_feat_mbw_max, rprops) &&
mpam_has_feature(mpam_feat_mbw_max, cfg)) {
@@ -1510,6 +1514,7 @@ static void mpam_init_reset_cfg(struct mpam_config *reset_cfg)
.reset_cpbm = true,
.reset_mbw_pbm = true,
.reset_mbw_max = true,
+ .reset_mbw_min = true,
};
bitmap_fill(reset_cfg->features, MPAM_FEATURE_LAST);
}
@@ -2408,6 +2413,45 @@ static void __destroy_component_cfg(struct mpam_component *comp)
}
}
+static void mpam_extend_config(struct mpam_class *class, struct mpam_config *cfg)
+{
+ struct mpam_props *cprops = &class->props;
+ u16 min_hw_granule, max_hw_value, res0_bits;
+
+ /*
+ * Calculate the values the 'min' control can hold.
+ * e.g. on a platform with bwa_wd = 8, min_hw_granule is 0x00ff because
+ * those bits are RES0. Configurations of this value are effectively
+ * zero. But configurations need to saturate at min_hw_granule on
+ * systems with mismatched bwa_wd, where the 'less than 0' values are
+ * implemented on some MSC, but not others.
+ */
+ res0_bits = 16 - cprops->bwa_wd;
+ max_hw_value = ((1 << cprops->bwa_wd) - 1) << res0_bits;
+ min_hw_granule = ~max_hw_value;
+
+ /*
+ * MAX and MIN should be set together. If only one is provided,
+ * generate a configuration for the other. If only one control
+ * type is supported, the other value will be ignored.
+ *
+ * Resctrl can only configure the MAX.
+ */
+ if (mpam_has_feature(mpam_feat_mbw_max, cfg) &&
+ !mpam_has_feature(mpam_feat_mbw_min, cfg)) {
+ u16 min, delta;
+
+ delta = ((5 * MPAMCFG_MBW_MAX_MAX) / 100) - 1;
+ if (cfg->mbw_max > delta)
+ min = cfg->mbw_max - delta;
+ else
+ min = 0;
+
+ cfg->mbw_min = max(min, min_hw_granule);
+ mpam_set_feature(mpam_feat_mbw_min, cfg);
+ }
+}
+
static void mpam_reset_component_cfg(struct mpam_component *comp)
{
int i;
@@ -2426,6 +2470,8 @@ static void mpam_reset_component_cfg(struct mpam_component *comp)
comp->cfg[i].mbw_pbm = GENMASK(cprops->mbw_pbm_bits - 1, 0);
if (cprops->bwa_wd)
comp->cfg[i].mbw_max = GENMASK(15, 16 - cprops->bwa_wd);
+
+ mpam_extend_config(comp->class, &comp->cfg[i]);
}
}
@@ -2701,24 +2747,37 @@ static bool mpam_update_config(struct mpam_config *cfg,
maybe_update_config(cfg, mpam_feat_cpor_part, newcfg, cpbm, has_changes);
maybe_update_config(cfg, mpam_feat_mbw_part, newcfg, mbw_pbm, has_changes);
maybe_update_config(cfg, mpam_feat_mbw_max, newcfg, mbw_max, has_changes);
+ maybe_update_config(cfg, mpam_feat_mbw_min, newcfg, mbw_min, has_changes);
return has_changes;
}
int mpam_apply_config(struct mpam_component *comp, u16 partid,
- struct mpam_config *cfg)
+ struct mpam_config *user_cfg)
{
struct mpam_write_config_arg arg;
struct mpam_msc_ris *ris;
+ struct mpam_config cfg;
struct mpam_vmsc *vmsc;
struct mpam_msc *msc;
lockdep_assert_cpus_held();
/* Don't pass in the current config! */
- WARN_ON_ONCE(&comp->cfg[partid] == cfg);
+ WARN_ON_ONCE(&comp->cfg[partid] == user_cfg);
+
+ /*
+ * Copy the config to avoid writing back the 'extended' version to
+ * the caller.
+ * This avoids mpam_devices.c setting a mbm_min that mpam_resctrl.c
+ * is unaware of ... when it then changes mbm_max to be lower than
+ * mbm_min.
+ */
+ cfg = *user_cfg;
+
+ mpam_extend_config(comp->class, &cfg);
- if (!mpam_update_config(&comp->cfg[partid], cfg))
+ if (!mpam_update_config(&comp->cfg[partid], &cfg))
return 0;
arg.comp = comp;
diff --git a/drivers/resctrl/mpam_internal.h b/drivers/resctrl/mpam_internal.h
index d9f52023d730..69cb75616561 100644
--- a/drivers/resctrl/mpam_internal.h
+++ b/drivers/resctrl/mpam_internal.h
@@ -278,10 +278,12 @@ struct mpam_config {
u32 cpbm;
u32 mbw_pbm;
u16 mbw_max;
+ u16 mbw_min;
bool reset_cpbm;
bool reset_mbw_pbm;
bool reset_mbw_max;
+ bool reset_mbw_min;
struct mpam_garbage garbage;
};
@@ -618,6 +620,7 @@ static inline void mpam_resctrl_teardown_class(struct mpam_class *class) { }
* MPAMCFG_MBW_MAX - MPAM memory maximum bandwidth partitioning configuration
* register
*/
+#define MPAMCFG_MBW_MAX_MAX_NR_BITS 16
#define MPAMCFG_MBW_MAX_MAX GENMASK(15, 0)
#define MPAMCFG_MBW_MAX_HARDLIM BIT(31)
diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index e7b839c478fd..019f7a1d74fd 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -1446,6 +1446,8 @@ int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_ctrl_domain *d,
if (mpam_has_feature(mpam_feat_mbw_max, cprops)) {
cfg.mbw_max = percent_to_mbw_max(cfg_val, cprops);
mpam_set_feature(mpam_feat_mbw_max, &cfg);
+ /* Allow the min to be calculated from the max */
+ mpam_clear_feature(mpam_feat_mbw_min, &cfg);
break;
}
fallthrough;
--
2.43.0
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 12 Jan 2026 16:59:08 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
By default we generate a minimum bandwidth value that is 5% lower
than the maximum bandwidth value given by resctrl.
Add a test for this.
Signed-off-by: James Morse <james.morse@arm.com>
[horgan: Split test into separate patch]
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
---
drivers/resctrl/test_mpam_devices.c | 66 +++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/drivers/resctrl/test_mpam_devices.c b/drivers/resctrl/test_mpam_devices.c
index 3e8d564a0c64..2f802fd9f249 100644
--- a/drivers/resctrl/test_mpam_devices.c
+++ b/drivers/resctrl/test_mpam_devices.c
@@ -322,6 +322,71 @@ static void test_mpam_enable_merge_features(struct kunit *test)
mutex_unlock(&mpam_list_lock);
}
+static void test_mpam_extend_config(struct kunit *test)
+{
+ struct mpam_config fake_cfg = { };
+ struct mpam_class fake_class = { };
+
+ /* Configurations with both are not modified */
+ fake_class.props.bwa_wd = 16;
+ fake_cfg.mbw_max = 0xfeef;
+ fake_cfg.mbw_min = 0xfeef;
+ bitmap_zero(fake_cfg.features, MPAM_FEATURE_LAST);
+ mpam_set_feature(mpam_feat_mbw_max, &fake_cfg);
+ mpam_set_feature(mpam_feat_mbw_min, &fake_cfg);
+ mpam_extend_config(&fake_class, &fake_cfg);
+ KUNIT_EXPECT_TRUE(test, mpam_has_feature(mpam_feat_mbw_max, &fake_cfg));
+ KUNIT_EXPECT_TRUE(test, mpam_has_feature(mpam_feat_mbw_min, &fake_cfg));
+ KUNIT_EXPECT_EQ(test, fake_cfg.mbw_max, 0xfeef);
+ KUNIT_EXPECT_EQ(test, fake_cfg.mbw_min, 0xfeef);
+
+ /* When a min is missing, it is generated */
+ fake_class.props.bwa_wd = 16;
+ fake_cfg.mbw_max = 0xfeef;
+ fake_cfg.mbw_min = 0;
+ bitmap_zero(fake_cfg.features, MPAM_FEATURE_LAST);
+ mpam_set_feature(mpam_feat_mbw_max, &fake_cfg);
+ mpam_extend_config(&fake_class, &fake_cfg);
+ KUNIT_EXPECT_TRUE(test, mpam_has_feature(mpam_feat_mbw_max, &fake_cfg));
+ KUNIT_EXPECT_TRUE(test, mpam_has_feature(mpam_feat_mbw_min, &fake_cfg));
+ KUNIT_EXPECT_EQ(test, fake_cfg.mbw_max, 0xfeef);
+ KUNIT_EXPECT_EQ(test, fake_cfg.mbw_min, 0xf224);
+
+ fake_class.props.bwa_wd = 8;
+ fake_cfg.mbw_max = 0xfeef;
+ fake_cfg.mbw_min = 0;
+ bitmap_zero(fake_cfg.features, MPAM_FEATURE_LAST);
+ mpam_set_feature(mpam_feat_mbw_max, &fake_cfg);
+ mpam_extend_config(&fake_class, &fake_cfg);
+ KUNIT_EXPECT_TRUE(test, mpam_has_feature(mpam_feat_mbw_max, &fake_cfg));
+ KUNIT_EXPECT_TRUE(test, mpam_has_feature(mpam_feat_mbw_min, &fake_cfg));
+ KUNIT_EXPECT_EQ(test, fake_cfg.mbw_max, 0xfeef);
+ KUNIT_EXPECT_EQ(test, fake_cfg.mbw_min, 0xf224);
+
+ /* 5% below the minimum granule, is still the minimum granule */
+ fake_class.props.bwa_wd = 12;
+ fake_cfg.mbw_max = 0xf;
+ fake_cfg.mbw_min = 0;
+ bitmap_zero(fake_cfg.features, MPAM_FEATURE_LAST);
+ mpam_set_feature(mpam_feat_mbw_max, &fake_cfg);
+ mpam_extend_config(&fake_class, &fake_cfg);
+ KUNIT_EXPECT_TRUE(test, mpam_has_feature(mpam_feat_mbw_max, &fake_cfg));
+ KUNIT_EXPECT_TRUE(test, mpam_has_feature(mpam_feat_mbw_min, &fake_cfg));
+ KUNIT_EXPECT_EQ(test, fake_cfg.mbw_max, 0xf);
+ KUNIT_EXPECT_EQ(test, fake_cfg.mbw_min, 0xf);
+
+ fake_class.props.bwa_wd = 16;
+ fake_cfg.mbw_max = 0x4;
+ fake_cfg.mbw_min = 0;
+ bitmap_zero(fake_cfg.features, MPAM_FEATURE_LAST);
+ mpam_set_feature(mpam_feat_mbw_max, &fake_cfg);
+ mpam_extend_config(&fake_class, &fake_cfg);
+ KUNIT_EXPECT_TRUE(test, mpam_has_feature(mpam_feat_mbw_max, &fake_cfg));
+ KUNIT_EXPECT_TRUE(test, mpam_has_feature(mpam_feat_mbw_min, &fake_cfg));
+ KUNIT_EXPECT_EQ(test, fake_cfg.mbw_max, 0x4);
+ KUNIT_EXPECT_EQ(test, fake_cfg.mbw_min, 0x0);
+}
+
static void test_mpam_reset_msc_bitmap(struct kunit *test)
{
char __iomem *buf = kunit_kzalloc(test, SZ_16K, GFP_KERNEL);
@@ -378,6 +443,7 @@ static struct kunit_case mpam_devices_test_cases[] = {
KUNIT_CASE(test_mpam_reset_msc_bitmap),
KUNIT_CASE(test_mpam_enable_merge_features),
KUNIT_CASE(test__props_mismatch),
+ KUNIT_CASE(test_mpam_extend_config),
{}
};
--
2.43.0
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 12 Jan 2026 16:59:09 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
From: Shanker Donthineni <sdonthineni@nvidia.com>
The MPAM specification includes the MPAMF_IIDR, which serves to uniquely
identify the MSC implementation through a combination of implementer
details, product ID, variant, and revision. Certain hardware issues/errata
can be resolved using software workarounds.
Introduce a quirk framework to allow workarounds to be enabled based on the
MPAMF_IIDR value.
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Co-developed-by: Shanker Donthineni <sdonthineni@nvidia.com>
Signed-off-by: Shanker Donthineni <sdonthineni@nvidia.com>
Co-developed-by: James Morse <james.morse@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
---
Changes by James:
Stash the IIDR so this doesn't need an IPI, enable quirks only
once, move the description to the callback so it can be pr_once()d, add an
enum of workarounds for popular errata. Add macros for making lists of
product/revision/vendor half readable
Changes since rfc:
remove trailing commas in last element of enums
Make mpam_enable_quirks() in charge of mpam_set_quirk() even if there
is an enable.
---
drivers/resctrl/mpam_devices.c | 32 ++++++++++++++++++++++++++++++++
drivers/resctrl/mpam_internal.h | 25 +++++++++++++++++++++++++
2 files changed, 57 insertions(+)
diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
index 37bd8efc6ecf..5f741df9abcc 100644
--- a/drivers/resctrl/mpam_devices.c
+++ b/drivers/resctrl/mpam_devices.c
@@ -630,6 +630,30 @@ static struct mpam_msc_ris *mpam_get_or_create_ris(struct mpam_msc *msc,
return ERR_PTR(-ENOENT);
}
+static const struct mpam_quirk mpam_quirks[] = {
+ { NULL } /* Sentinel */
+};
+
+static void mpam_enable_quirks(struct mpam_msc *msc)
+{
+ const struct mpam_quirk *quirk;
+
+ for (quirk = &mpam_quirks[0]; quirk->iidr_mask; quirk++) {
+ int err = 0;
+
+ if (quirk->iidr != (msc->iidr & quirk->iidr_mask))
+ continue;
+
+ if (quirk->init)
+ err = quirk->init(msc, quirk);
+
+ if (err)
+ continue;
+
+ mpam_set_quirk(quirk->workaround, msc);
+ }
+}
+
/*
* IHI009A.a has this nugget: "If a monitor does not support automatic behaviour
* of NRDY, software can use this bit for any purpose" - so hardware might not
@@ -864,8 +888,11 @@ static int mpam_msc_hw_probe(struct mpam_msc *msc)
/* Grab an IDR value to find out how many RIS there are */
mutex_lock(&msc->part_sel_lock);
idr = mpam_msc_read_idr(msc);
+ msc->iidr = mpam_read_partsel_reg(msc, IIDR);
mutex_unlock(&msc->part_sel_lock);
+ mpam_enable_quirks(msc);
+
msc->ris_max = FIELD_GET(MPAMF_IDR_RIS_MAX, idr);
/* Use these values so partid/pmg always starts with a valid value */
@@ -1993,6 +2020,7 @@ static bool mpam_has_cmax_wd_feature(struct mpam_props *props)
* resulting safe value must be compatible with both. When merging values in
* the tree, all the aliasing resources must be handled first.
* On mismatch, parent is modified.
+ * Quirks on an MSC will apply to all MSC in that class.
*/
static void __props_mismatch(struct mpam_props *parent,
struct mpam_props *child, bool alias)
@@ -2112,6 +2140,7 @@ static void __props_mismatch(struct mpam_props *parent,
* nobble the class feature, as we can't configure all the resources.
* e.g. The L3 cache is composed of two resources with 13 and 17 portion
* bitmaps respectively.
+ * Quirks on an MSC will apply to all MSC in that class.
*/
static void
__class_props_mismatch(struct mpam_class *class, struct mpam_vmsc *vmsc)
@@ -2125,6 +2154,9 @@ __class_props_mismatch(struct mpam_class *class, struct mpam_vmsc *vmsc)
dev_dbg(dev, "Merging features for class:0x%lx &= vmsc:0x%lx\n",
(long)cprops->features, (long)vprops->features);
+ /* Merge quirks */
+ class->quirks |= vmsc->msc->quirks;
+
/* Take the safe value for any common features */
__props_mismatch(cprops, vprops, false);
}
diff --git a/drivers/resctrl/mpam_internal.h b/drivers/resctrl/mpam_internal.h
index 69cb75616561..d60a3caf6f6e 100644
--- a/drivers/resctrl/mpam_internal.h
+++ b/drivers/resctrl/mpam_internal.h
@@ -85,6 +85,8 @@ struct mpam_msc {
u8 pmg_max;
unsigned long ris_idxs;
u32 ris_max;
+ u32 iidr;
+ u16 quirks;
/*
* error_irq_lock is taken when registering/unregistering the error
@@ -216,6 +218,28 @@ struct mpam_props {
#define mpam_set_feature(_feat, x) __set_bit(_feat, (x)->features)
#define mpam_clear_feature(_feat, x) __clear_bit(_feat, (x)->features)
+/* Workaround bits for msc->quirks */
+enum mpam_device_quirks {
+ MPAM_QUIRK_LAST
+};
+
+#define mpam_has_quirk(_quirk, x) ((1 << (_quirk) & (x)->quirks))
+#define mpam_set_quirk(_quirk, x) ((x)->quirks |= (1 << (_quirk)))
+
+struct mpam_quirk {
+ int (*init)(struct mpam_msc *msc, const struct mpam_quirk *quirk);
+
+ u32 iidr;
+ u32 iidr_mask;
+
+ enum mpam_device_quirks workaround;
+};
+
+#define MPAM_IIDR_MATCH_ONE FIELD_PREP_CONST(MPAMF_IIDR_PRODUCTID, 0xfff) | \
+ FIELD_PREP_CONST(MPAMF_IIDR_VARIANT, 0xf) | \
+ FIELD_PREP_CONST(MPAMF_IIDR_REVISION, 0xf) | \
+ FIELD_PREP_CONST(MPAMF_IIDR_IMPLEMENTER, 0xfff)
+
/* The values for MSMON_CFG_MBWU_FLT.RWBW */
enum mon_filter_options {
COUNT_BOTH = 0,
@@ -259,6 +283,7 @@ struct mpam_class {
struct mpam_props props;
u32 nrdy_usec;
+ u16 quirks;
u8 level;
enum mpam_class_types type;
--
2.43.0
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 12 Jan 2026 16:59:10 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
From: Shanker Donthineni <sdonthineni@nvidia.com>
The MPAM bandwidth partitioning controls will not be correctly configured,
and hardware will retain default configuration register values, meaning
generally that bandwidth will remain unprovisioned.
To address the issue, follow the below steps after updating the MBW_MIN
and/or MBW_MAX registers.
- Perform 64b reads from all 12 bridge MPAM shadow registers at offsets
(0x360048 + slice*0x10000 + partid*8). These registers are read-only.
- Continue iterating until all 12 shadow register values match in a loop.
pr_warn_once if the values fail to match within the loop count 1000.
- Perform 64b writes with the value 0x0 to the two spare registers at
offsets 0x1b0000 and 0x1c0000.
In the hardware, writes to the MPAMCFG_MBW_MAX MPAMCFG_MBW_MIN registers
are transformed into broadcast writes to the 12 shadow registers. The
final two writes to the spare registers cause a final rank of downstream
micro-architectural MPAM registers to be updated from the shadow copies.
The intervening loop to read the 12 shadow registers helps avoid a race
condition where writes to the spare registers occur before all shadow
registers have been updated.
[ morse: Merged the min/max update into a single
mpam_quirk_post_config_change() helper. Stashed the t241_id in the msc
instead of carrying the physical address around. Test the msc quirk bit
instead of a static key. ]
Signed-off-by: Shanker Donthineni <sdonthineni@nvidia.com>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
---
Changes since rfc:
MPAM_IIDR_NVIDIA_T421 -> MPAM_IIDR_NVIDIA_T241
return err from init
Be specific about the errata in the init name,
mpam_enable_quirk_nvidia_t241 -> mpam_enable_quirk_nvidia_t241_1
---
Documentation/arch/arm64/silicon-errata.rst | 2 +
drivers/resctrl/mpam_devices.c | 88 +++++++++++++++++++++
drivers/resctrl/mpam_internal.h | 9 +++
3 files changed, 99 insertions(+)
diff --git a/Documentation/arch/arm64/silicon-errata.rst b/Documentation/arch/arm64/silicon-errata.rst
index a7ec57060f64..4e86b85fe3d6 100644
--- a/Documentation/arch/arm64/silicon-errata.rst
+++ b/Documentation/arch/arm64/silicon-errata.rst
@@ -246,6 +246,8 @@ stable kernels.
+----------------+-----------------+-----------------+-----------------------------+
| NVIDIA | T241 GICv3/4.x | T241-FABRIC-4 | N/A |
+----------------+-----------------+-----------------+-----------------------------+
+| NVIDIA | T241 MPAM | T241-MPAM-1 | N/A |
++----------------+-----------------+-----------------+-----------------------------+
+----------------+-----------------+-----------------+-----------------------------+
| Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 |
+----------------+-----------------+-----------------+-----------------------------+
diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
index 5f741df9abcc..bdf13a22d98f 100644
--- a/drivers/resctrl/mpam_devices.c
+++ b/drivers/resctrl/mpam_devices.c
@@ -29,6 +29,16 @@
#include "mpam_internal.h"
+/* Values for the T241 errata workaround */
+#define T241_CHIPS_MAX 4
+#define T241_CHIP_NSLICES 12
+#define T241_SPARE_REG0_OFF 0x1b0000
+#define T241_SPARE_REG1_OFF 0x1c0000
+#define T241_CHIP_ID(phys) FIELD_GET(GENMASK_ULL(44, 43), phys)
+#define T241_SHADOW_REG_OFF(sidx, pid) (0x360048 + (sidx) * 0x10000 + (pid) * 8)
+#define SMCCC_SOC_ID_T241 0x036b0241
+static void __iomem *t241_scratch_regs[T241_CHIPS_MAX];
+
/*
* mpam_list_lock protects the SRCU lists when writing. Once the
* mpam_enabled key is enabled these lists are read-only,
@@ -630,7 +640,45 @@ static struct mpam_msc_ris *mpam_get_or_create_ris(struct mpam_msc *msc,
return ERR_PTR(-ENOENT);
}
+static int mpam_enable_quirk_nvidia_t241_1(struct mpam_msc *msc,
+ const struct mpam_quirk *quirk)
+{
+ s32 soc_id = arm_smccc_get_soc_id_version();
+ struct resource *r;
+ phys_addr_t phys;
+
+ /*
+ * A mapping to a device other than the MSC is needed, check
+ * SOC_ID is NVIDIA T241 chip (036b:0241)
+ */
+ if (soc_id < 0 || soc_id != SMCCC_SOC_ID_T241)
+ return -EINVAL;
+
+ r = platform_get_resource(msc->pdev, IORESOURCE_MEM, 0);
+ if (!r)
+ return -EINVAL;
+
+ /* Find the internal registers base addr from the CHIP ID */
+ msc->t241_id = T241_CHIP_ID(r->start);
+ phys = FIELD_PREP(GENMASK_ULL(45, 44), msc->t241_id) | 0x19000000ULL;
+
+ t241_scratch_regs[msc->t241_id] = ioremap(phys, SZ_8M);
+ if (WARN_ON_ONCE(!t241_scratch_regs[msc->t241_id]))
+ return -EINVAL;
+
+ pr_info_once("Enabled workaround for NVIDIA T241 erratum T241-MPAM-1\n");
+
+ return 0;
+}
+
static const struct mpam_quirk mpam_quirks[] = {
+ {
+ /* NVIDIA t241 erratum T241-MPAM-1 */
+ .init = mpam_enable_quirk_nvidia_t241_1,
+ .iidr = MPAM_IIDR_NVIDIA_T241,
+ .iidr_mask = MPAM_IIDR_MATCH_ONE,
+ .workaround = T241_SCRUB_SHADOW_REGS,
+ },
{ NULL } /* Sentinel */
};
@@ -1378,6 +1426,44 @@ static void mpam_reset_msc_bitmap(struct mpam_msc *msc, u16 reg, u16 wd)
__mpam_write_reg(msc, reg, bm);
}
+static void mpam_apply_t241_erratum(struct mpam_msc_ris *ris, u16 partid)
+{
+ int sidx, i, lcount = 1000;
+ void __iomem *regs;
+ u64 val0, val;
+
+ regs = t241_scratch_regs[ris->vmsc->msc->t241_id];
+
+ for (i = 0; i < lcount; i++) {
+ /* Read the shadow register at index 0 */
+ val0 = readq_relaxed(regs + T241_SHADOW_REG_OFF(0, partid));
+
+ /* Check if all the shadow registers have the same value */
+ for (sidx = 1; sidx < T241_CHIP_NSLICES; sidx++) {
+ val = readq_relaxed(regs +
+ T241_SHADOW_REG_OFF(sidx, partid));
+ if (val != val0)
+ break;
+ }
+ if (sidx == T241_CHIP_NSLICES)
+ break;
+ }
+
+ if (i == lcount)
+ pr_warn_once("t241: inconsistent values in shadow regs");
+
+ /* Write a value zero to spare registers to take effect of MBW conf */
+ writeq_relaxed(0, regs + T241_SPARE_REG0_OFF);
+ writeq_relaxed(0, regs + T241_SPARE_REG1_OFF);
+}
+
+static void mpam_quirk_post_config_change(struct mpam_msc_ris *ris, u16 partid,
+ struct mpam_config *cfg)
+{
+ if (mpam_has_quirk(T241_SCRUB_SHADOW_REGS, ris->vmsc->msc))
+ mpam_apply_t241_erratum(ris, partid);
+}
+
/* Called via IPI. Call while holding an SRCU reference */
static void mpam_reprogram_ris_partid(struct mpam_msc_ris *ris, u16 partid,
struct mpam_config *cfg)
@@ -1465,6 +1551,8 @@ static void mpam_reprogram_ris_partid(struct mpam_msc_ris *ris, u16 partid,
mpam_write_partsel_reg(msc, PRI, pri_val);
}
+ mpam_quirk_post_config_change(ris, partid, cfg);
+
mutex_unlock(&msc->part_sel_lock);
}
diff --git a/drivers/resctrl/mpam_internal.h b/drivers/resctrl/mpam_internal.h
index d60a3caf6f6e..9d15d37d4b5a 100644
--- a/drivers/resctrl/mpam_internal.h
+++ b/drivers/resctrl/mpam_internal.h
@@ -130,6 +130,9 @@ struct mpam_msc {
void __iomem *mapped_hwpage;
size_t mapped_hwpage_sz;
+ /* Values only used on some platforms for quirks */
+ u32 t241_id;
+
struct mpam_garbage garbage;
};
@@ -220,6 +223,7 @@ struct mpam_props {
/* Workaround bits for msc->quirks */
enum mpam_device_quirks {
+ T241_SCRUB_SHADOW_REGS,
MPAM_QUIRK_LAST
};
@@ -240,6 +244,11 @@ struct mpam_quirk {
FIELD_PREP_CONST(MPAMF_IIDR_REVISION, 0xf) | \
FIELD_PREP_CONST(MPAMF_IIDR_IMPLEMENTER, 0xfff)
+#define MPAM_IIDR_NVIDIA_T241 FIELD_PREP_CONST(MPAMF_IIDR_PRODUCTID, 0x241) | \
+ FIELD_PREP_CONST(MPAMF_IIDR_VARIANT, 0) | \
+ FIELD_PREP_CONST(MPAMF_IIDR_REVISION, 0) | \
+ FIELD_PREP_CONST(MPAMF_IIDR_IMPLEMENTER, 0x36b)
+
/* The values for MSMON_CFG_MBWU_FLT.RWBW */
enum mon_filter_options {
COUNT_BOTH = 0,
--
2.43.0
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 12 Jan 2026 16:59:11 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
From: Shanker Donthineni <sdonthineni@nvidia.com>
In the T241 implementation of memory-bandwidth partitioning, in the absence
of contention for bandwidth, the minimum bandwidth setting can affect the
amount of achieved bandwidth. Specifically, the achieved bandwidth in the
absence of contention can settle to any value between the values of
MPAMCFG_MBW_MIN and MPAMCFG_MBW_MAX. Also, if MPAMCFG_MBW_MIN is set
zero (below 0.78125%), once a core enters a throttled state, it will never
leave that state.
The first issue is not a concern if the MPAM software allows to program
MPAMCFG_MBW_MIN through the sysfs interface. This patch ensures program
MBW_MIN=1 (0.78125%) whenever MPAMCFG_MBW_MIN=0 is programmed.
In the scenario where the resctrl doesn't support the MBW_MIN interface via
sysfs, to achieve bandwidth closer to MBW_MAX in the absence of contention,
software should configure a relatively narrow gap between MBW_MIN and
MBW_MAX. The recommendation is to use a 5% gap to mitigate the problem.
[ morse: Added as second quirk, adapted to use the new intermediate values
in mpam_extend_config() ]
Signed-off-by: Shanker Donthineni <sdonthineni@nvidia.com>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
---
Changes since rfc:
MPAM_IIDR_NVIDIA_T421 -> MPAM_IIDR_NVIDIA_T241
Handling when reset_mbw_min is set
---
Documentation/arch/arm64/silicon-errata.rst | 2 ++
drivers/resctrl/mpam_devices.c | 34 +++++++++++++++++++--
drivers/resctrl/mpam_internal.h | 1 +
3 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/Documentation/arch/arm64/silicon-errata.rst b/Documentation/arch/arm64/silicon-errata.rst
index 4e86b85fe3d6..b18bc704d4a1 100644
--- a/Documentation/arch/arm64/silicon-errata.rst
+++ b/Documentation/arch/arm64/silicon-errata.rst
@@ -248,6 +248,8 @@ stable kernels.
+----------------+-----------------+-----------------+-----------------------------+
| NVIDIA | T241 MPAM | T241-MPAM-1 | N/A |
+----------------+-----------------+-----------------+-----------------------------+
+| NVIDIA | T241 MPAM | T241-MPAM-4 | N/A |
++----------------+-----------------+-----------------+-----------------------------+
+----------------+-----------------+-----------------+-----------------------------+
| Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 |
+----------------+-----------------+-----------------+-----------------------------+
diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
index bdf13a22d98f..884ca6a6d8f3 100644
--- a/drivers/resctrl/mpam_devices.c
+++ b/drivers/resctrl/mpam_devices.c
@@ -679,6 +679,12 @@ static const struct mpam_quirk mpam_quirks[] = {
.iidr_mask = MPAM_IIDR_MATCH_ONE,
.workaround = T241_SCRUB_SHADOW_REGS,
},
+ {
+ /* NVIDIA t241 erratum T241-MPAM-4 */
+ .iidr = MPAM_IIDR_NVIDIA_T241,
+ .iidr_mask = MPAM_IIDR_MATCH_ONE,
+ .workaround = T241_FORCE_MBW_MIN_TO_ONE,
+ },
{ NULL } /* Sentinel */
};
@@ -1464,6 +1470,17 @@ static void mpam_quirk_post_config_change(struct mpam_msc_ris *ris, u16 partid,
mpam_apply_t241_erratum(ris, partid);
}
+static u16 mpam_wa_t241_force_mbw_min_to_one(struct mpam_props *props)
+{
+ u16 max_hw_value, min_hw_granule, res0_bits;
+
+ res0_bits = 16 - props->bwa_wd;
+ max_hw_value = ((1 << props->bwa_wd) - 1) << res0_bits;
+ min_hw_granule = ~max_hw_value;
+
+ return min_hw_granule + 1;
+}
+
/* Called via IPI. Call while holding an SRCU reference */
static void mpam_reprogram_ris_partid(struct mpam_msc_ris *ris, u16 partid,
struct mpam_config *cfg)
@@ -1508,10 +1525,15 @@ static void mpam_reprogram_ris_partid(struct mpam_msc_ris *ris, u16 partid,
if (mpam_has_feature(mpam_feat_mbw_min, rprops) &&
mpam_has_feature(mpam_feat_mbw_min, cfg)) {
- if (cfg->reset_mbw_min)
- mpam_write_partsel_reg(msc, MBW_MIN, 0);
- else
+ if (cfg->reset_mbw_min) {
+ u16 reset = 0;
+
+ if (mpam_has_quirk(T241_FORCE_MBW_MIN_TO_ONE, msc))
+ reset = mpam_wa_t241_force_mbw_min_to_one(rprops);
+ mpam_write_partsel_reg(msc, MBW_MIN, reset);
+ } else {
mpam_write_partsel_reg(msc, MBW_MIN, cfg->mbw_min);
+ }
}
if (mpam_has_feature(mpam_feat_mbw_max, rprops) &&
@@ -2570,6 +2592,12 @@ static void mpam_extend_config(struct mpam_class *class, struct mpam_config *cfg
cfg->mbw_min = max(min, min_hw_granule);
mpam_set_feature(mpam_feat_mbw_min, cfg);
}
+
+ if (mpam_has_quirk(T241_FORCE_MBW_MIN_TO_ONE, class) &&
+ cfg->mbw_min <= min_hw_granule) {
+ cfg->mbw_min = min_hw_granule + 1;
+ mpam_set_feature(mpam_feat_mbw_min, cfg);
+ }
}
static void mpam_reset_component_cfg(struct mpam_component *comp)
diff --git a/drivers/resctrl/mpam_internal.h b/drivers/resctrl/mpam_internal.h
index 9d15d37d4b5a..7b4566814945 100644
--- a/drivers/resctrl/mpam_internal.h
+++ b/drivers/resctrl/mpam_internal.h
@@ -224,6 +224,7 @@ struct mpam_props {
/* Workaround bits for msc->quirks */
enum mpam_device_quirks {
T241_SCRUB_SHADOW_REGS,
+ T241_FORCE_MBW_MIN_TO_ONE,
MPAM_QUIRK_LAST
};
--
2.43.0
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 12 Jan 2026 16:59:12 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
From: Shanker Donthineni <sdonthineni@nvidia.com>
The registers MSMON_MBWU_L and MSMON_MBWU return the number of requests
rather than the number of bytes transferred.
Bandwidth resource monitoring is performed at the last level cache, where
each request arrive in 64Byte granularity. The current implementation
returns the number of transactions received at the last level cache but
does not provide the value in bytes. Scaling by 64 gives an accurate byte
count to match the MPAM specification for the MSMON_MBWU and MSMON_MBWU_L
registers. This patch fixes the issue by reporting the actual number of
bytes instead of the number of transactions from __ris_msmon_read().
Signed-off-by: Shanker Donthineni <sdonthineni@nvidia.com>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
---
Changes since rfc:
MPAM_IIDR_NVIDIA_T421 -> MPAM_IIDR_NVIDIA_T241
Don't apply workaround to MSMON_MBWU_LWD
---
Documentation/arch/arm64/silicon-errata.rst | 2 ++
drivers/resctrl/mpam_devices.c | 26 +++++++++++++++++++--
drivers/resctrl/mpam_internal.h | 1 +
3 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/Documentation/arch/arm64/silicon-errata.rst b/Documentation/arch/arm64/silicon-errata.rst
index b18bc704d4a1..e810b2a8f40e 100644
--- a/Documentation/arch/arm64/silicon-errata.rst
+++ b/Documentation/arch/arm64/silicon-errata.rst
@@ -250,6 +250,8 @@ stable kernels.
+----------------+-----------------+-----------------+-----------------------------+
| NVIDIA | T241 MPAM | T241-MPAM-4 | N/A |
+----------------+-----------------+-----------------+-----------------------------+
+| NVIDIA | T241 MPAM | T241-MPAM-6 | N/A |
++----------------+-----------------+-----------------+-----------------------------+
+----------------+-----------------+-----------------+-----------------------------+
| Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 |
+----------------+-----------------+-----------------+-----------------------------+
diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
index 884ca6a6d8f3..7409cb7edab4 100644
--- a/drivers/resctrl/mpam_devices.c
+++ b/drivers/resctrl/mpam_devices.c
@@ -685,6 +685,12 @@ static const struct mpam_quirk mpam_quirks[] = {
.iidr_mask = MPAM_IIDR_MATCH_ONE,
.workaround = T241_FORCE_MBW_MIN_TO_ONE,
},
+ {
+ /* NVIDIA t241 erratum T241-MPAM-6 */
+ .iidr = MPAM_IIDR_NVIDIA_T241,
+ .iidr_mask = MPAM_IIDR_MATCH_ONE,
+ .workaround = T241_MBW_COUNTER_SCALE_64,
+ },
{ NULL } /* Sentinel */
};
@@ -1146,7 +1152,7 @@ static void write_msmon_ctl_flt_vals(struct mon_read *m, u32 ctl_val,
}
}
-static u64 mpam_msmon_overflow_val(enum mpam_device_features type)
+static u64 __mpam_msmon_overflow_val(enum mpam_device_features type)
{
/* TODO: implement scaling counters */
switch (type) {
@@ -1161,6 +1167,18 @@ static u64 mpam_msmon_overflow_val(enum mpam_device_features type)
}
}
+static u64 mpam_msmon_overflow_val(enum mpam_device_features type,
+ struct mpam_msc *msc)
+{
+ u64 overflow_val = __mpam_msmon_overflow_val(type);
+
+ if (mpam_has_quirk(T241_MBW_COUNTER_SCALE_64, msc) &&
+ type != mpam_feat_msmon_mbwu_63counter)
+ overflow_val *= 64;
+
+ return overflow_val;
+}
+
static void __ris_msmon_read(void *arg)
{
u64 now;
@@ -1251,13 +1269,17 @@ static void __ris_msmon_read(void *arg)
now = FIELD_GET(MSMON___VALUE, now);
}
+ if (mpam_has_quirk(T241_MBW_COUNTER_SCALE_64, msc) &&
+ m->type != mpam_feat_msmon_mbwu_63counter)
+ now *= 64;
+
if (nrdy)
break;
mbwu_state = &ris->mbwu_state[ctx->mon];
if (overflow)
- mbwu_state->correction += mpam_msmon_overflow_val(m->type);
+ mbwu_state->correction += mpam_msmon_overflow_val(m->type, msc);
/*
* Include bandwidth consumed before the last hardware reset and
diff --git a/drivers/resctrl/mpam_internal.h b/drivers/resctrl/mpam_internal.h
index 7b4566814945..1680d1036472 100644
--- a/drivers/resctrl/mpam_internal.h
+++ b/drivers/resctrl/mpam_internal.h
@@ -225,6 +225,7 @@ struct mpam_props {
enum mpam_device_quirks {
T241_SCRUB_SHADOW_REGS,
T241_FORCE_MBW_MIN_TO_ONE,
+ T241_MBW_COUNTER_SCALE_64,
MPAM_QUIRK_LAST
};
--
2.43.0
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 12 Jan 2026 16:59:13 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
From: James Morse <james.morse@arm.com>
CMN-650 is afflicted with an erratum where the CSU NRDY bit never clears.
This tells us the monitor never finishes scanning the cache. The erratum
document says to wait the maximum time, then ignore the field.
Add a flag to indicate whether this is the final attempt to read the
counter, and when this quirk is applied, ignore the NRDY field.
This means accesses to this counter will always retry, even if the counter
was previously programmed to the same values.
The counter value is not expected to be stable, it drifts up and down with
each allocation and eviction. The CSU register provides the value for a
point in time.
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
---
Documentation/arch/arm64/silicon-errata.rst | 3 +++
drivers/resctrl/mpam_devices.c | 12 ++++++++++++
drivers/resctrl/mpam_internal.h | 6 ++++++
3 files changed, 21 insertions(+)
diff --git a/Documentation/arch/arm64/silicon-errata.rst b/Documentation/arch/arm64/silicon-errata.rst
index e810b2a8f40e..3667650036fb 100644
--- a/Documentation/arch/arm64/silicon-errata.rst
+++ b/Documentation/arch/arm64/silicon-errata.rst
@@ -213,6 +213,9 @@ stable kernels.
| ARM | GIC-700 | #2941627 | ARM64_ERRATUM_2941627 |
+----------------+-----------------+-----------------+-----------------------------+
+----------------+-----------------+-----------------+-----------------------------+
+| ARM | CMN-650 | #3642720 | N/A |
++----------------+-----------------+-----------------+-----------------------------+
++----------------+-----------------+-----------------+-----------------------------+
| Broadcom | Brahma-B53 | N/A | ARM64_ERRATUM_845719 |
+----------------+-----------------+-----------------+-----------------------------+
| Broadcom | Brahma-B53 | N/A | ARM64_ERRATUM_843419 |
diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
index 7409cb7edab4..e6c9ddaa60e2 100644
--- a/drivers/resctrl/mpam_devices.c
+++ b/drivers/resctrl/mpam_devices.c
@@ -691,6 +691,12 @@ static const struct mpam_quirk mpam_quirks[] = {
.iidr_mask = MPAM_IIDR_MATCH_ONE,
.workaround = T241_MBW_COUNTER_SCALE_64,
},
+ {
+ /* ARM CMN-650 CSU erratum 3642720 */
+ .iidr = MPAM_IIDR_ARM_CMN_650,
+ .iidr_mask = MPAM_IIDR_MATCH_ONE,
+ .workaround = IGNORE_CSU_NRDY,
+ },
{ NULL } /* Sentinel */
};
@@ -1003,6 +1009,7 @@ struct mon_read {
enum mpam_device_features type;
u64 *val;
int err;
+ bool waited_timeout;
};
static bool mpam_ris_has_mbwu_long_counter(struct mpam_msc_ris *ris)
@@ -1249,6 +1256,10 @@ static void __ris_msmon_read(void *arg)
if (mpam_has_feature(mpam_feat_msmon_csu_hw_nrdy, rprops))
nrdy = now & MSMON___NRDY;
now = FIELD_GET(MSMON___VALUE, now);
+
+ if (mpam_has_quirk(IGNORE_CSU_NRDY, msc) && m->waited_timeout)
+ nrdy = false;
+
break;
case mpam_feat_msmon_mbwu_31counter:
case mpam_feat_msmon_mbwu_44counter:
@@ -1386,6 +1397,7 @@ int mpam_msmon_read(struct mpam_component *comp, struct mon_cfg *ctx,
.ctx = ctx,
.type = type,
.val = val,
+ .waited_timeout = true,
};
*val = 0;
diff --git a/drivers/resctrl/mpam_internal.h b/drivers/resctrl/mpam_internal.h
index 1680d1036472..0bd323728b53 100644
--- a/drivers/resctrl/mpam_internal.h
+++ b/drivers/resctrl/mpam_internal.h
@@ -226,6 +226,7 @@ enum mpam_device_quirks {
T241_SCRUB_SHADOW_REGS,
T241_FORCE_MBW_MIN_TO_ONE,
T241_MBW_COUNTER_SCALE_64,
+ IGNORE_CSU_NRDY,
MPAM_QUIRK_LAST
};
@@ -251,6 +252,11 @@ struct mpam_quirk {
FIELD_PREP_CONST(MPAMF_IIDR_REVISION, 0) | \
FIELD_PREP_CONST(MPAMF_IIDR_IMPLEMENTER, 0x36b)
+#define MPAM_IIDR_ARM_CMN_650 FIELD_PREP_CONST(MPAMF_IIDR_PRODUCTID, 0) | \
+ FIELD_PREP_CONST(MPAMF_IIDR_VARIANT, 0) | \
+ FIELD_PREP_CONST(MPAMF_IIDR_REVISION, 0) | \
+ FIELD_PREP_CONST(MPAMF_IIDR_IMPLEMENTER, 0x43b)
+
/* The values for MSMON_CFG_MBWU_FLT.RWBW */
enum mon_filter_options {
COUNT_BOTH = 0,
--
2.43.0
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 12 Jan 2026 16:59:14 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On 1/12/26 08:58, Ben Horgan wrote:
Reviewed-by: Fenghua Yu <fenghuay@nvidia.com>
Thanks.
-Fenghua
|
{
"author": "Fenghua Yu <fenghuay@nvidia.com>",
"date": "Mon, 12 Jan 2026 09:13:24 -0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, 12 Jan 2026 16:58:39 +0000
Ben Horgan <ben.horgan@arm.com> wrote:
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
|
{
"author": "Jonathan Cameron <jonathan.cameron@huawei.com>",
"date": "Tue, 13 Jan 2026 14:19:16 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, 12 Jan 2026 16:58:40 +0000
Ben Horgan <ben.horgan@arm.com> wrote:
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
nvhe
|
{
"author": "Jonathan Cameron <jonathan.cameron@huawei.com>",
"date": "Tue, 13 Jan 2026 14:21:04 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Jonathan,
On 1/13/26 14:21, Jonathan Cameron wrote:
In this case, I do mean arm64_sw.hvhe which is the configuration when
kvm-arm.mode=protected. The aliasing of the registers when E2H is set
meant that the read_sysreg_s(SYS_MPAM1_EL1) was actually accessing
SYS_MPAM2_EL2 and so the read and write were for the same value.
Thanks,
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Tue, 13 Jan 2026 14:35:16 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, 12 Jan 2026 16:58:44 +0000
Ben Horgan <ben.horgan@arm.com> wrote:
There was a question from Zhengheng on v2 that doesn't seem to be addressed
and I'm not seeing a reply on list. Maybe an email snafu?
https://lore.kernel.org/all/20260109034506.1176234-1-zengheng4@huawei.com/
Please +CC zhengheng on future versions if we need them!
Thanks,
Jonathan
|
{
"author": "Jonathan Cameron <jonathan.cameron@huawei.com>",
"date": "Tue, 13 Jan 2026 14:46:35 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, 12 Jan 2026 16:58:51 +0000
Ben Horgan <ben.horgan@arm.com> wrote:
Much easier to read. Thanks!
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
|
{
"author": "Jonathan Cameron <jonathan.cameron@huawei.com>",
"date": "Tue, 13 Jan 2026 14:55:40 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Jonathan, Zeng,
On 1/13/26 14:46, Jonathan Cameron wrote:
Yes, sorry! For some reason I don't get his emails. :( It happened on
the base mpam driver series too. I'll keep a better look at lore and
reply to his v2 query.
Will do. Should be CC'd on this version too. I don't if there is an
email issue with that too.
Thanks,
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Tue, 13 Jan 2026 14:58:41 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, 12 Jan 2026 16:58:52 +0000
Ben Horgan <ben.horgan@arm.com> wrote:
I'm not sure this particular test brings a massive amount of value, but
I'm not one to object to more tests!
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
|
{
"author": "Jonathan Cameron <jonathan.cameron@huawei.com>",
"date": "Tue, 13 Jan 2026 14:59:55 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, 12 Jan 2026 16:58:53 +0000
Ben Horgan <ben.horgan@arm.com> wrote:
I don't mind the patch but I'm not entirely following this comment. Is
the point that previously there was a sneaky user before this was added in
the series?
Anyhow, that's not in the patch itself so
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
|
{
"author": "Jonathan Cameron <jonathan.cameron@huawei.com>",
"date": "Tue, 13 Jan 2026 15:01:59 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, 12 Jan 2026 16:58:54 +0000
Ben Horgan <ben.horgan@arm.com> wrote:
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
|
{
"author": "Jonathan Cameron <jonathan.cameron@huawei.com>",
"date": "Tue, 13 Jan 2026 15:06:18 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, 12 Jan 2026 16:58:57 +0000
Ben Horgan <ben.horgan@arm.com> wrote:
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
|
{
"author": "Jonathan Cameron <jonathan.cameron@huawei.com>",
"date": "Tue, 13 Jan 2026 15:10:25 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Jonathan,
On 1/13/26 15:01, Jonathan Cameron wrote:
Yes, arm_mpam: resctrl: Add support for 'MB' resource, accesses
cacheinfo so wanted to order this patch before that.
Thanks,
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Tue, 13 Jan 2026 15:15:43 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, 12 Jan 2026 16:58:59 +0000
Ben Horgan <ben.horgan@arm.com> wrote:
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
|
{
"author": "Jonathan Cameron <jonathan.cameron@huawei.com>",
"date": "Tue, 13 Jan 2026 15:26:38 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, 12 Jan 2026 16:59:08 +0000
Ben Horgan <ben.horgan@arm.com> wrote:
I'm interested to see how this plays out as a default choice
vs what people elect to run. Seems harmless to start with this.
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
|
{
"author": "Jonathan Cameron <jonathan.cameron@huawei.com>",
"date": "Tue, 13 Jan 2026 15:39:38 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, 12 Jan 2026 16:59:09 +0000
Ben Horgan <ben.horgan@arm.com> wrote:
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
|
{
"author": "Jonathan Cameron <jonathan.cameron@huawei.com>",
"date": "Tue, 13 Jan 2026 15:43:36 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Ben,
(Please note I am unfamiliar with this code so missing some context.)
On 1/12/26 8:58 AM, Ben Horgan wrote:
It should not be necessary to offline the control domain if attempt to
online it failed but removing it from the ctrl_domains list is necessary. What
happens to memory dom points to?
This error path is unexpected to me. From what I can tell, if there is a problem
initializing the monitor domain this flow will undo both monitor and control domain,
even if initialization of control domain was successful. In this case:
- Flow jumps to error path from within the if (exposed_mon_capable) block and proceeds
to do control domain cleanup without considering whether control domain was initialized
or not. That is, does not take exposed_alloc_capable into account
- Control domain cleanup seems to be partial, for example, should it remove domain from ctrl_domains list?
- On failure there is dom = ERR_PTR(err) but I cannot see where this memory is freed in both
the monitor and control domain error paths.
On success, should cpu be added to the respective headers' cpumask?
Reinette
|
{
"author": "Reinette Chatre <reinette.chatre@intel.com>",
"date": "Tue, 13 Jan 2026 08:49:29 -0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Ben,
On 1/12/26 8:58 AM, Ben Horgan wrote:
fyi ... [1] enabled total memory bandwidth to also be used as input to
software controller and additionally enabled user space to set per resource group
which memory bandwidth event is used as input to the software controller.
Reinette
[1] https://lore.kernel.org/all/20241206163148.83828-1-tony.luck@intel.com/
|
{
"author": "Reinette Chatre <reinette.chatre@intel.com>",
"date": "Tue, 13 Jan 2026 14:18:48 -0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Ben,
On 1/12/26 8:58 AM, Ben Horgan wrote:
Reading the above loop and how it is used to call mpam_resctrl_monitor_init() for every event
it looks like there is an implicit assumption that MPAM supports all events known to
resctrl.
Please consider the most recent resctrl feature "telemetry monitoring" currently queued
for inclusion: https://lore.kernel.org/lkml/20251217172121.12030-1-tony.luck@intel.com/
(You can find latest resctrl code queued for inclusion on the x86/cache branch of
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git)
New telemetry monitoring introduces several new events known to resctrl. Specifically, here
is how enum resctrl_event_id looks at the moment:
/* Event IDs */
enum resctrl_event_id {
/* Must match value of first event below */
QOS_FIRST_EVENT = 0x01,
/*
* These values match those used to program IA32_QM_EVTSEL before
* reading IA32_QM_CTR on RDT systems.
*/
QOS_L3_OCCUP_EVENT_ID = 0x01,
QOS_L3_MBM_TOTAL_EVENT_ID = 0x02,
QOS_L3_MBM_LOCAL_EVENT_ID = 0x03,
/* Intel Telemetry Events */
PMT_EVENT_ENERGY,
PMT_EVENT_ACTIVITY,
PMT_EVENT_STALLS_LLC_HIT,
PMT_EVENT_C1_RES,
PMT_EVENT_UNHALTED_CORE_CYCLES,
PMT_EVENT_STALLS_LLC_MISS,
PMT_EVENT_AUTO_C6_RES,
PMT_EVENT_UNHALTED_REF_CYCLES,
PMT_EVENT_UOPS_RETIRED,
/* Must be the last */
QOS_NUM_EVENTS,
};
...
btw, the telemetry work also changed this function prototype to be:
bool resctrl_enable_mon_event(enum resctrl_event_id eventid, bool any_cpu,
unsigned int binary_bits, void *arch_priv);
If I understand correctly resctrl_enable_mon_event() will be called for every event in
enum resctrl_event_id which now contains events that may not actually be supported. I think it
may be safer to be specific in which events MPAM wants to enable.
The idea of adding a per MON group "num_mon_groups" file has been floated a couple of
times now. I have not heard any objections against doing something like this.
https://lore.kernel.org/all/cbe665c2-fe83-e446-1696-7115c0f9fd76@arm.com/
https://lore.kernel.org/lkml/46767ca7-1f1b-48e8-8ce6-be4b00d129f9@intel.com/
Reinette
|
{
"author": "Reinette Chatre <reinette.chatre@intel.com>",
"date": "Tue, 13 Jan 2026 15:14:29 -0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Another advantage is that, given the small size of the L2 cache,
frequent switching of MPAM configurations between kernel and user modes
can cause cache-capacity jitter, making it difficult to isolate
interference from noisy neighborhood.
However, in addition to the issues mentioned above, updating the
MPAM1_EL1 configuration also exposes interrupt handling to the MPAM
settings of the current task.
I still agree with the current modification of setting MPAM1_EL1 to the
same value as MPAM0_EL1. However, the ARM MPAM hardware supports more
flexible configuration schemes than x86 RDT and another approach is also
worth considering: Software can let a control group choose whether
kernel mode follows the user mode MPAM settings, or whether the kernel
mode configuration is delegated to the default control group, though
this may change the existing user interface.
At the LPC resctrl micro-conference, Babu also mentioned the PLZA proposal
as an attempt to address the issues raised above. Seems like no clear
interface was presented yet. Wait to see what new interface that solution
will introduce.
One last thing, please add me to the CC list for future MPAM patch series.
I'll provide timely testing on my local aarch64 environment and review
feedback. Thanks.
Best Regards,
Zeng Heng
|
{
"author": "Zeng Heng <zengheng4@huawei.com>",
"date": "Wed, 14 Jan 2026 14:51:49 +0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, 12 Jan 2026 16:58:39 +0000,
Ben Horgan <ben.horgan@arm.com> wrote:
What's the rationale for doing this independently of rest of the MPAM
stuff in __activate_traps_mpam()?
M.
--
Without deviation from the norm, progress is not possible.
|
{
"author": "Marc Zyngier <maz@kernel.org>",
"date": "Wed, 14 Jan 2026 12:06:28 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, 12 Jan 2026 16:58:40 +0000,
Ben Horgan <ben.horgan@arm.com> wrote:
Is it really OK to not preserve the rest of MPAM2_EL2? This explicitly
clears MPAM2_EL2.MPAMEN, which feels counter-productive.
M.
--
Without deviation from the norm, progress is not possible.
|
{
"author": "Marc Zyngier <maz@kernel.org>",
"date": "Wed, 14 Jan 2026 12:09:14 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Marc,
On 1/14/26 12:09, Marc Zyngier wrote:
There are 3 things to consider:
1. traps - these are only relevant when we leave EL2 and are dealt with
in __activate_traps_mpam(). (This also covers EnMPAMSM which is a
not-trap bit.)
2. MPAM2_EL2.MPAMEN - this is read only as long as we have an EL3 and if
we don't have EL3 will be 0 anyway from el2_setup.h and MPAM won't be
considered supported in the kernel.
3. The alternate partid space fields which are kept as zero and relate
to FEAT_RME.
So, safe. Ok with you or would you rather I make it more obviously safe?
Thanks,
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Wed, 14 Jan 2026 14:39:58 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Marc,
On 1/14/26 12:06, Marc Zyngier wrote:
The __activate_traps_mpam() is relevant even for nvhe but
__mpam_guest_load() is only need in vhe as otherwise we can rely on
MPAM1_EL1 and MPAM0_EL0 having the same partid/pmg configuration
(although this MPAM policy will likely become configurable sometime down
the line). Besides that it just makes the naming less exact.
Thanks,
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Wed, 14 Jan 2026 14:50:22 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Marc,
On 1/14/26 14:39, Ben Horgan wrote:
As discussed offline, to avoid having to reason about MPAM2_EL2.MPAMEN
I'll set this bit to 1 in this write as we are already assuming mpam is
enabled and we want to keep it enabled.
Thanks,
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Wed, 14 Jan 2026 16:50:50 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Wed, 14 Jan 2026 16:50:50 +0000,
Ben Horgan <ben.horgan@arm.com> wrote:
Sounds good, thanks.
M.
--
Without deviation from the norm, progress is not possible.
|
{
"author": "Marc Zyngier <maz@kernel.org>",
"date": "Wed, 14 Jan 2026 17:50:26 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On 1/13/26 12:58 AM, Ben Horgan wrote:
Reviewed-by: Gavin Shan <gshan@redhat.com>
|
{
"author": "Gavin Shan <gshan@redhat.com>",
"date": "Thu, 15 Jan 2026 10:12:57 +0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On 1/13/26 12:58 AM, Ben Horgan wrote:
Reviewed-by: Gavin Shan <gshan@redhat.com>
|
{
"author": "Gavin Shan <gshan@redhat.com>",
"date": "Thu, 15 Jan 2026 10:14:48 +0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On 1/13/26 12:58 AM, Ben Horgan wrote:
Reviewed-by: Gavin Shan <gshan@redhat.com>
|
{
"author": "Gavin Shan <gshan@redhat.com>",
"date": "Thu, 15 Jan 2026 10:16:08 +0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On 1/13/26 12:58 AM, Ben Horgan wrote:
Reviewed-by: Gavin Shan <gshan@redhat.com>
|
{
"author": "Gavin Shan <gshan@redhat.com>",
"date": "Thu, 15 Jan 2026 10:33:33 +0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On 1/13/26 12:58 AM, Ben Horgan wrote:
Reviewed-by: Gavin Shan <gshan@redhat.com>
|
{
"author": "Gavin Shan <gshan@redhat.com>",
"date": "Thu, 15 Jan 2026 10:34:32 +0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Ben,
On 1/13/26 12:58 AM, Ben Horgan wrote:
With the following nitpick addressed:
Reviewed-by: Gavin Shan <gshan@redhat.com>
Nitpick: Needn't include those two header files since they have been included
to <asm/mpam.h>
Thanks,
Gavin
|
{
"author": "Gavin Shan <gshan@redhat.com>",
"date": "Thu, 15 Jan 2026 14:47:28 +0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On 1/13/26 12:58 AM, Ben Horgan wrote:
Reviewed-by: Gavin Shan <gshan@redhat.com>
|
{
"author": "Gavin Shan <gshan@redhat.com>",
"date": "Thu, 15 Jan 2026 14:50:08 +0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Wed, 14 Jan 2026 14:50:22 +0000,
Ben Horgan <ben.horgan@arm.com> wrote:
It is completely unclear to me what enforces this. Please point me to
the code that does that.
Or not. the VM only exists as an extension of userspace, and I don't
see on what grounds it should get its own MPAM configuration.
I don't care about the naming. I care about how the configuration flow
is organised. And so far, this seems extremely messy.
Can you please document what gets configured when and in which mode?
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
|
{
"author": "Marc Zyngier <maz@kernel.org>",
"date": "Thu, 15 Jan 2026 09:05:28 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hello Ben,
Shouldn't it be return -EOPNOTSUPP;?
However, before the function update_rmid_limits() is called, there is a check: if (cache_has_usable_csu(class) && topology_matches_l3(class)).
cache_has_usable_csu(class) already contains an identical check. Therefore, I think it's safe to remove this redundant one.
Best regards,
Shaopeng TAN
|
{
"author": "\"Shaopeng Tan (Fujitsu)\" <tan.shaopeng@fujitsu.com>",
"date": "Thu, 15 Jan 2026 10:05:49 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Ben,
On Mon, Jan 12, 2026 at 5:59 PM Ben Horgan <ben.horgan@arm.com> wrote:
Like before, I applied the patches and successfully booted a kernel on
a baremetal Google Cloud C4A instance. I was able to confirm that the
resources we expect were present and I was able to successfully run
the monitor assignment test cases I used to validate ABMC on AMD
systems. (Though I had to hack the driver to pretend there were less
MBWU monitors so that the counter assignment interfaces would become
available.)
My use cases only cover resctrl in the host, so I didn't try any of
the KVM integration, but I can at least say there wasn't any evidence
that it interfered with resctrl.
Tested-by: Peter Newman <peternewman@google.com>
Thanks,
-Peter
|
{
"author": "Peter Newman <peternewman@google.com>",
"date": "Thu, 15 Jan 2026 12:14:19 +0100",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Marc,
On 1/15/26 09:05, Marc Zyngier wrote:
The new MPAM arch code always configures kernel space MPAM configuration
in tandem, same value to MPAM0_EL1 and MPAM1_EL1 (will access MPAM2_EL2
in vhe).
For the cpu part see
PATCH v3 07 arm64: mpam: Re-initialise MPAM regs when CPU comes online
and for context switching part see
PATCH v3 06 arm64: mpam: Context switch the MPAM registers
There are no plans to give the VM it's own MPAM configuration. The
intent of this patch is to give all the code running in the VM, whether
or not it is at EL0 or EL1, uses the MPAM partid/pmg configuration of
the userspace VMM that is running it. What I was alluding to here is
that if a future host MPAM policy allows the partid/pmg to differ for
the kernel and userspace then we won't be able rely on the EL1
configuration matching EL0 in the nvhe case and so would have to copy
the host EL0 configuration to EL1 (and add a restore).
The goal is that all times the VM runs with the same MPAM partid/pmg
configuration
as the userspace vmm running it.
In VHE:
Host kernel configuration is in MPAM2_EL2
Host userspace configuration is in MPAM0_EL1
Guest kernel configuration needs to be in MPAM1_EL1 and so we copy it
there from MPAM0_EL1 when
switching to the guest. On switching back to the host we can just leave
it there as the host doesn't use it.
Guest userspace configuration is in MPAM0_EL1, just keep that unchanged.
In nVHE:
Host kernel configuration is in MPAM1_EL1
Host userspace configuration is in MPAM0_EL1
Once again, guest userspace configuration is in MPAM0_EL1, just keep
that unchanged. As host policy ensures MPAM0_EL1 == MPAM1_EL1 for
pmg/partid we rely on this to skip changing MPAM1_EL1 on guest entry and
to skip the restore on guest exit.
I hope this makes the intent clearer.
Would you prefer to decouple the kvm handling of the MPAM configuration
from the host policy? If so, I expect the MPAM handling can be done
together in __activate_traps_mpam().
Thoughts?
Thanks,
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Thu, 15 Jan 2026 11:14:36 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Peter,
On 1/15/26 11:14, Peter Newman wrote:
[...]
Thanks for the testing!
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Thu, 15 Jan 2026 11:36:47 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Thu, 15 Jan 2026 14:47:28 +0800
Gavin Shan <gshan@redhat.com> wrote:
I commented on the nitpick.
That is a non obvious include chain that we should not rely on.
Please keep the headers and continue to follow include what you use
style (with exceptions when a given header is clearly documented as always including
another like some of the bit map stuff.) It is more obviously correct and
causes less grief if headers get refactored in future.
|
{
"author": "Jonathan Cameron <jonathan.cameron@huawei.com>",
"date": "Thu, 15 Jan 2026 12:09:23 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Zeng,
+CC Babu (Comments on PLZA)
On 1/14/26 06:51, Zeng Heng wrote:
Makes sense, thanks for these two observations.
I wonder if this would be possible in AMD PLZA as well. Babu?
Yes, I watched a recording of that. :)
Will do. Apologies for not doing this earlier and thank you for the
promise of testing and reviews :) There is a v3 which you have hopefully
seen.
Thanks,
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Thu, 15 Jan 2026 14:37:31 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Reinette,
On 1/13/26 23:14, Reinette Chatre wrote:
I'll test against this.
[...]
Thanks for bringing this to my attention. mpam_resctrl_monitor_init()
won't be called for all events known to resctrl as
mpam_resctrl_pick_counters() will only set a class for the 3 that MPAM
knows about. Still, it is probably best to restrict the iterator to the
relevant ones.
I will update to use the new signature.
As noted above, this only happens for the ones chosen
mpam_resctrl_pick_counters().
Hmm, I see now that 'num_rmid' is documented as an upper bound and so
neither 1 or mpam_pmg_max + 1 agree with the documentation.
"
"num_rmids":
The number of RMIDs available. This is the
upper bound for how many "CTRL_MON" + "MON"
groups can be created.
"
So, if I understand correctly you're proposing setting
num_rmids = num_pmg * num_partids on arm platforms and that in the
interim this can then be used to calculate the num_pmg by calculating
num_closid/num_rmid but that a per CTRL_MON num_mon_groups should be
added to make this consistent across architectures?
I appreciate that you have shared this resctrl knowledge with me.
Thanks,
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Thu, 15 Jan 2026 15:43:54 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Ben,
On Mon, Jan 12, 2026 at 6:02 PM Ben Horgan <ben.horgan@arm.com> wrote:
Are remote memory accesses not cached? How do we know an MBWU monitor
residing on a cache won't count remote traffic?
Thanks,
-Peter
|
{
"author": "Peter Newman <peternewman@google.com>",
"date": "Thu, 15 Jan 2026 16:49:20 +0100",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Shaopeng,
On 1/15/26 10:05, Shaopeng Tan (Fujitsu) wrote:
The intent of returning 0 here is that if csu is not supported on this
class then there is nothing to do and hence no error.
Yes, the check is redundant and can be removed. (If it were to stay it
should be moved to be before call get_cpu_cacheinfo_level() call so that
wouldn't give spurious errors for non-cache cpus.)
Thanks,
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Thu, 15 Jan 2026 16:02:47 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, Jan 12, 2026 at 04:58:33PM +0000, Ben Horgan wrote:
Since we have an isb() already, does it make any difference if we write
MPAM0 before the barrier? Similar question for other places where we
write these two registers.
At some point, we should go through __switch_to() and coalesce the isbs
into fewer as we keep accumulating them (e.g. all those switch function
setting some sync variable if needed).
Is it too expensive to read the MPAM sysregs and avoid carrying around
another per-CPU state? You use it for pm restoring but we could just
save it in cpu_do_suspend() like other sysregs. Not a big issue, it just
feels like this function got unnecessarily complicated (it took me a bit
to figure out what it all does).
A related question - is resctrl_arch_set_cdp_enabled() always called in
non-preemptible contexts? We potentially have a race between setting
current->mpam_partid_msg and arm64_mpam_global_default, so the check in
mpam_thread_switch() can get confused.
And I couldn't figure out where the MPAMx_EL1 registers are written. If
any global/per-cpu/per-task value is changed, does the kernel wait until
the next thread switch to write the sysreg? The only places I can found
touching these sysregs are the thread switch, pm notifiers and KVM.
--
Catalin
|
{
"author": "Catalin Marinas <catalin.marinas@arm.com>",
"date": "Thu, 15 Jan 2026 17:58:15 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, Jan 12, 2026 at 04:58:30PM +0000, Ben Horgan wrote:
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
|
{
"author": "Catalin Marinas <catalin.marinas@arm.com>",
"date": "Thu, 15 Jan 2026 17:59:05 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, Jan 12, 2026 at 04:58:34PM +0000, Ben Horgan wrote:
Is this comment about priority inversion no longer valid? I see thread
switching sets the same value for both MPAM0 and MPAM1 registers but I
couldn't find an explanation why this is now better when it wasn't
before.
MPAM1 will also be inherited by IRQ handlers AFAICT.
I mentioned before, is it worth waiting until ERET?
Related to this, do LDTR/STTR use MPAM0 or MPAM1? I couldn't figure out
from the Arm ARM. If they use MPAM0, then we need the ISB early for the
uaccess routines, at least in the thread switching path (an earlier
patch).
--
Catalin
|
{
"author": "Catalin Marinas <catalin.marinas@arm.com>",
"date": "Thu, 15 Jan 2026 18:14:09 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, Jan 12, 2026 at 04:58:35PM +0000, Ben Horgan wrote:
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
|
{
"author": "Catalin Marinas <catalin.marinas@arm.com>",
"date": "Thu, 15 Jan 2026 18:16:49 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, Jan 12, 2026 at 04:58:36PM +0000, Ben Horgan wrote:
This looks fine unless we decide to save/restore them in the low-level
suspend/resume functions.
--
Catalin
|
{
"author": "Catalin Marinas <catalin.marinas@arm.com>",
"date": "Thu, 15 Jan 2026 18:20:02 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Ben,
On 1/15/26 7:43 AM, Ben Horgan wrote:
...
Please note that this documentation has been refactored (without changing its
meaning). The above quoted text is specific to L3 monitoring and with the
addition of telemetry monitoring the relevant text now reads:
The upper bound for how many "CTRL_MON" + "MON" can be created
is the smaller of the L3_MON and PERF_PKG_MON "num_rmids" values.
Yes for num_rmids = num_pmg * num_partids. The motivation for this is that to me
this looks like the value that best matches the num_rmids documentation. I understand
the RMID vs PMG is difficult so my proposal is certainly not set in stone and I would like to
hear motivation for different interpretations. "calculating num_pmg" is not obvious
though. I interpret "num_pmg" here as number of monitor groups per control group and on
an Arm system this is indeed num_closid/num_rmids (if num_rmids = num_pmg * num_partids)
but on x86 it is just num_rmids. Having user space depend on such computation to determine how
many monitor groups per control group would thus require that user space knows whether the
underlying system is Arm or x86 and would go against goal of having resctrl as a generic interface.
The way forward may be to deprecate (somehow) num_rmids and transition to something
like "num_mon_groups" but it is currently vague how "num_mon_groups" may look like. That thread
(https://lore.kernel.org/lkml/46767ca7-1f1b-48e8-8ce6-be4b00d129f9@intel.com/) fizzled
out after raising a few options how it may look.
Another proposal was to add a "mon_id_includes_control_id" to use as another "guide" to
determine how many monitoring groups can be created but at the time it seemed an intermediary
step for user to determine the number of monitor groups that resctrl can also provide.
https://lore.kernel.org/lkml/CALPaoChad6=xqz+BQQd=dB915xhj1gusmcrS9ya+T2GyhTQc5Q@mail.gmail.com/
Making this consistent across architectures is the goal since resctrl aims to be
a generic interface. Users should not need to do things like infer which system they
are running on by looking at output of resctrl files as mentioned.
fwiw ... there seems to be a usage by Google to compare num_rmids to num_closids to determine
how to interact with resctrl:
https://lore.kernel.org/lkml/CALPaoCgSO7HzK9BjyM8yL50oPyq9kBj64Nkgyo1WEJrWy5uHUg@mail.gmail.com/
Reinette
|
{
"author": "Reinette Chatre <reinette.chatre@intel.com>",
"date": "Thu, 15 Jan 2026 10:54:45 -0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, Jan 12, 2026 at 04:58:37PM +0000, Ben Horgan wrote:
Do we know for sure that system_supports_sme() returns true at this
point (if SME supported)? Digging into the code, system_supports_sme()
uses alternative_has_cap_unlikely() which relies on instruction
patching. setup_system_capabilities(), IIUC, patches the alternatives
after enable_cpu_capabilities(). I think you better use cpus_have_cap().
--
Catalin
|
{
"author": "Catalin Marinas <catalin.marinas@arm.com>",
"date": "Thu, 15 Jan 2026 19:08:47 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, Jan 12, 2026 at 04:58:38PM +0000, Ben Horgan wrote:
Isn't this function, together with mpam_thread_switch(), in an enclosing
#ifdef already?
--
Catalin
|
{
"author": "Catalin Marinas <catalin.marinas@arm.com>",
"date": "Thu, 15 Jan 2026 19:13:45 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, Jan 12, 2026 at 04:59:06PM +0000, Ben Horgan wrote:
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
|
{
"author": "Catalin Marinas <catalin.marinas@arm.com>",
"date": "Thu, 15 Jan 2026 19:16:48 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi, Shanker and Ben,
On 1/12/26 08:59, Ben Horgan wrote:
When MBW_MIN=1, min mem bw can be very low when contention. This may
drop mem access performance. Is it possible to set MBW_MIN bigger so
that ensure the floor of mem access is high?
Thanks.
-Fenghua
|
{
"author": "Fenghua Yu <fenghuay@nvidia.com>",
"date": "Thu, 15 Jan 2026 15:20:55 -0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Reinette, Peter,
On 1/15/26 18:54, Reinette Chatre wrote:
Ok, I don't really see another option.
The motivation for this is that to me
Just thinking about it now but the "mon_id_includes_control_id" option
seems the best to me as it is a single bit option that along with
"num_rmids" let's you know which monitor groups you can create and if
it's sensible to move monitor groups between CTRL MON groups.
The "num_mon_groups" per CTRL MON group would also need to be
interpreted together with "num_rmid" to know if it is a global or per
CTRL MON upper bound. This option also uses multiple files to give the
same bit of information.
Unfortunately, it looks like we're about to break this heuristic :( At
least, until a way to get this information generically in resctrl is
decided upon.
Thanks,
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Fri, 16 Jan 2026 10:29:01 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hello Ben,
$ echo "default" | sudo tee /sys/fs/resctrl/info/L3_MON/mbm_assign_mode
default
tee: /sys/fs/resctrl/info/L3_MON/mbm_assign_mode:Invalid argument
"return -EOPNOTSUPP;" might be better.
Best regards,
Shaopeng TAN
|
{
"author": "\"Shaopeng Tan (Fujitsu)\" <tan.shaopeng@fujitsu.com>",
"date": "Fri, 16 Jan 2026 10:34:27 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hello Ben,
I ran the MPAM driver on NVIDIA's Grace machine, and it seems to be working fine.
Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
|
{
"author": "\"Shaopeng Tan (Fujitsu)\" <tan.shaopeng@fujitsu.com>",
"date": "Fri, 16 Jan 2026 10:47:40 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Shaopeng,
On 1/16/26 10:34, Shaopeng Tan (Fujitsu) wrote:
[...]
I'll keep this as -EINVAL in the case when 'enable' matches the current mode
and change it to return 0 when there is nothing to change. This will match the
behaviour once this is handled in resctrl. See the outcome of the discussion on
this resctrl patch [1] Note, that I haven't yet updated the patch to match the
discussion. Any objection?
[1] https://lore.kernel.org/lkml/bf8bb682-6a4d-4f39-916c-952719fcf48d@arm.com/
Thanks,
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Fri, 16 Jan 2026 11:04:24 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Shaopeng,
On 1/16/26 10:47, Shaopeng Tan (Fujitsu) wrote:
Thanks for the testing!
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Fri, 16 Jan 2026 11:05:57 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, Jan 12, 2026 at 04:58:29PM +0000, Ben Horgan wrote:
After discussing privately, I can see how test__props_mismatch() can
end up with unaligned atomics on the mmap_props::features array. Happy to
pick it up for 6.19 (probably the first patch as well, though that's
harmless).
Is there a Fixes tag here for future reference?
--
Catalin
|
{
"author": "Catalin Marinas <catalin.marinas@arm.com>",
"date": "Fri, 16 Jan 2026 11:57:25 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Catalin,
On 1/16/26 11:57, Catalin Marinas wrote:
Yes please.
Yes, the mpam_set/clear macros were introduced in
Fixes: 8c90dc68a5de ("arm_mpam: Probe the hardware features resctrl supports")
Thanks,
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Fri, 16 Jan 2026 12:02:06 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On 1/16/26 12:02, Ben Horgan wrote:
The mpam_set_clear() actually comes after in:
c10ca83a7783 arm_mpam: Merge supported features during mpam_enable() into mpam_class
but I think the fixes below is still the correct one as it is where we could
first start seeing the problem.
Thanks,
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Fri, 16 Jan 2026 12:12:53 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Mon, 12 Jan 2026 16:58:27 +0000, Ben Horgan wrote:
Applied to arm64 (for-next/fixes), thanks!
[01/47] arm_mpam: Remove duplicate linux/srcu.h header
https://git.kernel.org/arm64/c/b5a69c486921
[02/47] arm_mpam: Use non-atomic bitops when modifying feature bitmap
https://git.kernel.org/arm64/c/b9f5c38e4af1
--
Catalin
|
{
"author": "Catalin Marinas <catalin.marinas@arm.com>",
"date": "Fri, 16 Jan 2026 15:47:15 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On Fri, Jan 16, 2026 at 12:12:53PM +0000, Ben Horgan wrote:
Yes, I left the original as that's the one first introducing the atomic
bitops on this structure.
--
Catalin
|
{
"author": "Catalin Marinas <catalin.marinas@arm.com>",
"date": "Fri, 16 Jan 2026 15:51:02 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On 1/13/26 12:58 AM, Ben Horgan wrote:
The L3 cache partitioning and MBW (soft) limiting works fine on NVidia's grace-hopper machine.
Tested-by: Gavin Shan <gshan@redhat.com>
Thanks,
Gavin
|
{
"author": "Gavin Shan <gshan@redhat.com>",
"date": "Mon, 19 Jan 2026 09:30:32 +0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Ben,
On 1/13/26 12:58 AM, Ben Horgan wrote:
mpam_register_requestor() is exposed until CONFIG_ARM64_MPAM_DRIVER is set.
CONFIG_ARM64_MPAM_DRIVER and CONFIG_ARM64_MPAM can be different until PATCH[39/47]
is applied. So we need PATCH[39/47] to be applied prior to this patch so that
mpam_register_requestor() is always existing and exposed.
Thanks,
Gavin
|
{
"author": "Gavin Shan <gshan@redhat.com>",
"date": "Mon, 19 Jan 2026 14:37:46 +0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On 1/13/26 12:58 AM, Ben Horgan wrote:
Reviewed-by: Gavin Shan <gshan@redhat.com>
|
{
"author": "Gavin Shan <gshan@redhat.com>",
"date": "Mon, 19 Jan 2026 14:40:59 +0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Ben,
On 1/13/26 12:58 AM, Ben Horgan wrote:
One question below...
Need we ensure MPAM capability exists in the hardware before the notifier is registerred?
Otherwise, mpam_pm_notifier() can accesses SYS_MPAM0_EL1 and SYS_MPAM1_EL1 system registers
which may not supported by the hardware.
Thanks,
Gavin
|
{
"author": "Gavin Shan <gshan@redhat.com>",
"date": "Mon, 19 Jan 2026 14:50:16 +0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Ben,
On 1/13/26 12:58 AM, Ben Horgan wrote:
One nitpick below...
Reviewed-by: Gavin Shan <gshan@redhat.com>
{ } is missed here.
Thanks,
Gavin
|
{
"author": "Gavin Shan <gshan@redhat.com>",
"date": "Mon, 19 Jan 2026 14:51:40 +0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On 1/16/26 3:13 AM, Catalin Marinas wrote:
I think Catalin is correct that this ifdef inside mpam_set_task_partid_pmg()
can be dropped.
Thanks,
Gavin
|
{
"author": "Gavin Shan <gshan@redhat.com>",
"date": "Mon, 19 Jan 2026 14:56:46 +0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Ben,
On 1/13/26 12:58 AM, Ben Horgan wrote:
Nitpick: Alignment issues in the lines for 2nd/3rd/4th FIELD_PREP().
return FIELD_PREP(...) |
FIELD_PREP(...) |
FIELD_PREP(...) |
FIELD_PREP(...);
per_cpu(arm64_mpam_default) won't be reachable until CONFIG_ARM64_MPAM is set.
So I think both mpam_set_cpu_defaults() and __mpam_regval() need to be protected
by '#ifdef CONFIG_ARM64_MPAM ... #endif'.
Thanks,
Gavin
|
{
"author": "Gavin Shan <gshan@redhat.com>",
"date": "Mon, 19 Jan 2026 15:01:41 +0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Ben,
On 1/13/26 12:58 AM, Ben Horgan wrote:
A warning reported by checkpatch.pl like below.
WARNING: Missing a blank line after declarations
#117: FILE: drivers/resctrl/mpam_resctrl.c:375:
+ struct mpam_component *victim_iter;
+ cpumask_var_t __free(free_cpumask_var) tmp_cpumask;
Besides, it'd better to initialize @tmp_cpumask:
cpumask_var_t __free(free_cpumask_var) tmp_cpumask = CPUMASK_VAR_NULL;
Thanks,
Gavin
|
{
"author": "Gavin Shan <gshan@redhat.com>",
"date": "Mon, 19 Jan 2026 19:53:25 +0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Ben,
On 1/13/26 12:58 AM, Ben Horgan wrote:
A warning reported by checkpatch.pl as below.
WARNING: Missing a blank line after declarations
#84: FILE: drivers/resctrl/mpam_resctrl.c:607:
+ size_t array_size = num_mbwu_mon * sizeof(int);
+ int *array __free(kfree) = kmalloc(array_size, GFP_KERNEL);
Thanks,
Gavin
|
{
"author": "Gavin Shan <gshan@redhat.com>",
"date": "Mon, 19 Jan 2026 19:57:38 +0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Peter,
On 15/01/2026 15:49, Peter Newman wrote:
It will, yes you get double counting. Is forbidding both mbm_total and mbm_local preferable?
I think this comes from 'total' in mbm_total not really having the obvious meaning of the
word:
If I have CPUs in NUMA-A and no memory controllers, then NUMA-B has no CPUs, and all the
memory-controllers.
With MPAM: we've only got one bandwidth counter, it doesn't know where the traffic goes
after the MSC. mbm-local on the L3 would reflect all the bandwidth, and mbm-total on the
memory-controllers would have the same number.
I think on x86 mbm_local on the CPUs would read zero as zero traffic went to the 'local'
memory controller, and mbm_total would reflect all the memory bandwidth. (so 'total'
really means 'other')
I think what MPAM is doing here is still useful as a system normally has both CPUs and
memory controllers in the NUMA nodes, and you can use this to spot a control/monitor group
on a NUMA-node that is hammering all the memory (outlier mbm_local), or the same where a
NUMA-node's memory controller is getting hammered by all the NUMA nodes (outlier
mbm_total)
I've not heard of a platform with both memory bandwidth monitors at L3 and the memory
controller, so this may be a theoretical issue.
Shall we only expose one of mbm-local/total to prevent this being seen by user-space?
Thanks,
James
|
{
"author": "James Morse <james.morse@arm.com>",
"date": "Mon, 19 Jan 2026 12:04:10 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On 1/13/26 12:59 AM, Ben Horgan wrote:
An error reported by checkpatch.pl as below.
ERROR: Macros with complex values should be enclosed in parentheses
#135: FILE: drivers/resctrl/mpam_internal.h:238:
+#define MPAM_IIDR_MATCH_ONE FIELD_PREP_CONST(MPAMF_IIDR_PRODUCTID, 0xfff) | \
+ FIELD_PREP_CONST(MPAMF_IIDR_VARIANT, 0xf) | \
+ FIELD_PREP_CONST(MPAMF_IIDR_REVISION, 0xf) | \
+ FIELD_PREP_CONST(MPAMF_IIDR_IMPLEMENTER, 0xfff)
Thanks,
Gavin
|
{
"author": "Gavin Shan <gshan@redhat.com>",
"date": "Mon, 19 Jan 2026 20:14:44 +0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On 1/13/26 12:59 AM, Ben Horgan wrote:
An error reported by checkpatch.pl as below.
ERROR: Macros with complex values should be enclosed in parentheses
#205: FILE: drivers/resctrl/mpam_internal.h:247:
+#define MPAM_IIDR_NVIDIA_T241 FIELD_PREP_CONST(MPAMF_IIDR_PRODUCTID, 0x241) | \
+ FIELD_PREP_CONST(MPAMF_IIDR_VARIANT, 0) | \
+ FIELD_PREP_CONST(MPAMF_IIDR_REVISION, 0) | \
+ FIELD_PREP_CONST(MPAMF_IIDR_IMPLEMENTER, 0x36b)
Thanks,
Gavin
|
{
"author": "Gavin Shan <gshan@redhat.com>",
"date": "Mon, 19 Jan 2026 20:16:30 +0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
On 1/13/26 12:59 AM, Ben Horgan wrote:
An error reported by checkpatch.pl as below.
ERROR: Macros with complex values should be enclosed in parentheses
#105: FILE: drivers/resctrl/mpam_internal.h:255:
+#define MPAM_IIDR_ARM_CMN_650 FIELD_PREP_CONST(MPAMF_IIDR_PRODUCTID, 0) | \
+ FIELD_PREP_CONST(MPAMF_IIDR_VARIANT, 0) | \
+ FIELD_PREP_CONST(MPAMF_IIDR_REVISION, 0) | \
+ FIELD_PREP_CONST(MPAMF_IIDR_IMPLEMENTER, 0x43b)
Thanks,
Gavin
|
{
"author": "Gavin Shan <gshan@redhat.com>",
"date": "Mon, 19 Jan 2026 20:18:50 +0800",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Catalin,
On 1/15/26 17:58, Catalin Marinas wrote:
The reason for the isb() placement is to document that it's not required
for the MPAM0_EL1. All instructions running at EL1take their MPAM
configuration from MPAM1_EL1. This includes LDTR and STTR as you asked
about in a different thread.
It's done this way as it matches what's done in x86. I expect it would
be cheap enough to read the register to check whether a write is required.
The resctrl filesystem can only ever get mounted once and
resctrl_arch_set_cdp_enabled() is always called in mount. In
rdt_get_tree(), rdt_enable_ctx() calls resctrl_arch_set_cdp_enabled().
This is done while holding the rdtgroup_mutex and the user can't change
the mpam configuration from the default until the mutex is released and
it can claim it.
If the task configuration is changed then the MPAM sysreg will only be
updated the next time it goes into the kernel. So, just eventually
consistent. For cpu configuration, update_closid_rmid() gets called
which ipis the cpus and ends up calling mpam_thread_switch() from
resctrl_arch_sched_in().
Thanks,
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 19 Jan 2026 12:23:13 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi James,
On Mon, Jan 19, 2026 at 1:04 PM James Morse <james.morse@arm.com> wrote:
Our software is going off the definition from the Intel SDM:
"This event monitors the L3 external bandwidth satisfied by the local
memory. In most platforms that support this event, L3 requests are
likely serviced by a memory system with non-uniform memory
architecture. This allows bandwidth to off-package memory resources to
be tracked by subtracting local from total bandwidth (for instance,
bandwidth over QPI to a memory controller on another physical
processor could be tracked by subtraction).
On NUMA-capable hardware that can support this event where all memory
is local, mbm_local == mbm_total, but in practice you can't read them
at the same time from userspace, so if you read mbm_total first,
you'll probably get a small negative result for remote bandwidth.
I believe in the current software design, MPAM is only able to support
mbm_total, as an individual MSC (or class of MSCs with the same
configuration) can't separate traffic by destination, so it must be
the combined value. On a hardware design where MSCs were placed such
that one only counts local traffic and another only counts remote, the
resctrl MPAM driver would have to understand the hardware
configuration well enough to be able to produce counts following
Intel's definition of mbm_local and mbm_total.
Thanks,
-Peter
|
{
"author": "Peter Newman <peternewman@google.com>",
"date": "Mon, 19 Jan 2026 13:47:52 +0100",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Catalin,
On 1/15/26 18:14, Catalin Marinas wrote:
Yes, will drop it.
I see thread
I touch on it in the cover letter. It is the way it is done for x86 and
so sensible to make it the default. All partids are usable from
user-space and user-space can't bypass MPAM controls by doing the work
in the kernel.
There is a proposal from Babu at AMD, PLZA, which he presented at LPC
which would give a new interface to have different configuration,
closid, for userspace and kernel space. We should be able to use this
with MPAM too.
Yes, this is a disadvantage of having MPAM1 and MPAM0 change together.
Just for documentation. I can change it if you prefer.
They use LDTR/STTR. MPAM doesn't care about which instruction is running.
Thanks,
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 19 Jan 2026 13:38:11 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Catalin,
On 1/15/26 19:08, Catalin Marinas wrote:
I'll switch to cpus_have_cap().
Thanks,
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 19 Jan 2026 13:40:18 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Gavin,
On 1/19/26 11:53, Gavin Shan wrote:
[...]
I expect this is because __free() declarations don't need to be at the
top of a scope and so checkpatch doesn't treat them as normal
declarations. I don't think anything needs changing here.
Yep, I'll update.
Thanks,
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 19 Jan 2026 13:53:23 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Gavin, Jonathan,
On 1/15/26 12:09, Jonathan Cameron wrote:
Keeping the includes here makes sense to me too. Gavin, are you ok with
keeping this as is?
Thanks,
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 19 Jan 2026 14:00:07 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Catalin,
On 1/19/26 13:38, Ben Horgan wrote:
Ah, that's done in the patch already. Also, we can't treat 0 as special
without taking it away from userspace and then we're down a partid and
there might be that many.
Thanks,
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 19 Jan 2026 14:22:13 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
lkml
|
[PATCH v3 00/47] arm_mpam: Add KVM/arm64 and resctrl glue code
|
This new version of the mpam missing pieces has no major rework from the
previous version. It's mainly small corrections and code tidying based on
review and things I spotted along the way. To be able to merge this we need
review from more people and people to start testing on their platforms and
giving some Tested-by tags.
Change list in patches.
As mentioned in the cover letter for v2, one major departure from the
previous snapshot branches referenced in the base driver series is that the
same MPAM setting are used for kernel-space and user-space. There are pros
and cons of choosing this policy but I think it is the best thing to start
with as there are AMD plans for adding a resctrl feature to allow a
different closid/rmid configuration for user-space from kernel space. The
AMD feature is called PLZA and is mentioned in this lpc slide deck[1]. This
gives us a path forward to add support for having the EL1 and EL0 MPAM
partid/pmg configuration differ from each other.
>From James' cover letter:
This is the missing piece to make MPAM usable resctrl in user-space. This has
shed its debugfs code and the read/write 'event configuration' for the monitors
to make the series smaller.
This adds the arch code and KVM support first. I anticipate the whole thing
going via arm64, but if goes via tip instead, the an immutable branch with those
patches should be easy to do.
Generally the resctrl glue code works by picking what MPAM features it can expose
from the MPAM drive, then configuring the structs that back the resctrl helpers.
If your platform is sufficiently Xeon shaped, you should be able to get L2/L3 CPOR
bitmaps exposed via resctrl. CSU counters work if they are on/after the L3. MBWU
counters are considerably more hairy, and depend on hueristics around the topology,
and a bunch of stuff trying to emulate ABMC.
If it didn't pick what you wanted it to, please share the debug messages produced
when enabling dynamic debug and booting with:
| dyndbg="file mpam_resctrl.c +pl"
I've not found a platform that can test all the behaviours around the monitors,
so this is where I'd expect the most bugs.
The MPAM spec that describes all the system and MMIO registers can be found here:
https://developer.arm.com/documentation/ddi0598/db/?lang=en
(Ignored the 'RETIRED' warning - that is just arm moving the documentation around.
This document has the best overview)
Based on v6.19-rc5
This series can be retrieved from:
https://gitlab.arm.com/linux-arm/linux-bh.git mpam_resctrl_glue_v3
v2 can be found at:
https://lore.kernel.org/linux-arm-kernel/20251219181147.3404071-1-ben.horgan@arm.com/
rfc can be found at:
https://lore.kernel.org/linux-arm-kernel/20251205215901.17772-1-james.morse@arm.com/
[1] https://lpc.events/event/19/contributions/2093/attachments/1958/4172/resctrl%20Microconference%20LPC%202025%20Tokyo.pdf
Ben Horgan (10):
arm_mpam: Use non-atomic bitops when modifying feature bitmap
arm64/sysreg: Add MPAMSM_EL1 register
KVM: arm64: Preserve host MPAM configuration when changing traps
KVM: arm64: Make MPAMSM_EL1 accesses UNDEF
arm64: mpam: Initialise and context switch the MPAMSM_EL1 register
KVM: arm64: Use kernel-space partid configuration for hypercalls
arm_mpam: resctrl: Add rmid index helpers
arm_mpam: resctrl: Add kunit test for rmid idx conversions
arm_mpam: resctrl: Wait for cacheinfo to be ready
arm_mpam: resctrl: Add kunit test for mbw min control generation
Dave Martin (2):
arm_mpam: resctrl: Convert to/from MPAMs fixed-point formats
arm_mpam: resctrl: Add kunit test for control format conversions
James Morse (30):
arm64: mpam: Context switch the MPAM registers
arm64: mpam: Re-initialise MPAM regs when CPU comes online
arm64: mpam: Advertise the CPUs MPAM limits to the driver
arm64: mpam: Add cpu_pm notifier to restore MPAM sysregs
arm64: mpam: Add helpers to change a task or cpu's MPAM PARTID/PMG
values
KVM: arm64: Force guest EL1 to use user-space's partid configuration
arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
arm_mpam: resctrl: Sort the order of the domain lists
arm_mpam: resctrl: Pick the caches we will use as resctrl resources
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
arm_mpam: resctrl: Add resctrl_arch_get_config()
arm_mpam: resctrl: Implement helpers to update configuration
arm_mpam: resctrl: Add plumbing against arm64 task and cpu hooks
arm_mpam: resctrl: Add CDP emulation
arm_mpam: resctrl: Add support for 'MB' resource
arm_mpam: resctrl: Add support for csu counters
arm_mpam: resctrl: Pick classes for use as mbm counters
arm_mpam: resctrl: Pre-allocate free running monitors
arm_mpam: resctrl: Pre-allocate assignable monitors
arm_mpam: resctrl: Add kunit test for ABMC/CDP interactions
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
arm_mpam: resctrl: Allow resctrl to allocate monitors
arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid()
arm_mpam: resctrl: Add resctrl_arch_cntr_read() &
resctrl_arch_reset_cntr()
arm_mpam: resctrl: Update the rmid reallocation limit
arm_mpam: resctrl: Add empty definitions for assorted resctrl
functions
arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
arm_mpam: resctrl: Call resctrl_init() on platforms that can support
resctrl
arm_mpam: Generate a configuration for min controls
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
Jiapeng Chong (1):
arm_mpam: Remove duplicate linux/srcu.h header
Shanker Donthineni (4):
arm_mpam: Add quirk framework
arm_mpam: Add workaround for T241-MPAM-1
arm_mpam: Add workaround for T241-MPAM-4
arm_mpam: Add workaround for T241-MPAM-6
Documentation/arch/arm64/silicon-errata.rst | 9 +
arch/arm64/Kconfig | 6 +-
arch/arm64/include/asm/el2_setup.h | 3 +-
arch/arm64/include/asm/mpam.h | 98 +
arch/arm64/include/asm/resctrl.h | 2 +
arch/arm64/include/asm/thread_info.h | 3 +
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/cpufeature.c | 21 +-
arch/arm64/kernel/mpam.c | 58 +
arch/arm64/kernel/process.c | 7 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 12 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 13 +
arch/arm64/kvm/sys_regs.c | 2 +
arch/arm64/tools/sysreg | 8 +
drivers/resctrl/Kconfig | 9 +-
drivers/resctrl/Makefile | 1 +
drivers/resctrl/mpam_devices.c | 306 ++-
drivers/resctrl/mpam_internal.h | 131 +-
drivers/resctrl/mpam_resctrl.c | 1930 +++++++++++++++++++
drivers/resctrl/test_mpam_devices.c | 66 +
drivers/resctrl/test_mpam_resctrl.c | 426 ++++
include/linux/arm_mpam.h | 32 +
23 files changed, 3119 insertions(+), 33 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/include/asm/resctrl.h
create mode 100644 arch/arm64/kernel/mpam.c
create mode 100644 drivers/resctrl/mpam_resctrl.c
create mode 100644 drivers/resctrl/test_mpam_resctrl.c
--
2.43.0
|
Hi Gavin,
On 1/19/26 06:37, Gavin Shan wrote:
I've split out the part of PATCH[39/47] that removes the CONFIG_EXPERT
restriction and put it before this patch. With that CONFIG_ARM64_MPAM
will unconditionally select CONFIG_ARM64_MPAM_DRIVER.
Thanks,
Ben
|
{
"author": "Ben Horgan <ben.horgan@arm.com>",
"date": "Mon, 19 Jan 2026 14:49:38 +0000",
"thread_id": "20260112165914.4086692-1-ben.horgan@arm.com.mbox.gz"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.