[PATCH v9 0/9] x86/resctrl: mba_MBps enhancement

Tony Luck
2024-11-14T00:17:18Z

Add support to choose the memory monitor bandwidth event independently
for each ctrl_mon group when resctrl is mounted with the mba_MBps
option. Users may want this for applications that are not localized to
NUMA boundaries. Default behavior still uses local memory bandwidth
when that event is supported by the platform.

Side benefit[0]: Systems that do not support the local bandwidth monitor
event but do support the total bandwidth event can now use the mba_MBps
mount option.

Changes since v8:
Link: https://lore.kernel.org/all/20241029172832.93963-1-tony.luck@intel.com

Patch(es): Change
1: New to this series. Almost direct copy from Babu's patch6
in the ABMC series. Only change is to drop the __init
from resctrl_file_fflags_init() because I need to use it
at runtime for mount/unmount.

2: Was patch 1
Fenghua: Use is_mbm_local_enabled() instead of open
coded bit check.
Reinette: Fix comment for @mba_mbps_event
Move check for local event after check for any event
Move initialization of rdtgroup_default.mba_mbps_event
into rdtgroup_setup_default() and make it conditional
on is_mbm_local_enabled().
Move initialization of rdtgrp->mba_mbps_event inside
"if (resctrl_arch_mon_capable())" and make it
conditional on is_mba_sc(NULL).
Tony: Moved the fallback to total bandwidth to later in
series until all code is changed to cope with total.

3-4: Was 2-3
Reinette: Shuffled the pieces of these two patches to
flow better.
Fenghue: Don't drop the comment when refactoring, but do
update a little.

5: Was 4. No change.

6: Was 5.
Reinette: Expand commit change log
Fix rdtgroup_mba_mbps_event_show() to return -ENOENT
if rdtgrp isn't found.
Add pr_warn_once() to cover default case in switch.
File mode of mba_MBps_event 0444 in this patch.
Initialize .fflags to "RFTYPE_CTRL_BASE | RFTYPE_MON_BASE"
using Babu's resctrl_file_fflags_init() helper
instead of adding mba_mbps_event_init() function.

7: Was 6.
Reinette: Expand commit change log
Just use "Unsupported event" event for all invalid
user input instead of separate messages for
different problems.
Use this patch to switch mode from 0444 to 0644

8: New. Moved the fallback to total bandwidth to this patch.

9: No change. I punted on trying to explain the perils of
users rapidly switching between mba_sc events.

[0] My original objective!

Babu Moger (1):
x86/resctrl: Introduce resctrl_file_fflags_init() to initialize fflags

Tony Luck (8):
x86/resctrl: Prepare for per-ctrl_mon group mba_MBps control
x86/resctrl: Modify update_mba_bw() to use per ctrl_mon group event
x86/resctrl: Compute memory bandwidth for all supported events
x86/resctrl: Relax checks for mba_MBps mount option
x86/resctrl: Add "mba_MBps_event" file to ctrl_mon directories
x86/resctrl: Add write option to "mba_MBps_event" file
x86/resctrl: Make mba_sc use total bandwidth if local is not supported
x86/resctrl: Document the new "mba_MBps_event" file

Documentation/arch/x86/resctrl.rst | 10 +++
include/linux/resctrl.h | 2 +
arch/x86/kernel/cpu/resctrl/internal.h | 9 +-
arch/x86/kernel/cpu/resctrl/core.c | 9 +-
arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 70 +++++++++++++++
arch/x86/kernel/cpu/resctrl/monitor.c | 101 ++++++++++++----------
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 36 ++++----
7 files changed, 173 insertions(+), 64 deletions(-)

base-commit: 2d5404caa8c7bb5c4e0435f94b28834ae5456623
--
2.47.0