Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

x86,fs/resctrl: Add and initialize a resource for package scope monitoring

Add a new PERF_PKG resource and introduce package level scope for monitoring
telemetry events so that CPU hotplug notifiers can build domains at the
package granularity.

Use the physical package ID available via topology_physical_package_id()
to identify the monitoring domains with package level scope. This enables
user space to use:

/sys/devices/system/cpu/cpuX/topology/physical_package_id

to identify the monitoring domain a CPU is associated with.

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>
Link: https://lore.kernel.org/20251217172121.12030-1-tony.luck@intel.com

authored by

Tony Luck and committed by
Borislav Petkov (AMD)
2e53ad66 39208e73

+16
+10
arch/x86/kernel/cpu/resctrl/core.c
··· 100 100 .schema_fmt = RESCTRL_SCHEMA_RANGE, 101 101 }, 102 102 }, 103 + [RDT_RESOURCE_PERF_PKG] = 104 + { 105 + .r_resctrl = { 106 + .name = "PERF_PKG", 107 + .mon_scope = RESCTRL_PACKAGE, 108 + .mon_domains = mon_domain_init(RDT_RESOURCE_PERF_PKG), 109 + }, 110 + }, 103 111 }; 104 112 105 113 u32 resctrl_arch_system_num_rmid_idx(void) ··· 448 440 return get_cpu_cacheinfo_id(cpu, scope); 449 441 case RESCTRL_L3_NODE: 450 442 return cpu_to_node(cpu); 443 + case RESCTRL_PACKAGE: 444 + return topology_physical_package_id(cpu); 451 445 default: 452 446 break; 453 447 }
+2
fs/resctrl/internal.h
··· 255 255 256 256 #define RFTYPE_ASSIGN_CONFIG BIT(11) 257 257 258 + #define RFTYPE_RES_PERF_PKG BIT(12) 259 + 258 260 #define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) 259 261 260 262 #define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON)
+2
fs/resctrl/rdtgroup.c
··· 2396 2396 case RDT_RESOURCE_MBA: 2397 2397 case RDT_RESOURCE_SMBA: 2398 2398 return RFTYPE_RES_MB; 2399 + case RDT_RESOURCE_PERF_PKG: 2400 + return RFTYPE_RES_PERF_PKG; 2399 2401 } 2400 2402 2401 2403 return WARN_ON_ONCE(1);
+2
include/linux/resctrl.h
··· 53 53 RDT_RESOURCE_L2, 54 54 RDT_RESOURCE_MBA, 55 55 RDT_RESOURCE_SMBA, 56 + RDT_RESOURCE_PERF_PKG, 56 57 57 58 /* Must be the last */ 58 59 RDT_NUM_RESOURCES, ··· 271 270 RESCTRL_L2_CACHE = 2, 272 271 RESCTRL_L3_CACHE = 3, 273 272 RESCTRL_L3_NODE, 273 + RESCTRL_PACKAGE, 274 274 }; 275 275 276 276 /**