Skip to contentSkip to conversation

drm/i915/pmu: Do not use colon characters in PMU names

PATCH Superseded Tvrtko Ursulin 3 participants 8 messages Jan 10, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/pmu: Do not use colon characters in PMU names

From: Tvrtko Ursulin <[email protected]>

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 the colon character we need to transliterate them to something else. We choose a dash.

Fixes 05488673a4d4 ("drm/i915/pmu: Support multiple GPUs")
Cc Chris Wilson <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Cc Andi Kleen <[email protected]>
---
 drivers/gpu/drm/i915/i915_pmu.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_pmu.c +12 -2
index f3ef6700a5f2..ecbd0e1f1a90 100644
@@ -1117,12 +1117,22 @@ 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",
 				      dev_name(i915->drm.dev));
-	else
+		if (pmu->name) {
+			char *p;
+
+			/* tools/perf reserves colons as special. */
+			for (p = (char *)pmu->name; *p; p++) {
+				if (*p == ':')
+					*p = '-';
+			}
+		}
+	} else {
 		pmu->name = "i915";
+	}
 	if (!pmu->name)
 		goto err;
 
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

Quoting Tvrtko Ursulin (2020-01-10 11:11:26)

Quoted 22 lines

From: Tvrtko Ursulin <[email protected]>

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 the colon character we need to transliterate them to something else. We choose a dash.

Fixes 05488673a4d4 ("drm/i915/pmu: Support multiple GPUs")
Cc Chris Wilson <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Cc Andi Kleen <[email protected]>
---
 drivers/gpu/drm/i915/i915_pmu.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_pmu.c +0 -0
index f3ef6700a5f2..ecbd0e1f1a90 100644

drivers/gpu/drm/i915/i915_pmu.c void i915_pmu_register(struct drm_i915_private *i915) · line 1124

Quoted 10 lines
drivers/gpu/drm/i915/i915_pmu.c +2 -2
@@ -1117,12 +1117,22 @@ 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",
                                      dev_name(i915->drm.dev));
-       else
+               if (pmu->name) {

/* tools/perf reserves colons as special. */
strreplace(pmu->name, ':', '-');

I worry because the err_idx pointed to the '-'. We may have to use _ -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
Quoted 26 lines · Chris Wilson

Quoting Tvrtko Ursulin (2020-01-10 11:11:26)

Quoted 25 lines

From: Tvrtko Ursulin <[email protected]>

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 the colon character we need to transliterate them to something else. We choose a dash.

Fixes 05488673a4d4 ("drm/i915/pmu: Support multiple GPUs")
Cc Chris Wilson <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Cc Andi Kleen <[email protected]>
---
  drivers/gpu/drm/i915/i915_pmu.c | 14 ++++++++++++--
  1 file changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_pmu.c +0 -0
index f3ef6700a5f2..ecbd0e1f1a90 100644
@@ -1117,12 +1117,22 @@ void i915_pmu_register(struct drm_i915_private *i915)
         hrtimer_init(&pmu->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
         pmu->timer.function = i915_sample;
 
Quoted 10 lines

drivers/gpu/drm/i915/i915_pmu.c void i915_pmu_register(struct drm_i915_private *i915) · line 1124

Quoted 7 lines
drivers/gpu/drm/i915/i915_pmu.c +2 -2
-       if (!is_igp(i915))
+       if (!is_igp(i915)) {
                 pmu->name = kasprintf(GFP_KERNEL,
                                       "i915-%s",
                                       dev_name(i915->drm.dev));
-       else
+               if (pmu->name) {

/* tools/perf reserves colons as special. */
strreplace(pmu->name, ':', '-');

I didn't know this exists, thanks.

Quoted 1 line

I worry because the err_idx pointed to the '-'. We may have to use _

What is err_idx? But yes.. it would had served me well to test before sending. :) I just find identifiers with a mix of underscores and dashes so visually unappealing. :(

Regards,

Tvrtko

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Quoting Tvrtko Ursulin (2020-01-10 11:27:55)

Quoted 39 lines · Chris Wilson
Quoted 26 lines

Quoting Tvrtko Ursulin (2020-01-10 11:11:26)

Quoted 25 lines

From: Tvrtko Ursulin <[email protected]>

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 the colon character we need to transliterate them to something else. We choose a dash.

Fixes 05488673a4d4 ("drm/i915/pmu: Support multiple GPUs")
Cc Chris Wilson <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Cc Andi Kleen <[email protected]>
---
  drivers/gpu/drm/i915/i915_pmu.c | 14 ++++++++++++--
  1 file changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_pmu.c +0 -0
index f3ef6700a5f2..ecbd0e1f1a90 100644
@@ -1117,12 +1117,22 @@ void i915_pmu_register(struct drm_i915_private *i915)
         hrtimer_init(&pmu->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
         pmu->timer.function = i915_sample;
 
Quoted 10 lines

drivers/gpu/drm/i915/i915_pmu.c void i915_pmu_register(struct drm_i915_private *i915) · line 1124

Quoted 7 lines
drivers/gpu/drm/i915/i915_pmu.c +2 -2
-       if (!is_igp(i915))
+       if (!is_igp(i915)) {
                 pmu->name = kasprintf(GFP_KERNEL,
                                       "i915-%s",
                                       dev_name(i915->drm.dev));
-       else
+               if (pmu->name) {

/* tools/perf reserves colons as special. */
strreplace(pmu->name, ':', '-');

Quoted 7 lines

I didn't know this exists, thanks.

Quoted 1 line

I worry because the err_idx pointed to the '-'. We may have to use _

What is err_idx? But yes.. it would had served me well to test before sending. :) I just find identifiers with a mix of underscores and dashes so visually unappealing. :(

event syntax error: 'i915-0000:00:02.0/bcs0-busy/'
\___ parser error

The parser sets err_idx on the character it failed at, and the error message includes it. So unless we lost whitespace in all the cutting and pasting, that says it barfed at '-'
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
Quoted 48 lines · Chris Wilson

Quoting Tvrtko Ursulin (2020-01-10 11:27:55)

Quoted 39 lines · Chris Wilson
Quoted 26 lines

Quoting Tvrtko Ursulin (2020-01-10 11:11:26)

Quoted 25 lines

From: Tvrtko Ursulin <[email protected]>

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 the colon character we need to transliterate them to something else. We choose a dash.

Fixes 05488673a4d4 ("drm/i915/pmu: Support multiple GPUs")
Cc Chris Wilson <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Cc Andi Kleen <[email protected]>
---
   drivers/gpu/drm/i915/i915_pmu.c | 14 ++++++++++++--
   1 file changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_pmu.c +0 -0
index f3ef6700a5f2..ecbd0e1f1a90 100644
@@ -1117,12 +1117,22 @@ void i915_pmu_register(struct drm_i915_private *i915)
          hrtimer_init(&pmu->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
          pmu->timer.function = i915_sample;
 
Quoted 10 lines

drivers/gpu/drm/i915/i915_pmu.c void i915_pmu_register(struct drm_i915_private *i915) · line 1124

Quoted 7 lines
drivers/gpu/drm/i915/i915_pmu.c +2 -2
-       if (!is_igp(i915))
+       if (!is_igp(i915)) {
                  pmu->name = kasprintf(GFP_KERNEL,
                                        "i915-%s",
                                        dev_name(i915->drm.dev));
-       else
+               if (pmu->name) {

/* tools/perf reserves colons as special. */
strreplace(pmu->name, ':', '-');

Quoted 7 lines

I didn't know this exists, thanks.

Quoted 1 line

I worry because the err_idx pointed to the '-'. We may have to use _

What is err_idx? But yes.. it would had served me well to test before sending. :) I just find identifiers with a mix of underscores and dashes so visually unappealing. :(

Quoted 6 lines

event syntax error: 'i915-0000:00:02.0/bcs0-busy/'
\___ parser error

The parser sets err_idx on the character it failed at, and the error message includes it. So unless we lost whitespace in all the cutting and pasting, that says it barfed at '-'

Oh right, interesting that it has no problem with a dash in event name. In v2 full event string is:

i915_0000_00_02.0/vcs0-busy/

A bit ugly but seems to work.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

PATCH v2 1/1 drm/i915/pmu: Do not use colons or dashes in PMU names

In reply to Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

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)

Fixes 05488673a4d4 ("drm/i915/pmu: Support multiple GPUs")
Cc Chris Wilson <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Cc Andi Kleen <[email protected]>
---
 drivers/gpu/drm/i915/i915_pmu.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_pmu.c +8 -3
index f3ef6700a5f2..28a82c849bac 100644
@@ -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;
 
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 1/1
#6 lore raw

Re: [Intel-gfx] [PATCH v2] drm/i915/pmu: Do not use colons or dashes in PMU names

Quoting Tvrtko Ursulin (2020-01-10 11:32:53)

Quoted 35 lines

From: Tvrtko Ursulin <[email protected]>

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)

Fixes 05488673a4d4 ("drm/i915/pmu: Support multiple GPUs")
Cc Chris Wilson <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Cc Andi Kleen <[email protected]>
---
 drivers/gpu/drm/i915/i915_pmu.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_pmu.c +2 -2
index f3ef6700a5f2..28a82c849bac 100644
@@ -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));

drivers/gpu/drm/i915/i915_pmu.c void i915_pmu_register(struct drm_i915_private *i915) · line 1132

Quoted 10 lines
drivers/gpu/drm/i915/i915_pmu.c +6 -1
-       else
+               if (pmu->name) {
+                       /* tools/perf reserves colons as special. */
+                       strreplace((char *)pmu->name, ':', '_');
+               }
+       } else {
                pmu->name = "i915";
+       }
        if (!pmu->name)
                goto err;

Sadly I have no nicer suggestion, so

-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/pmu: Do not use colon characters in PMU names (rev2)

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: drm/i915/pmu: Do not use colon characters in PMU names (rev2)
URL : https://patchwork.freedesktop.org/series/71878/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_7718 -> Patchwork_16050
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16050/index.html

Known issues
------------

Here are the changes found in Patchwork_16050 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_sync@basic-all:
- fi-tgl-y: [PASS][1] -> [INCOMPLETE][2] ([i915#470] / [i915#472])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7718/fi-tgl-y/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16050/fi-tgl-y/igt@[email protected]

* igt@i915_module_load@reload-with-fault-injection:
- fi-cfl-8700k: [PASS][3] -> [INCOMPLETE][4] ([i915#505])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7718/fi-cfl-8700k/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16050/fi-cfl-8700k/igt@[email protected]

* igt@i915_selftest@live_blt:
- fi-ivb-3770: [PASS][5] -> [DMESG-FAIL][6] ([i915#725])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7718/fi-ivb-3770/igt@i915_selftest@live_blt.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16050/fi-ivb-3770/igt@i915_selftest@live_blt.html
- fi-hsw-peppy: [PASS][7] -> [DMESG-FAIL][8] ([i915#725])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7718/fi-hsw-peppy/igt@i915_selftest@live_blt.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16050/fi-hsw-peppy/igt@i915_selftest@live_blt.html

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [PASS][9] -> [FAIL][10] ([fdo#111407])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7718/fi-kbl-7500u/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16050/fi-kbl-7500u/igt@[email protected]

#### Possible fixes ####

* igt@gem_close_race@basic-threads:
- fi-byt-j1900: [TIMEOUT][11] ([i915#816]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7718/fi-byt-j1900/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16050/fi-byt-j1900/igt@[email protected]

* {igt@gem_exec_basic@basic@bcs0}:
- fi-byt-n2820: [FAIL][13] ([i915#694]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7718/fi-byt-n2820/igt@gem_exec_basic@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16050/fi-byt-n2820/igt@gem_exec_basic@[email protected]

* {igt@gem_exec_basic@basic@vcs0}:
- fi-byt-n2820: [WARN][15] -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7718/fi-byt-n2820/igt@gem_exec_basic@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16050/fi-byt-n2820/igt@gem_exec_basic@[email protected]

* igt@i915_module_load@reload-with-fault-injection:
- fi-kbl-x1275: [INCOMPLETE][17] ([i915#879]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7718/fi-kbl-x1275/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16050/fi-kbl-x1275/igt@[email protected]

* igt@i915_pm_rpm@module-reload:
- fi-skl-6770hq: [FAIL][19] ([i915#178]) -> [PASS][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7718/fi-skl-6770hq/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16050/fi-skl-6770hq/igt@[email protected]

* igt@i915_selftest@live_blt:
- fi-hsw-4770: [DMESG-FAIL][21] ([i915#563]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7718/fi-hsw-4770/igt@i915_selftest@live_blt.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16050/fi-hsw-4770/igt@i915_selftest@live_blt.html

* igt@i915_selftest@live_gem_contexts:
- fi-byt-n2820: [DMESG-FAIL][23] ([i915#722]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7718/fi-byt-n2820/igt@i915_selftest@live_gem_contexts.html
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16050/fi-byt-n2820/igt@i915_selftest@live_gem_contexts.html

#### Warnings ####

* igt@i915_selftest@live_blt:
- fi-hsw-4770r: [DMESG-FAIL][25] ([i915#725]) -> [DMESG-FAIL][26] ([i915#553] / [i915#725])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7718/fi-hsw-4770r/igt@i915_selftest@live_blt.html
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16050/fi-hsw-4770r/igt@i915_selftest@live_blt.html

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#111407]: https://bugs.freedesktop.org/show_bug.cgi?id=111407
[i915#178]: https://gitlab.freedesktop.org/drm/intel/issues/178
[i915#470]: https://gitlab.freedesktop.org/drm/intel/issues/470
[i915#472]: https://gitlab.freedesktop.org/drm/intel/issues/472
[i915#505]: https://gitlab.freedesktop.org/drm/intel/issues/505
[i915#553]: https://gitlab.freedesktop.org/drm/intel/issues/553
[i915#563]: https://gitlab.freedesktop.org/drm/intel/issues/563
[i915#694]: https://gitlab.freedesktop.org/drm/intel/issues/694
[i915#722]: https://gitlab.freedesktop.org/drm/intel/issues/722
[i915#725]: https://gitlab.freedesktop.org/drm/intel/issues/725
[i915#816]: https://gitlab.freedesktop.org/drm/intel/issues/816
[i915#879]: https://gitlab.freedesktop.org/drm/intel/issues/879

Participating hosts (46 -> 46)
------------------------------

Additional (5): fi-bdw-5557u fi-bsw-n3050 fi-gdg-551 fi-bsw-nick fi-snb-2600
Missing (5): fi-ehl-1 fi-hsw-4200u fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper

Build changes
-------------

* CI: CI-20190529 -> None
* Linux: CI_DRM_7718 -> Patchwork_16050

CI-20190529: 20190529
CI_DRM_7718: 37be537ac03a8299982f5fd177418aef86fdcc9e @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5362: c2843f8e06a2cf7d372cd154310bf0e3b7722ab8 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_16050: e786004d5661f78f77d21490865953917990426f @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

e786004d5661 drm/i915/pmu: Do not use colons or dashes in PMU names

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16050/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx