[RFC PATCH 0/7] Add driver registration i/f to resctrl

From: Tony Luck
Date: Thu Apr 20 2023 - 18:06:49 EST


This is very much proof of concept code at this stage. I have a few
quality of service features that are hard to intergrate into the core
resctrl code because they are model specific, or have input parameters
that do not fit neatly into the existing schemata model.

Also, as AMD, ARM, and now RISC-V are looking to share the core resctrl
code, it might be helpful to have "driver" as a software layer for
per-CPU architectural code to avoid cluttering the core.

None of my drivers are ready to post, so this series has a simple example
driver that would meet the same debug requirements of Babu Moger's
patch to expose the CLOSID/RMID in files in each directory:

https://lore.kernel.org/all/168177449635.1758847.13040588638888054027.stgit@bmoger-ubuntu/

Doing this debug with a driver that can be loaded unloaded without
having to unmount and remount the resctrl file system appears slightly
more convenient that a "-o debug" option. But this example driver is
really intended just as a toy example of what can be done.

The series is broken into steps that add callback functions into various
different parts of the resctrl hierarchy. That list of parts has been
driven by the needs of the drivers that I want to write. The
registration interface could be extended if there are additional
hooks need for other drivers.

I'm looking for high level comments on the desireability of this approach
at this time. I don't expect any of this to be merged until I have some
real drivers that use this to offer to upstream.

Tony Luck (7):
x86/resctrl: Add register/unregister functions for driver to hook into
resctrl
x86/resctrl: Add an interface to add/remove a new info/directory
x86/resctrl: Add driver callback when directories are removed
x86/resctrl: Add capability to driver registration to create control
files
x86/resctrl: Enhance driver registration to hook into schemata files
x86/resctrl: Allow a device to override an existing schemata entry
x86/resctrl: Example resctrl driver

include/linux/resctrl.h | 37 +++
arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 17 +-
.../cpu/resctrl/drivers/resctrl_example.c | 77 ++++++
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 227 ++++++++++++++++++
arch/x86/Kconfig | 11 +
arch/x86/kernel/cpu/resctrl/Makefile | 1 +
arch/x86/kernel/cpu/resctrl/drivers/Makefile | 1 +
7 files changed, 368 insertions(+), 3 deletions(-)
create mode 100644 arch/x86/kernel/cpu/resctrl/drivers/resctrl_example.c
create mode 100644 arch/x86/kernel/cpu/resctrl/drivers/Makefile


base-commit: 6a8f57ae2eb07ab39a6f0ccad60c760743051026
--
2.39.2