mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jinjie Ruan <ruanjinjie01@gmail.com>
To: babu.moger@amd.com, ben.horgan@arm.com, bp@alien8.de,
	corbet@lwn.net, Dave.Martin@arm.com, fenghuay@nvidia.com,
	james.morse@arm.com, rdunlap@infradead.org,
	reinette.chatre@intel.com, skhan@linuxfoundation.org,
	tony.luck@intel.com, x86@kernel.org,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Cc: ruanjinjie@huawei.com
Subject: [RFC PATCH 00/6] resctrl: Support mba_MBps on MPAM
Date: Mon,  9 Nov 2026 21:26:15 +0800	[thread overview]
Message-ID: <20261109132621.3862497-1-ruanjinjie01@gmail.com> (raw)

From: Jinjie Ruan <ruanjinjie@huawei.com>

Resctrl offers two ways to describe an MBA policy:
- The percentage interface writes a fraction of the maximum bandwidth
  into the hardware control register
- The MBA software controller (mounted with -o mba_MBps) takes
  an absolute target in MiB/s and adjusts that percentage based on
  the MBM counters sampled once per second.

The problem is that a percentage alone isn't enough. How much bandwidth
a percentage actually corresponds to depends on the memory frequency,
the channel count, how many threads are generating traffic, the access
pattern, and the traffic of other groups. Neither MPAM nor x86 resctrl
reports the maximum bandwidth in MiB/s. So an administrator who wants
to enforce an absolute budget (a tenant SLA, a noisy-neighbour limit)
has to measure and re-tune the percentage on every machine. x86 resctrl
has had this software controller since 2018; MPAM has never been able
to use it. This series makes it work on MPAM.

What this series does
=====================

MPAM refuses mba_MBps in two places:
- Its MBM counters are assignable, and supports_mba_mbps() refuses
  the option when they are.
- Its maximum bandwidth control is a soft limit by default, which
  can't hold a single requester down to the target.
  MPAMF_MBW_IDR.MAX_LIM reports whether the hard limit exists.

MPAM also makes two generic defects reachable:
- Writing the control register sleeps (smp_call_on_cpu()), while
  the worker runs under the RCU read lock
- A 16-bit fraction lets the minimum control value reach zero, which
  divides by zero in the estimator

The patches:

- Patches 1 and 2 fix the two generic defects.
- Patches 3 and 4 make the loop runnable on MPAM: the worker takes the
  CPU hotplug lock around the sleeping control update, and assignable
  counters are accepted with a fixed assignment mode.
- Patches 5 and 6 handle the maximum: the driver sets HARDLIM and
  records the MAX_LIM behaviours, and mba_MBps is refused where only
  the soft limit exists.

x86 has no assignable counters in the mode where the controller is
allowed, and does not set the soft-limit flag, so its behaviour is
unchanged.

Testing
=======

With the MPAM MSC model in QEMU:

- From a 9606 MiB/s baseline, a 7000 MiB/s target converges to
  6888 MiB/s and a 9000 MiB/s target to 8766 MiB/s.
- The memory-side MSC register shows MBW_MAX.HARDLIM set.
- A modelled MSC that implements only the soft limit refuses the
  mba_MBps mount, while a plain mount succeeds.
- With mbm_assign_on_mkdir forced on while the controller is in use,
  a write of 0 is refused, and the user's value is restored after
  unmount.
- The KUnit tests for the MPAM driver pass.

Jinjie Ruan (6):
  fs/resctrl: Avoid division by zero in the MBA software controller
  fs/resctrl: Do not update bandwidth from a failed counter read
  fs/resctrl: Take the CPU hotplug lock for software controller updates
  fs/resctrl: Allow mba_MBps with assignable MBM counters
  fs/resctrl: Reject mba_MBps when the maximum is only a soft limit
  arm_mpam: Program the hard limit for the software controller

 Documentation/filesystems/resctrl.rst | 13 +++-
 drivers/resctrl/mpam_devices.c        | 55 +++++++++++++----
 drivers/resctrl/mpam_internal.h       |  4 ++
 drivers/resctrl/mpam_resctrl.c        |  9 +++
 fs/resctrl/monitor.c                  | 86 +++++++++++++++++++++------
 fs/resctrl/rdtgroup.c                 | 48 ++++++++++++---
 include/linux/resctrl.h               |  5 ++
 7 files changed, 179 insertions(+), 41 deletions(-)

-- 
2.43.0


             reply	other threads:[~2026-11-09 13:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 13:26 Jinjie Ruan [this message]
2026-11-09 13:26 ` [RFC PATCH 1/6] fs/resctrl: Avoid division by zero in the MBA software controller Jinjie Ruan
2026-11-09 13:26 ` [RFC PATCH 2/6] fs/resctrl: Do not update bandwidth from a failed counter read Jinjie Ruan
2026-11-09 13:26 ` [RFC PATCH 3/6] fs/resctrl: Take the CPU hotplug lock for software controller updates Jinjie Ruan
2026-11-09 13:26 ` [RFC PATCH 4/6] fs/resctrl: Allow mba_MBps with assignable MBM counters Jinjie Ruan
2026-11-09 13:26 ` [RFC PATCH 5/6] fs/resctrl: Reject mba_MBps when the maximum is only a soft limit Jinjie Ruan
2026-11-09 13:26 ` [RFC PATCH 6/6] arm_mpam: Program the hard limit for the software controller Jinjie Ruan
     [not found] <20261109132621.3862497-1-ruanjinjie01@gmail.com_quarantine>
2026-11-09 17:50 ` [RFC PATCH 00/6] resctrl: Support mba_MBps on MPAM Ben Horgan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261109132621.3862497-1-ruanjinjie01@gmail.com \
    --to=ruanjinjie01@gmail.com \
    --cc=Dave.Martin@arm.com \
    --cc=babu.moger@amd.com \
    --cc=ben.horgan@arm.com \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=fenghuay@nvidia.com \
    --cc=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=reinette.chatre@intel.com \
    --cc=ruanjinjie@huawei.com \
    --cc=skhan@linuxfoundation.org \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®