x86/resctrl: Make __mon_event_count() handle sum domains
authorTony Luck <tony.luck@intel.com>
Fri, 28 Jun 2024 21:56:16 +0000 (14:56 -0700)
committerBorislav Petkov (AMD) <bp@alien8.de>
Tue, 2 Jul 2024 17:57:22 +0000 (19:57 +0200)
commit9fbb303ec949a376f3cbdf6a2b66ad2212c24ebc
tree764d30862d41c67c76bbcd13ffcfc62a6460c1fe
parentc8c7d3d904b76c45fe2b5dc982fb5090d12a63af
x86/resctrl: Make __mon_event_count() handle sum domains

Legacy resctrl monitor files must provide the sum of event values across
all Sub-NUMA Cluster (SNC) domains that share an L3 cache instance.

There are now two cases:
1) A specific domain is provided in struct rmid_read
   This is either a non-SNC system, or the request is to read data
   from just one SNC node.
2) Domain pointer is NULL. In this case the cacheinfo field in struct
   rmid_read indicates that all SNC nodes that share that L3 cache
   instance should have the event read and return the sum of all
   values.

Update the CPU sanity check. The existing check that an event is read
from a CPU in the requested domain still applies when reading a single
domain. But when summing across domains a more relaxed check that the
current CPU is in the scope of the L3 cache instance is appropriate
since the MSRs to read events are scoped at L3 cache level.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Tested-by: Babu Moger <babu.moger@amd.com>
Link: https://lore.kernel.org/r/20240628215619.76401-17-tony.luck@intel.com
arch/x86/kernel/cpu/resctrl/monitor.c