Skip to content

Commit

Permalink
drm/i915/pmu: Do not use colons or dashes in PMU names
Browse files Browse the repository at this point in the history
We use PCI device path in the registered PMU name in order to distinguish
between multiple GPUs. But since tools/perf reserves a special meaning to
dash and colon characters we need to transliterate them to something else.
We choose an underscore.

v2:
 * Use strreplace. (Chris)
 * Dashes are not good either. (Chris)

Signed-off-by: Tvrtko Ursulin <[email protected]>
Reported-by: Dmitry Rogozhkin <[email protected]>
Fixes: 0548867 ("drm/i915/pmu: Support multiple GPUs")
Cc: Chris Wilson <[email protected]>
Cc: Michal Wajdeczko <[email protected]>
Cc: Andi Kleen <[email protected]>
Reviewed-by: Chris Wilson <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
tursulin committed Jan 13, 2020
1 parent d713e3a commit aebf3b5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/gpu/drm/i915/i915_pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1117,12 +1117,17 @@ void i915_pmu_register(struct drm_i915_private *i915)
hrtimer_init(&pmu->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
pmu->timer.function = i915_sample;

if (!is_igp(i915))
if (!is_igp(i915)) {
pmu->name = kasprintf(GFP_KERNEL,
"i915-%s",
"i915_%s",
dev_name(i915->drm.dev));
else
if (pmu->name) {
/* tools/perf reserves colons as special. */
strreplace((char *)pmu->name, ':', '_');
}
} else {
pmu->name = "i915";
}
if (!pmu->name)
goto err;

Expand Down

0 comments on commit aebf3b5

Please sign in to comment.