Skip to content

Commit 19a3981

Browse files
Roman SudarikovPeter Zijlstra
authored andcommitted
perf/x86/intel/uncore: Expose an Uncore unit to PMON mapping
Each Uncore unit type, by its nature, can be mapped to its own context - which platform component each PMON block of that type is supposed to monitor. Intel® Xeon® Scalable processor family (code name Skylake-SP) makes significant changes in the integrated I/O (IIO) architecture. The new solution introduces IIO stacks which are responsible for managing traffic between the PCIe domain and the Mesh domain. Each IIO stack has its own PMON block and can handle either DMI port, x16 PCIe root port, MCP-Link or various built-in accelerators. IIO PMON blocks allow concurrent monitoring of I/O flows up to 4 x4 bifurcation within each IIO stack. Software is supposed to program required perf counters within each IIO stack and gather performance data. The tricky thing here is that IIO PMON reports data per IIO stack but users have no idea what IIO stacks are - they only know devices which are connected to the platform. Understanding IIO stack concept to find which IIO stack that particular IO device is connected to, or to identify an IIO PMON block to program for monitoring specific IIO stack assumes a lot of implicit knowledge about given Intel server platform architecture. Usage example: ls /sys/devices/uncore_<type>_<pmu_idx>/die* Signed-off-by: Alexander Antonov <[email protected]> Signed-off-by: Roman Sudarikov <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Kan Liang <[email protected]> Reviewed-by: Alexander Shishkin <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent f017197 commit 19a3981

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

arch/x86/events/intel/uncore.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,10 +846,12 @@ static int uncore_pmu_register(struct intel_uncore_pmu *pmu)
846846
.read = uncore_pmu_event_read,
847847
.module = THIS_MODULE,
848848
.capabilities = PERF_PMU_CAP_NO_EXCLUDE,
849+
.attr_update = pmu->type->attr_update,
849850
};
850851
} else {
851852
pmu->pmu = *pmu->type->pmu;
852853
pmu->pmu.attr_groups = pmu->type->attr_groups;
854+
pmu->pmu.attr_update = pmu->type->attr_update;
853855
}
854856

855857
if (pmu->type->num_boxes == 1) {
@@ -890,6 +892,9 @@ static void uncore_type_exit(struct intel_uncore_type *type)
890892
struct intel_uncore_pmu *pmu = type->pmus;
891893
int i;
892894

895+
if (type->cleanup_mapping)
896+
type->cleanup_mapping(type);
897+
893898
if (pmu) {
894899
for (i = 0; i < type->num_boxes; i++, pmu++) {
895900
uncore_pmu_unregister(pmu);
@@ -957,6 +962,9 @@ static int __init uncore_type_init(struct intel_uncore_type *type, bool setid)
957962

958963
type->pmu_group = &uncore_pmu_attr_group;
959964

965+
if (type->set_mapping)
966+
type->set_mapping(type);
967+
960968
return 0;
961969

962970
err:

arch/x86/events/intel/uncore.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,19 @@ struct intel_uncore_type {
7373
struct uncore_event_desc *event_descs;
7474
struct freerunning_counters *freerunning;
7575
const struct attribute_group *attr_groups[4];
76+
const struct attribute_group **attr_update;
7677
struct pmu *pmu; /* for custom pmu ops */
78+
/*
79+
* Uncore PMU would store relevant platform topology configuration here
80+
* to identify which platform component each PMON block of that type is
81+
* supposed to monitor.
82+
*/
83+
u64 *topology;
84+
/*
85+
* Optional callbacks for managing mapping of Uncore units to PMONs
86+
*/
87+
int (*set_mapping)(struct intel_uncore_type *type);
88+
void (*cleanup_mapping)(struct intel_uncore_type *type);
7789
};
7890

7991
#define pmu_group attr_groups[0]

0 commit comments

Comments
 (0)