Skip to content

Commit 906bd0f

Browse files
tursulinunerlige
authored andcommitted
drm/i915/pmu: Export counters from all tiles
Start exporting frequency and RC6 counters from all tiles. Existing counters keep their names and config values and new one use the namespace added in the previous patch, with the "-gtN" added to their names. Interrupts counter is an odd one off. Because it is the global device counters (not only GT) we choose not to add per tile versions for now. Signed-off-by: Tvrtko Ursulin <[email protected]> Signed-off-by: Aravind Iddamsetty <[email protected]> Reviewed-by: Umesh Nerlige Ramappa <[email protected]> Signed-off-by: Umesh Nerlige Ramappa <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent bc4be0a commit 906bd0f

File tree

1 file changed

+55
-27
lines changed

1 file changed

+55
-27
lines changed

drivers/gpu/drm/i915/i915_pmu.c

Lines changed: 55 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -940,11 +940,20 @@ static const struct attribute_group i915_pmu_cpumask_attr_group = {
940940
.attrs = i915_cpumask_attrs,
941941
};
942942

943-
#define __event(__config, __name, __unit) \
943+
#define __event(__counter, __name, __unit) \
944944
{ \
945-
.config = (__config), \
945+
.counter = (__counter), \
946946
.name = (__name), \
947947
.unit = (__unit), \
948+
.global = false, \
949+
}
950+
951+
#define __global_event(__counter, __name, __unit) \
952+
{ \
953+
.counter = (__counter), \
954+
.name = (__name), \
955+
.unit = (__unit), \
956+
.global = true, \
948957
}
949958

950959
#define __engine_event(__sample, __name) \
@@ -983,15 +992,16 @@ create_event_attributes(struct i915_pmu *pmu)
983992
{
984993
struct drm_i915_private *i915 = container_of(pmu, typeof(*i915), pmu);
985994
static const struct {
986-
u64 config;
995+
unsigned int counter;
987996
const char *name;
988997
const char *unit;
998+
bool global;
989999
} events[] = {
990-
__event(I915_PMU_ACTUAL_FREQUENCY, "actual-frequency", "M"),
991-
__event(I915_PMU_REQUESTED_FREQUENCY, "requested-frequency", "M"),
992-
__event(I915_PMU_INTERRUPTS, "interrupts", NULL),
993-
__event(I915_PMU_RC6_RESIDENCY, "rc6-residency", "ns"),
994-
__event(I915_PMU_SOFTWARE_GT_AWAKE_TIME, "software-gt-awake-time", "ns"),
1000+
__event(0, "actual-frequency", "M"),
1001+
__event(1, "requested-frequency", "M"),
1002+
__global_event(2, "interrupts", NULL),
1003+
__event(3, "rc6-residency", "ns"),
1004+
__event(4, "software-gt-awake-time", "ns"),
9951005
};
9961006
static const struct {
9971007
enum drm_i915_pmu_engine_sample sample;
@@ -1006,12 +1016,17 @@ create_event_attributes(struct i915_pmu *pmu)
10061016
struct i915_ext_attribute *i915_attr = NULL, *i915_iter;
10071017
struct attribute **attr = NULL, **attr_iter;
10081018
struct intel_engine_cs *engine;
1009-
unsigned int i;
1019+
struct intel_gt *gt;
1020+
unsigned int i, j;
10101021

10111022
/* Count how many counters we will be exposing. */
1012-
for (i = 0; i < ARRAY_SIZE(events); i++) {
1013-
if (!config_status(i915, events[i].config))
1014-
count++;
1023+
for_each_gt(gt, i915, j) {
1024+
for (i = 0; i < ARRAY_SIZE(events); i++) {
1025+
u64 config = ___I915_PMU_OTHER(j, events[i].counter);
1026+
1027+
if (!config_status(i915, config))
1028+
count++;
1029+
}
10151030
}
10161031

10171032
for_each_uabi_engine(engine, i915) {
@@ -1041,26 +1056,39 @@ create_event_attributes(struct i915_pmu *pmu)
10411056
attr_iter = attr;
10421057

10431058
/* Initialize supported non-engine counters. */
1044-
for (i = 0; i < ARRAY_SIZE(events); i++) {
1045-
char *str;
1046-
1047-
if (config_status(i915, events[i].config))
1048-
continue;
1049-
1050-
str = kstrdup(events[i].name, GFP_KERNEL);
1051-
if (!str)
1052-
goto err;
1059+
for_each_gt(gt, i915, j) {
1060+
for (i = 0; i < ARRAY_SIZE(events); i++) {
1061+
u64 config = ___I915_PMU_OTHER(j, events[i].counter);
1062+
char *str;
10531063

1054-
*attr_iter++ = &i915_iter->attr.attr;
1055-
i915_iter = add_i915_attr(i915_iter, str, events[i].config);
1064+
if (config_status(i915, config))
1065+
continue;
10561066

1057-
if (events[i].unit) {
1058-
str = kasprintf(GFP_KERNEL, "%s.unit", events[i].name);
1067+
if (events[i].global || !HAS_EXTRA_GT_LIST(i915))
1068+
str = kstrdup(events[i].name, GFP_KERNEL);
1069+
else
1070+
str = kasprintf(GFP_KERNEL, "%s-gt%u",
1071+
events[i].name, j);
10591072
if (!str)
10601073
goto err;
10611074

1062-
*attr_iter++ = &pmu_iter->attr.attr;
1063-
pmu_iter = add_pmu_attr(pmu_iter, str, events[i].unit);
1075+
*attr_iter++ = &i915_iter->attr.attr;
1076+
i915_iter = add_i915_attr(i915_iter, str, config);
1077+
1078+
if (events[i].unit) {
1079+
if (events[i].global || !HAS_EXTRA_GT_LIST(i915))
1080+
str = kasprintf(GFP_KERNEL, "%s.unit",
1081+
events[i].name);
1082+
else
1083+
str = kasprintf(GFP_KERNEL, "%s-gt%u.unit",
1084+
events[i].name, j);
1085+
if (!str)
1086+
goto err;
1087+
1088+
*attr_iter++ = &pmu_iter->attr.attr;
1089+
pmu_iter = add_pmu_attr(pmu_iter, str,
1090+
events[i].unit);
1091+
}
10641092
}
10651093
}
10661094

0 commit comments

Comments
 (0)