mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v10 RESEND 00/15] arm_mpam: Introduce Narrow-PARTID feature
@ 2026-10-20 13:42 Jinjie Ruan
  2026-10-20 13:42 ` [PATCH v10 RESEND 01/15] fs/resctrl: Return -EBUSY when per-CLOSID RMIDs are in limbo Jinjie Ruan
                   ` (14 more replies)
  0 siblings, 15 replies; 25+ messages in thread
From: Jinjie Ruan @ 2026-10-20 13:42 UTC (permalink / raw)
  To: tony.luck, reinette.chatre, Dave.Martin, james.morse, babu.moger,
	tglx, mingo, bp, dave.hansen, hpa, ben.horgan, fenghuay,
	ruanjinjie, tan.shaopeng, zengheng4, jic23, gshan,
	catalin.marinas, x86, linux-kernel

Background
==========

In ARM MPAM, a monitoring group is defined by a (PARTID, PMG) pair.
However, many production platforms implement only a single PMG bit,
limiting the total number of monitoring groups long before the request
PARTID space is exhausted.

Hardware Mechanism
===================

Platforms with "PARTID narrowing" mitigate this by mapping multiple
request PARTIDs onto a single internal PARTID. The internal PARTID
dictates the control group configuration, while each individual request
PARTID functions as an independent monitoring group. This decouples
control and monitoring allocation, allowing more monitoring groups
than the PMG constraint normally permits.

Software Strategy
==================

Using request PARTIDs beyond the internal range is only safe when no MPAM
class loses a non-aliasing control. While aliasing controls (e.g., cache
portion bitmaps) can be safely replicated across request PARTIDs,
non-aliasing controls (e.g., cache capacity) are additive and cannot.

To ensure safety, this series implements a completely static grouping
policy evaluated once before resctrl_init(). If any class contains
non-aliasing controls without narrowing capabilities, the expansion
is bypassed. This infrastructure remains completely transparent
to user-space.

Patch Architecture
====================

- Patches 1-6: bugfixes found by sashiko or while testing this series
- Patches 7-9: Preparatory helpers, no functional change
- Patch 10: Track internal and request PARTID limits per class
- Patches 11-12: Driver-side modulo interleaving + flat global RMID
- Patches 13-14: Identify non-aliasing controls; enable the narrowing
- Patch 15: KUnit tests for the narrow-PARTID helpers

Testing
========

Verified on both QEMU and real Hisi hardware:

- Narrowing expands monitoring groups from 4 to 256:

      [ 62.602939] mpam:mpam_resctrl_configure_partids: PARTIDs: monitor=256 closid=32 extra=1
      [ 63.788467] MPAM enabled with 256 PARTIDs and 4 PMGs

- KUnit: narrow-PARTID helper tests pass.

QEMU branch: https://github.com/ruanjinjie-eng/qemu/tree/mpam
Test cases: https://github.com/ruanjinjie-eng/mpam_testcase

v10 -> v10 RESNED:
- Resend because of SMTP rate limiting.

Changes since v9
- Compatibility with Narrow PARTID and CDP mode
- Fix several sashiko reported issues:
  - Return -EBUSY when a CLOSID's RMIDs are only in limbo
  - Skip the monitor-context allocation on the force-free limbo path
  - Return an correct error pointer from resctrl_arch_mon_ctx_alloc() 
    on failure.
  - Widen the PARTID reset loop counter to u32 to fix the 65536 wrap.
- Fix MPAM enable issue when a MSC fails to probe (e.g. nr_cpus= clipping
  the possible CPUs).
- Add KUnit tests for the narrow-PARTID helpers.
- Link to v9: https://lore.kernel.org/all/20261012082337.822258-1-ruanjinjie@huawei.com/

Link: https://sashiko.dev/#/patchset/20261012082337.822258-1-ruanjinjie%40huawei.com

Previous Versions
=================

    v9: https://lore.kernel.org/all/20261012082337.822258-1-ruanjinjie@huawei.com/
    v8: https://lore.kernel.org/all/20260413085405.1166412-1-zengheng4@huawei.com/
    v7: https://lore.kernel.org/all/20260317132141.1272506-1-zengheng4@huawei.com/
    v6: https://lore.kernel.org/all/20250222112448.2438586-1-zengheng4@huawei.com/
    v5: https://lore.kernel.org/all/20250217031852.2014939-1-zengheng4@huawei.com/
RFC-v4: https://lore.kernel.org/all/20250104101224.873926-1-zengheng4@huawei.com/
RFC-v3: https://lore.kernel.org/all/20241207092136.2488426-1-zengheng4@huawei.com/
RFC-v2: https://lore.kernel.org/all/20241119135104.595630-1-zengheng4@huawei.com/
RFC-v1: https://lore.kernel.org/all/20241114135037.918470-1-zengheng4@huawei.com/

Jinjie Ruan (13):
  fs/resctrl: Return -EBUSY when per-CLOSID RMIDs are in limbo
  fs/resctrl: Skip monitor context allocation when force-freeing RMIDs
  arm_mpam: Fix error return in resctrl_arch_mon_ctx_alloc()
  arm_mpam: Fix infinite PARTID reset loop when 65536 PARTIDs are
    supported
  arm_mpam: Don't stall MPAM enable when an MSC fails to probe
  fs/resctrl: Add resctrl_arch_rmid_idx_match() helper
  arm_mpam: resctrl: Add resctrl_closid_rmid_to_partid_pmg() helper
  arm_mpam: Add a helper to check a PARTID is in a CLOSID
  arm_mpam: Track the PARTID and internal PARTID limits per class
  arm_mpam: Divide the PARTIDs between the control groups
  arm_mpam: Identify the non-aliasing controls
  arm_mpam: Use the request PARTIDs beyond the internal range
  arm_mpam: resctrl: Add kunit tests for narrow PARTID helpers

Zeng Heng (2):
  fs/resctrl: Unmount resctrl with the CDP state it was mounted with
  arm_mpam: Map resctrl RMIDs onto the request PARTIDs

 arch/x86/include/asm/resctrl.h      |   6 +
 drivers/resctrl/.kunitconfig        |   4 +
 drivers/resctrl/mpam_devices.c      | 160 ++++++++--
 drivers/resctrl/mpam_internal.h     |  25 ++
 drivers/resctrl/mpam_resctrl.c      | 227 +++++++++++---
 drivers/resctrl/test_mpam_resctrl.c | 466 ++++++++++++++++++++++++++++
 fs/resctrl/monitor.c                |  36 ++-
 fs/resctrl/rdtgroup.c               |  46 ++-
 include/linux/arm_mpam.h            |   1 +
 9 files changed, 889 insertions(+), 82 deletions(-)
 create mode 100644 drivers/resctrl/.kunitconfig

-- 
2.34.1


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2026-10-27  1:47 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-20 13:42 [PATCH v10 RESEND 00/15] arm_mpam: Introduce Narrow-PARTID feature Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 01/15] fs/resctrl: Return -EBUSY when per-CLOSID RMIDs are in limbo Jinjie Ruan
2026-10-26 14:05   ` Ben Horgan
2026-10-20 13:42 ` [PATCH v10 RESEND 02/15] fs/resctrl: Skip monitor context allocation when force-freeing RMIDs Jinjie Ruan
2026-10-26 14:08   ` Ben Horgan
2026-10-26 14:11     ` Ben Horgan
2026-10-27  1:33       ` Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 03/15] arm_mpam: Fix error return in resctrl_arch_mon_ctx_alloc() Jinjie Ruan
2026-10-26 14:40   ` Ben Horgan
2026-10-27  1:25     ` Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 04/15] arm_mpam: Fix infinite PARTID reset loop when 65536 PARTIDs are supported Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 05/15] arm_mpam: Don't stall MPAM enable when an MSC fails to probe Jinjie Ruan
2026-10-26 14:49   ` Ben Horgan
2026-10-27  1:47     ` Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 06/15] fs/resctrl: Unmount resctrl with the CDP state it was mounted with Jinjie Ruan
2026-10-26 15:08   ` Ben Horgan
2026-10-20 13:42 ` [PATCH v10 RESEND 07/15] fs/resctrl: Add resctrl_arch_rmid_idx_match() helper Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 08/15] arm_mpam: resctrl: Add resctrl_closid_rmid_to_partid_pmg() helper Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 09/15] arm_mpam: Add a helper to check a PARTID is in a CLOSID Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 10/15] arm_mpam: Track the PARTID and internal PARTID limits per class Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 11/15] arm_mpam: Divide the PARTIDs between the control groups Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 12/15] arm_mpam: Map resctrl RMIDs onto the request PARTIDs Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 13/15] arm_mpam: Identify the non-aliasing controls Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 14/15] arm_mpam: Use the request PARTIDs beyond the internal range Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 15/15] arm_mpam: resctrl: Add kunit tests for narrow PARTID helpers Jinjie Ruan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®