]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
fs/resctrl: Introduce mbm_cntr_cfg to track assignable counters per domain
authorBabu Moger <babu.moger@amd.com>
Fri, 5 Sep 2025 21:34:11 +0000 (16:34 -0500)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 15 Sep 2025 10:13:16 +0000 (12:13 +0200)
commit4d32c24a74f2c12ff440d381ba01de574f6631ce
tree8c529c11149c61cb4e514a378df31b30ac848b25
parent8c793336eaf8893a29626155d74615fe9f03e7f2
fs/resctrl: Introduce mbm_cntr_cfg to track assignable counters per domain

The "mbm_event" counter assignment mode allows users to assign a hardware
counter to an RMID, event pair and monitor bandwidth usage as long as it is
assigned.  The hardware continues to track the assigned counter until it is
explicitly unassigned by the user. Counters are assigned/unassigned at
monitoring domain level.

Manage a monitoring domain's hardware counters using a per monitoring
domain array of struct mbm_cntr_cfg that is indexed by the hardware
counter ID. A hardware counter's configuration contains the MBM event
ID and points to the monitoring group that it is assigned to, with a NULL
pointer meaning that the hardware counter is available for assignment.

There is no direct way to determine which hardware counters are assigned
to a particular monitoring group. Check every entry of every hardware
counter configuration array in every monitoring domain to query which
MBM events of a monitoring group is tracked by hardware. Such queries are
acceptable because of a very small number of assignable counters (32
to 64).

Suggested-by: Peter Newman <peternewman@google.com>
Signed-off-by: Babu Moger <babu.moger@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Link: https://lore.kernel.org/cover.1757108044.git.babu.moger@amd.com
fs/resctrl/rdtgroup.c
include/linux/resctrl.h