Skip to content

Commit 2e53ad6

Browse files
aeglbp3tk0v
authored andcommitted
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
1 parent 39208e7 commit 2e53ad6

4 files changed

Lines changed: 16 additions & 0 deletions

File tree

arch/x86/kernel/cpu/resctrl/core.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@ struct rdt_hw_resource rdt_resources_all[RDT_NUM_RESOURCES] = {
100100
.schema_fmt = RESCTRL_SCHEMA_RANGE,
101101
},
102102
},
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+
},
103111
};
104112

105113
u32 resctrl_arch_system_num_rmid_idx(void)
@@ -440,6 +448,8 @@ static int get_domain_id_from_scope(int cpu, enum resctrl_scope scope)
440448
return get_cpu_cacheinfo_id(cpu, scope);
441449
case RESCTRL_L3_NODE:
442450
return cpu_to_node(cpu);
451+
case RESCTRL_PACKAGE:
452+
return topology_physical_package_id(cpu);
443453
default:
444454
break;
445455
}

fs/resctrl/internal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ struct rdtgroup {
255255

256256
#define RFTYPE_ASSIGN_CONFIG BIT(11)
257257

258+
#define RFTYPE_RES_PERF_PKG BIT(12)
259+
258260
#define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL)
259261

260262
#define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON)

fs/resctrl/rdtgroup.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2396,6 +2396,8 @@ static unsigned long fflags_from_resource(struct rdt_resource *r)
23962396
case RDT_RESOURCE_MBA:
23972397
case RDT_RESOURCE_SMBA:
23982398
return RFTYPE_RES_MB;
2399+
case RDT_RESOURCE_PERF_PKG:
2400+
return RFTYPE_RES_PERF_PKG;
23992401
}
24002402

24012403
return WARN_ON_ONCE(1);

include/linux/resctrl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ enum resctrl_res_level {
5353
RDT_RESOURCE_L2,
5454
RDT_RESOURCE_MBA,
5555
RDT_RESOURCE_SMBA,
56+
RDT_RESOURCE_PERF_PKG,
5657

5758
/* Must be the last */
5859
RDT_NUM_RESOURCES,
@@ -270,6 +271,7 @@ enum resctrl_scope {
270271
RESCTRL_L2_CACHE = 2,
271272
RESCTRL_L3_CACHE = 3,
272273
RESCTRL_L3_NODE,
274+
RESCTRL_PACKAGE,
273275
};
274276

275277
/**

0 commit comments

Comments
 (0)