All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [i-g-t] i915/perf: Correct the logic of finding i915 pmu event path
@ 2020-04-10 10:20 Terrence Xu
  2020-04-10 10:31 ` Chris Wilson
  2020-04-10 11:10 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
  0 siblings, 2 replies; 5+ messages in thread
From: Terrence Xu @ 2020-04-10 10:20 UTC (permalink / raw)
  To: igt-dev; +Cc: colin.xu, zhenyu.z.wang, gordon.jin

Hardcoded i915 PMU event path /sys/bus/event_source/devices/i915
isn't always correct when vGPU isn't on BDF 0:2.0 in virtualization
environment.

e.g. It will show as sys/bus/event_source/devices/i915-0000:00:03.0
when vGPU is on BDF 0:3.0.

Refine the path name so that intel_gpu_top can find the correct adapter.

Signed-off-by: Terrence Xu <terrence.xu@intel.com>
---
 lib/igt_perf.c        | 15 ++++++++++++++-
 tools/intel_gpu_top.c | 16 +++++++++++++++-
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/lib/igt_perf.c b/lib/igt_perf.c
index 418c1c188..3531209b3 100644
--- a/lib/igt_perf.c
+++ b/lib/igt_perf.c
@@ -7,6 +7,7 @@
 #include <sys/stat.h>
 #include <sys/sysinfo.h>
 #include <sys/sysmacros.h>
+#include <dirent.h>
 
 #include "igt_perf.h"
 
@@ -75,11 +76,23 @@ uint64_t i915_perf_type_id(int i915)
 uint64_t igt_perf_type_id(const char *device)
 {
 	char buf[64];
+	char dev[64];
 	ssize_t ret;
 	int fd;
+	DIR *dir;
+	struct dirent *dent;
+
+	dir = opendir("/sys/bus/event_source/devices/");
+
+	while ((dent = readdir(dir))) {
+		if (!(strncmp(dent->d_name, device, strlen(device)))) {
+			strcpy(dev, dent->d_name);
+			break;
+		}
+	}
 
 	snprintf(buf, sizeof(buf),
-		 "/sys/bus/event_source/devices/%s/type", device);
+		 "/sys/bus/event_source/devices/%s/type", dev);
 
 	fd = open(buf, O_RDONLY);
 	if (fd < 0)
diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index 8197482dd..065c40bba 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -170,11 +170,13 @@ static int engine_cmp(const void *__a, const void *__b)
 
 static struct engines *discover_engines(void)
 {
-	const char *sysfs_root = "/sys/devices/i915/events";
+	const char *sysfs_root = "/sys/bus/event_source/devices/";
 	struct engines *engines;
 	struct dirent *dent;
 	int ret = 0;
 	DIR *d;
+	char dev[64];
+	char eve[64];
 
 	engines = malloc(sizeof(struct engines));
 	if (!engines)
@@ -184,7 +186,19 @@ static struct engines *discover_engines(void)
 
 	engines->num_engines = 0;
 
+
 	d = opendir(sysfs_root);
+	while ((dent = readdir(d))) {
+
+		if (!(strncmp(dent->d_name, "i915", 4))) {
+			strcpy(dev, dent->d_name);
+			break;
+		}
+	}
+
+	sprintf(eve, "%s%s/events", sysfs_root, dev);
+
+	d = opendir(eve);
 	if (!d)
 		return NULL;
 
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [igt-dev] [i-g-t] i915/perf: Correct the logic of finding i915 pmu event path
  2020-04-10 10:20 [igt-dev] [i-g-t] i915/perf: Correct the logic of finding i915 pmu event path Terrence Xu
@ 2020-04-10 10:31 ` Chris Wilson
  2020-04-10 12:32   ` Xu, Terrence
  2020-04-10 11:10 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
  1 sibling, 1 reply; 5+ messages in thread
From: Chris Wilson @ 2020-04-10 10:31 UTC (permalink / raw)
  To: Terrence Xu, igt-dev; +Cc: colin.xu, zhenyu.z.wang, gordon.jin

Quoting Terrence Xu (2020-04-10 11:20:46)
> Hardcoded i915 PMU event path /sys/bus/event_source/devices/i915
> isn't always correct when vGPU isn't on BDF 0:2.0 in virtualization
> environment.
> 
> e.g. It will show as sys/bus/event_source/devices/i915-0000:00:03.0
> when vGPU is on BDF 0:3.0.
> 
> Refine the path name so that intel_gpu_top can find the correct adapter.
> 
> Signed-off-by: Terrence Xu <terrence.xu@intel.com>
> ---
>  lib/igt_perf.c        | 15 ++++++++++++++-
>  tools/intel_gpu_top.c | 16 +++++++++++++++-
>  2 files changed, 29 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/igt_perf.c b/lib/igt_perf.c
> index 418c1c188..3531209b3 100644
> --- a/lib/igt_perf.c
> +++ b/lib/igt_perf.c
> @@ -7,6 +7,7 @@
>  #include <sys/stat.h>
>  #include <sys/sysinfo.h>
>  #include <sys/sysmacros.h>
> +#include <dirent.h>
>  
>  #include "igt_perf.h"
>  
> @@ -75,11 +76,23 @@ uint64_t i915_perf_type_id(int i915)
>  uint64_t igt_perf_type_id(const char *device)
>  {
>         char buf[64];
> +       char dev[64];
>         ssize_t ret;
>         int fd;
> +       DIR *dir;
> +       struct dirent *dent;
> +
> +       dir = opendir("/sys/bus/event_source/devices/");

Nak, this is passed the explicit device to use.

i915_perf_type_id() takes the device fd and expands it to the pmu device
name.
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [igt-dev] ✗ Fi.CI.BAT: failure for i915/perf: Correct the logic of finding i915 pmu event path
  2020-04-10 10:20 [igt-dev] [i-g-t] i915/perf: Correct the logic of finding i915 pmu event path Terrence Xu
  2020-04-10 10:31 ` Chris Wilson
@ 2020-04-10 11:10 ` Patchwork
  1 sibling, 0 replies; 5+ messages in thread
From: Patchwork @ 2020-04-10 11:10 UTC (permalink / raw)
  To: Terrence Xu; +Cc: igt-dev

== Series Details ==

Series: i915/perf: Correct the logic of finding i915 pmu event path
URL   : https://patchwork.freedesktop.org/series/75794/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_8289 -> IGTPW_4444
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with IGTPW_4444 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_4444, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

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

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in IGTPW_4444:

### IGT changes ###

#### Possible regressions ####

  * igt@i915_selftest@live@execlists:
    - fi-skl-lmem:        [PASS][1] -> [DMESG-WARN][2] +1 similar issue
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8289/fi-skl-lmem/igt@i915_selftest@live@execlists.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4444/fi-skl-lmem/igt@i915_selftest@live@execlists.html

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

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

### IGT changes ###

#### Possible fixes ####

  * igt@kms_flip@basic-flip-vs-wf_vblank:
    - fi-skl-lmem:        [DMESG-WARN][3] -> [PASS][4]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8289/fi-skl-lmem/igt@kms_flip@basic-flip-vs-wf_vblank.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4444/fi-skl-lmem/igt@kms_flip@basic-flip-vs-wf_vblank.html

  
#### Warnings ####

  * igt@i915_pm_rpm@module-reload:
    - fi-kbl-x1275:       [FAIL][5] ([i915#62] / [i915#95]) -> [SKIP][6] ([fdo#109271])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8289/fi-kbl-x1275/igt@i915_pm_rpm@module-reload.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4444/fi-kbl-x1275/igt@i915_pm_rpm@module-reload.html

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

  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [i915#62]: https://gitlab.freedesktop.org/drm/intel/issues/62
  [i915#666]: https://gitlab.freedesktop.org/drm/intel/issues/666
  [i915#95]: https://gitlab.freedesktop.org/drm/intel/issues/95


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

  Missing    (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-byt-clapper fi-bdw-samus 


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

  * CI: CI-20190529 -> None
  * IGT: IGT_5586 -> IGTPW_4444

  CI-20190529: 20190529
  CI_DRM_8289: 81e3d7ff72672b6aeadbf9c0b9cc514cec9c889d @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_4444: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4444/index.html
  IGT_5586: 29fad328e6a1b105c8d688cafe19b1b5c19ad0c8 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4444/index.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [igt-dev] [i-g-t] i915/perf: Correct the logic of finding i915 pmu event path
  2020-04-10 10:31 ` Chris Wilson
@ 2020-04-10 12:32   ` Xu, Terrence
  2020-04-14 12:05     ` Tvrtko Ursulin
  0 siblings, 1 reply; 5+ messages in thread
From: Xu, Terrence @ 2020-04-10 12:32 UTC (permalink / raw)
  To: Chris Wilson, igt-dev; +Cc: Xu, Colin, Wang, Zhenyu Z, Jin, Gordon


> -----Original Message-----
> From: Chris Wilson <chris@chris-wilson.co.uk>
> Quoting Terrence Xu (2020-04-10 11:20:46)
> > Hardcoded i915 PMU event path /sys/bus/event_source/devices/i915
> > isn't always correct when vGPU isn't on BDF 0:2.0 in virtualization
> > environment.
> >
> > e.g. It will show as sys/bus/event_source/devices/i915-0000:00:03.0
> > when vGPU is on BDF 0:3.0.
> >
> > Refine the path name so that intel_gpu_top can find the correct adapter.
> >
> > Signed-off-by: Terrence Xu <terrence.xu@intel.com>
> > ---
> >  lib/igt_perf.c        | 15 ++++++++++++++-
> >  tools/intel_gpu_top.c | 16 +++++++++++++++-
> >  2 files changed, 29 insertions(+), 2 deletions(-)
> >
> > diff --git a/lib/igt_perf.c b/lib/igt_perf.c index
> > 418c1c188..3531209b3 100644
> > --- a/lib/igt_perf.c
> > +++ b/lib/igt_perf.c
> > @@ -7,6 +7,7 @@
> >  #include <sys/stat.h>
> >  #include <sys/sysinfo.h>
> >  #include <sys/sysmacros.h>
> > +#include <dirent.h>
> >
> >  #include "igt_perf.h"
> >
> > @@ -75,11 +76,23 @@ uint64_t i915_perf_type_id(int i915)  uint64_t
> > igt_perf_type_id(const char *device)  {
> >         char buf[64];
> > +       char dev[64];
> >         ssize_t ret;
> >         int fd;
> > +       DIR *dir;
> > +       struct dirent *dent;
> > +
> > +       dir = opendir("/sys/bus/event_source/devices/");
> 
> Nak, this is passed the explicit device to use.
> 
> i915_perf_type_id() takes the device fd and expands it to the pmu device name.
> -Chris
[Xu, Terrence] Thanks for your quick response!  Do you think we can use perf_i915_open_group() instead of perf_igfx_open_group() in intel_gpu_top when open pmu? Since i915_perf_type_id() can provide the right i915 pmu.
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [igt-dev] [i-g-t] i915/perf: Correct the logic of finding i915 pmu event path
  2020-04-10 12:32   ` Xu, Terrence
@ 2020-04-14 12:05     ` Tvrtko Ursulin
  0 siblings, 0 replies; 5+ messages in thread
From: Tvrtko Ursulin @ 2020-04-14 12:05 UTC (permalink / raw)
  To: Xu, Terrence, Chris Wilson, igt-dev
  Cc: Ayaz A Siddiqui, Xu, Colin, Wang, Zhenyu Z, Jin, Gordon


+ Ayaz

On 10/04/2020 13:32, Xu, Terrence wrote:
> 
>> -----Original Message-----
>> From: Chris Wilson <chris@chris-wilson.co.uk>
>> Quoting Terrence Xu (2020-04-10 11:20:46)
>>> Hardcoded i915 PMU event path /sys/bus/event_source/devices/i915
>>> isn't always correct when vGPU isn't on BDF 0:2.0 in virtualization
>>> environment.
>>>
>>> e.g. It will show as sys/bus/event_source/devices/i915-0000:00:03.0
>>> when vGPU is on BDF 0:3.0.
>>>
>>> Refine the path name so that intel_gpu_top can find the correct adapter.
>>>
>>> Signed-off-by: Terrence Xu <terrence.xu@intel.com>
>>> ---
>>>   lib/igt_perf.c        | 15 ++++++++++++++-
>>>   tools/intel_gpu_top.c | 16 +++++++++++++++-
>>>   2 files changed, 29 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/lib/igt_perf.c b/lib/igt_perf.c index
>>> 418c1c188..3531209b3 100644
>>> --- a/lib/igt_perf.c
>>> +++ b/lib/igt_perf.c
>>> @@ -7,6 +7,7 @@
>>>   #include <sys/stat.h>
>>>   #include <sys/sysinfo.h>
>>>   #include <sys/sysmacros.h>
>>> +#include <dirent.h>
>>>
>>>   #include "igt_perf.h"
>>>
>>> @@ -75,11 +76,23 @@ uint64_t i915_perf_type_id(int i915)  uint64_t
>>> igt_perf_type_id(const char *device)  {
>>>          char buf[64];
>>> +       char dev[64];
>>>          ssize_t ret;
>>>          int fd;
>>> +       DIR *dir;
>>> +       struct dirent *dent;
>>> +
>>> +       dir = opendir("/sys/bus/event_source/devices/");
>>
>> Nak, this is passed the explicit device to use.
>>
>> i915_perf_type_id() takes the device fd and expands it to the pmu device name.
>> -Chris
> [Xu, Terrence] Thanks for your quick response!  Do you think we can use perf_i915_open_group() instead of perf_igfx_open_group() in intel_gpu_top when open pmu? Since i915_perf_type_id() can provide the right i915 pmu.

Ayaz has a patch series in progress which should fix this.

Apart that it would think of 0000:00:03.0 as a discrete GPU but perhaps 
that would be okay for now, since only difference would be omission or 
RAPL (power) data which is probably correct for virtualization.

Regards,

Tvrtko
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-04-14 12:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-10 10:20 [igt-dev] [i-g-t] i915/perf: Correct the logic of finding i915 pmu event path Terrence Xu
2020-04-10 10:31 ` Chris Wilson
2020-04-10 12:32   ` Xu, Terrence
2020-04-14 12:05     ` Tvrtko Ursulin
2020-04-10 11:10 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.