]> git.ipfire.org Git - thirdparty/linux.git/commit
x86,fs/resctrl: Prepare for more monitor events
authorTony Luck <tony.luck@intel.com>
Fri, 5 Sep 2025 21:34:03 +0000 (16:34 -0500)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 15 Sep 2025 09:57:03 +0000 (11:57 +0200)
commit83b039877310ae1eb614eef17b780df1e10d9fb5
tree9e50b7a700284ee133df9f0870e4cae7cae29a36
parent63cc9811aa874e6fab671599ba93a989f4f93a5d
x86,fs/resctrl: Prepare for more monitor events

There's a rule in computer programming that objects appear zero, once, or many
times. So code accordingly.

There are two MBM events and resctrl is coded with a lot of

  if (local)
          do one thing
  if (total)
          do a different thing

Change the rdt_mon_domain and rdt_hw_mon_domain structures to hold arrays of
pointers to per event data instead of explicit fields for total and local
bandwidth.

Simplify by coding for many events using loops on which are enabled.

Move resctrl_is_mbm_event() to <linux/resctrl.h> so it can be used more
widely. Also provide a for_each_mbm_event_id() helper macro.

Cleanup variable names in functions touched to consistently use "eventid" for
those with type enum resctrl_event_id.

Signed-off-by: Tony Luck <tony.luck@intel.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
arch/x86/kernel/cpu/resctrl/core.c
arch/x86/kernel/cpu/resctrl/internal.h
arch/x86/kernel/cpu/resctrl/monitor.c
fs/resctrl/monitor.c
fs/resctrl/rdtgroup.c
include/linux/resctrl.h
include/linux/resctrl_types.h