The Sub-NUMA cluster feature on some Intel processors partitions the CPUs that share an L3 cache into two or more sets. This plays havoc with the Resource Director Technology (RDT) monitoring features. Prior to this patch Intel has advised that SNC and RDT are incompatible. Some of these CPU support an MSR that can partition the RMID counters in the same way. This allows for monitoring features to be used (with the caveat that memory accesses between different SNC NUMA nodes may still not be counted accuratlely. Note that this patch series improves resctrl reporting considerably on systems with SNC enabled, but there will still be some anomalies for processes accessing memory from other sub-NUMA nodes. Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx> Changes since v4: Rebased to upstream v6.5 Addressed problems reported by Reinette in follow-up messages to v4 posting: https://lore.kernel.org/r/20230722190740.326190-1-tony.luck@xxxxxxxxx Broke the patch series into a (hopefully) more logical progression. First two patches are infrastructure changes to allow resctrl domains to have scopes that are not defined by which CPUs share a particular cache instance, and to allow resources to have different scope for control an monitor features. Patch 3 cleans up some loose ends from the first two patches by adding a new variant of the rdt_domain structure with just monitoring fields, and removing the monitor fields from the original rdt_domain structure since it is now only used for control features. Patch 4 adds "node" as a scope option. Patch 5 adjusts all code paths that need to be aware of SNC mode. Patch 6 detects SNC mode, modifies the MSR that adjusts interpretation of physical RMID counters. Patch 7 updates documentation. Patch 8 does a partial update for the resctrl selftests. Tony Luck (8): x86/resctrl: Prepare for new domain scope x86/resctrl: Prepare for different scope for control/monitor operations x86/resctrl: Split the rdt_domain structure x86/resctrl: Add node-scope to the options for feature scope x86/resctrl: Introduce snc_nodes_per_l3_cache x86/resctrl: Sub NUMA Cluster detection and enable x86/resctrl: Update documentation with Sub-NUMA cluster changes selftests/resctrl: Adjust effective L3 cache size when SNC enabled Documentation/arch/x86/resctrl.rst | 25 +- include/linux/resctrl.h | 64 ++-- arch/x86/include/asm/msr-index.h | 1 + arch/x86/kernel/cpu/resctrl/internal.h | 42 ++- tools/testing/selftests/resctrl/resctrl.h | 1 + arch/x86/kernel/cpu/resctrl/core.c | 321 ++++++++++++++++---- arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 6 +- arch/x86/kernel/cpu/resctrl/monitor.c | 58 ++-- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 15 +- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 69 +++-- tools/testing/selftests/resctrl/resctrlfs.c | 57 ++++ 11 files changed, 508 insertions(+), 151 deletions(-) base-commit: 2dde18cd1d8fac735875f2e4987f11817cc0bc2c -- 2.41.0