Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [RFC 0/2] lib/xe_gpu: Introduce xe_gpu library
@ 2023-04-20 19:14 Anna Karas
  2023-04-20 19:14 ` [igt-dev] [RFC 1/2] " Anna Karas
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Anna Karas @ 2023-04-20 19:14 UTC (permalink / raw)
  To: igt-dev; +Cc: Joonas Lahtinen, Maarten Lankhorst

OPENS:
1. Lack of wedged concept in XE: @Matthew informed me that there is no
intent to have reporting wedged device in XE. However, @Joonas believes
that it may be useful - "it's used at least in specific diagnostics and
hardware repair flows for PVC and FLR for all platforms, where we
prevent further accesses to the hardware. So an alternative mechanism is
needed for those". Since xe_require_gpu() is a direct port of i915's 
igt_require_gem() stripped of wedged device reporting, this could be a
good opportunity to discuss this.

2. igt_require_gem() was also responsible for restoring reset and
enable_hangcheck modparams. Do we need those parameters here? Do/will we
need different ones do restore?

3. Would you find adding equivalent of gem_quiescent_gpu here worth?

Reference: Jira VLK-46235
Signed-off-by: Anna Karas <anna.karas@intel.com>

Anna Karas (2):
  lib/xe_gpu: Introduce xe_gpu library
  tests/xe: Use xe_require_gpu() in existing tests

 lib/meson.build                 |   1 +
 lib/xe/xe_gpu.c                 | 136 ++++++++++++++++++++++++++++++++
 lib/xe/xe_gpu.h                 |  19 +++++
 tests/xe/xe_compute.c           |   2 +
 tests/xe/xe_create.c            |   2 +
 tests/xe/xe_debugfs.c           |   2 +
 tests/xe/xe_dma_buf_sync.c      |   2 +
 tests/xe/xe_evict.c             |   2 +
 tests/xe/xe_exec_balancer.c     |   2 +
 tests/xe/xe_exec_basic.c        |   2 +
 tests/xe/xe_exec_compute_mode.c |   2 +
 tests/xe/xe_exec_fault_mode.c   |   2 +
 tests/xe/xe_exec_reset.c        |   2 +
 tests/xe/xe_exec_threads.c      |   2 +
 tests/xe/xe_guc_pc.c            |   2 +
 tests/xe/xe_huc_copy.c          |   2 +
 tests/xe/xe_mmap.c              |   2 +
 tests/xe/xe_mmio.c              |   2 +
 tests/xe/xe_noexec_ping_pong.c  |   2 +
 tests/xe/xe_pm.c                |   2 +
 tests/xe/xe_prime_self_import.c |   2 +
 tests/xe/xe_query.c             |   2 +
 tests/xe/xe_vm.c                |   2 +
 tests/xe/xe_waitfence.c         |   2 +
 24 files changed, 198 insertions(+)
 create mode 100644 lib/xe/xe_gpu.c
 create mode 100644 lib/xe/xe_gpu.h

-- 
2.25.1

---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.
Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.



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

* [igt-dev] [RFC 1/2] lib/xe_gpu: Introduce xe_gpu library
  2023-04-20 19:14 [igt-dev] [RFC 0/2] lib/xe_gpu: Introduce xe_gpu library Anna Karas
@ 2023-04-20 19:14 ` Anna Karas
  2023-04-21  7:56   ` Zbigniew Kempczyński
  2023-05-15  9:51   ` Manszewski, Christoph
  2023-04-20 19:14 ` [igt-dev] [RFC 2/2] tests/xe: Use xe_require_gpu() in existing tests Anna Karas
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 11+ messages in thread
From: Anna Karas @ 2023-04-20 19:14 UTC (permalink / raw)
  To: igt-dev; +Cc: Joonas Lahtinen, Maarten Lankhorst

Add helpers for requiring the XE driver, reopening drm fd and restoring
engine properties between tests.
This lib is a direct port of gem.c from i915.

Reference: Jira VLK-46235
Signed-off-by: Anna Karas <anna.karas@intel.com>
---
 lib/meson.build |   1 +
 lib/xe/xe_gpu.c | 136 ++++++++++++++++++++++++++++++++++++++++++++++++
 lib/xe/xe_gpu.h |  19 +++++++
 3 files changed, 156 insertions(+)
 create mode 100644 lib/xe/xe_gpu.c
 create mode 100644 lib/xe/xe_gpu.h

diff --git a/lib/meson.build b/lib/meson.build
index b21c252b..b33f8ae6 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -100,6 +100,7 @@ lib_sources = [
 	'igt_msm.c',
 	'igt_dsc.c',
 	'xe/xe_compute.c',
+	'xe/xe_gpu.c',
 	'xe/xe_compute_square_kernels.c',
 	'xe/xe_ioctl.c',
 	'xe/xe_query.c',
diff --git a/lib/xe/xe_gpu.c b/lib/xe/xe_gpu.c
new file mode 100644
index 00000000..7abd8057
--- /dev/null
+++ b/lib/xe/xe_gpu.c
@@ -0,0 +1,136 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ *
+ * Authors:
+ *    Anna Karas <anna.karas@intel.com>
+ */
+
+#include <dirent.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include "xe/xe_gpu.h"
+#include "igt_sysfs.h"
+#include "igt.h"
+
+
+/*
+ * Resets all engine properties to defaults prior to the start of a test.
+ */
+static void __restore_defaults(int engine)
+{
+	struct dirent *de;
+	int defaults;
+	DIR *dir;
+
+	defaults = openat(engine, ".defaults", O_RDONLY);
+	if (defaults < 0)
+		return;
+
+	dir = fdopendir(defaults);
+	if (!dir) {
+		close(defaults);
+		return;
+	}
+
+	while ((de = readdir(dir))) {
+		char buf[256];
+		int fd, len;
+
+		if (*de->d_name == '.')
+			continue;
+
+		fd = openat(defaults, de->d_name, O_RDONLY);
+		if (fd < 0)
+			continue;
+
+		len = read(fd, buf, sizeof(buf));
+		close(fd);
+		if (len < 0)
+			continue;
+
+		fd = openat(engine, de->d_name, O_WRONLY);
+		if (fd < 0)
+			continue;
+
+		write(fd, buf, len);
+		close(fd);
+	}
+
+	closedir(dir);
+}
+
+static void restore_defaults(int fd)
+{
+	struct dirent *de;
+	int engines;
+	DIR *dir;
+	int sys;
+
+	sys = igt_sysfs_open(fd);
+	if (sys < 0)
+		return;
+
+	engines = openat(sys, "engine", O_RDONLY);
+	if (engines < 0)
+		goto close_sys;
+
+	dir = fdopendir(engines);
+	if (!dir) {
+		close(engines);
+		goto close_sys;
+	}
+
+	while ((de = readdir(dir))) {
+		int engine;
+
+		if (*de->d_name == '.')
+			continue;
+
+		engine = openat(engines, de->d_name, O_RDONLY);
+		if (engine < 0)
+			continue;
+
+		__restore_defaults(engine);
+		close(engine);
+	}
+
+	closedir(dir);
+
+close_sys:
+	close(sys);
+}
+
+/**
+ * xe_reopen_driver:
+ * @fd: re-open the xe drm file descriptor
+ *
+ * Re-opens the drm fd which is useful in instances where a clean default
+ * context is needed.
+ */
+int xe_reopen_driver(int fd)
+{
+	char path[256];
+
+	snprintf(path, sizeof(path), "/proc/self/fd/%d", fd);
+	fd = open(path, O_RDWR);
+	igt_assert_fd(fd);
+
+	return fd;
+}
+
+/**
+ * xe_require_gpu:
+ * @fd: the xe drm file descriptor
+ *
+ * Helper to be used prior to the start of a tests, useful in instances
+ * where a clean default context is needed.
+ */
+void xe_require_gpu(int fd)
+{
+	igt_require_xe(fd);
+	fd = xe_reopen_driver(fd);
+	restore_defaults(fd);
+	close(fd);
+}
diff --git a/lib/xe/xe_gpu.h b/lib/xe/xe_gpu.h
new file mode 100644
index 00000000..020040ac
--- /dev/null
+++ b/lib/xe/xe_gpu.h
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ *
+ * Authors:
+ *    Anna Karas <anna.karas@intel.com>
+ */
+
+#ifndef XE_GPU_H
+#define XE_GPU_H
+
+#include <stdint.h>
+#include <xe_drm.h>
+
+int xe_reopen_driver(int fd);
+void xe_require_gpu(int fd);
+
+#endif	/* XE_GPU_H */
+
-- 
2.25.1

---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.
Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.

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

* [igt-dev] [RFC 2/2] tests/xe: Use xe_require_gpu() in existing tests
  2023-04-20 19:14 [igt-dev] [RFC 0/2] lib/xe_gpu: Introduce xe_gpu library Anna Karas
  2023-04-20 19:14 ` [igt-dev] [RFC 1/2] " Anna Karas
@ 2023-04-20 19:14 ` Anna Karas
  2023-04-20 20:38 ` [igt-dev] [RFC 0/2] lib/xe_gpu: Introduce xe_gpu library Souza, Jose
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Anna Karas @ 2023-04-20 19:14 UTC (permalink / raw)
  To: igt-dev; +Cc: Joonas Lahtinen, Maarten Lankhorst

Add xe_require_gpu() to all existing xe tests.

Reference: Jira VLK-46235
Signed-off-by: Anna Karas <anna.karas@intel.com>
---
 tests/xe/xe_compute.c           | 2 ++
 tests/xe/xe_create.c            | 2 ++
 tests/xe/xe_debugfs.c           | 2 ++
 tests/xe/xe_dma_buf_sync.c      | 2 ++
 tests/xe/xe_evict.c             | 2 ++
 tests/xe/xe_exec_balancer.c     | 2 ++
 tests/xe/xe_exec_basic.c        | 2 ++
 tests/xe/xe_exec_compute_mode.c | 2 ++
 tests/xe/xe_exec_fault_mode.c   | 2 ++
 tests/xe/xe_exec_reset.c        | 2 ++
 tests/xe/xe_exec_threads.c      | 2 ++
 tests/xe/xe_guc_pc.c            | 2 ++
 tests/xe/xe_huc_copy.c          | 2 ++
 tests/xe/xe_mmap.c              | 2 ++
 tests/xe/xe_mmio.c              | 2 ++
 tests/xe/xe_noexec_ping_pong.c  | 2 ++
 tests/xe/xe_pm.c                | 2 ++
 tests/xe/xe_prime_self_import.c | 2 ++
 tests/xe/xe_query.c             | 2 ++
 tests/xe/xe_vm.c                | 2 ++
 tests/xe/xe_waitfence.c         | 2 ++
 21 files changed, 42 insertions(+)

diff --git a/tests/xe/xe_compute.c b/tests/xe/xe_compute.c
index 7ac64dfe..fff1fe04 100644
--- a/tests/xe/xe_compute.c
+++ b/tests/xe/xe_compute.c
@@ -15,6 +15,7 @@
 
 #include "igt.h"
 #include "xe/xe_query.h"
+#include "xe/xe_gpu.h"
 #include "xe/xe_compute.h"
 
 /**
@@ -37,6 +38,7 @@ igt_main
 
 	igt_fixture {
 		xe = drm_open_driver(DRIVER_XE);
+		xe_require_gpu(xe);
 		xe_device_get(xe);
 	}
 
diff --git a/tests/xe/xe_create.c b/tests/xe/xe_create.c
index ae841f80..f1da0f2c 100644
--- a/tests/xe/xe_create.c
+++ b/tests/xe/xe_create.c
@@ -17,6 +17,7 @@
 #include "xe_drm.h"
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
+#include "xe/xe_gpu.h"
 
 #define PAGE_SIZE 0x1000
 
@@ -93,6 +94,7 @@ igt_main
 
 	igt_fixture {
 		xe = drm_open_driver(DRIVER_XE);
+		xe_require_gpu(xe);
 		xe_device_get(xe);
 	}
 
diff --git a/tests/xe/xe_debugfs.c b/tests/xe/xe_debugfs.c
index 6bdd3ef0..ee7404e2 100644
--- a/tests/xe/xe_debugfs.c
+++ b/tests/xe/xe_debugfs.c
@@ -17,6 +17,7 @@
 #include "xe_drm.h"
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
+#include "xe/xe_gpu.h"
 
 #include <fcntl.h>
 #include <string.h>
@@ -247,6 +248,7 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
+		xe_require_gpu(fd);
 		xe_dev = xe_device_get(fd);
 		__igt_debugfs_dump(fd, "info", IGT_LOG_INFO);
 	}
diff --git a/tests/xe/xe_dma_buf_sync.c b/tests/xe/xe_dma_buf_sync.c
index 8920b141..d01761d0 100644
--- a/tests/xe/xe_dma_buf_sync.c
+++ b/tests/xe/xe_dma_buf_sync.c
@@ -18,6 +18,7 @@
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
 #include "xe/xe_spin.h"
+#include "xe/xe_gpu.h"
 #include <string.h>
 #include <linux/dma-buf.h>
 #include <sys/poll.h>
@@ -232,6 +233,7 @@ igt_main
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
+		xe_require_gpu(fd);
 		xe_device_get(fd);
 
 		xe_for_each_hw_engine(fd, hwe)
diff --git a/tests/xe/xe_evict.c b/tests/xe/xe_evict.c
index 5687cce3..b467885a 100644
--- a/tests/xe/xe_evict.c
+++ b/tests/xe/xe_evict.c
@@ -18,6 +18,7 @@
 
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
+#include "xe/xe_gpu.h"
 #include <string.h>
 
 #define MAX_N_ENGINES 16
@@ -668,6 +669,7 @@ igt_main
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
+		xe_require_gpu(fd);
 		xe_device_get(fd);
 		igt_require(xe_has_vram(fd));
 		vram_size = xe_vram_size(fd, 0);
diff --git a/tests/xe/xe_exec_balancer.c b/tests/xe/xe_exec_balancer.c
index 2018c810..9927dc34 100644
--- a/tests/xe/xe_exec_balancer.c
+++ b/tests/xe/xe_exec_balancer.c
@@ -21,6 +21,7 @@
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
 #include "xe/xe_spin.h"
+#include "xe/xe_gpu.h"
 #include <string.h>
 
 #define MAX_INSTANCE 9
@@ -628,6 +629,7 @@ igt_main
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
+		xe_require_gpu(fd);
 		xe_device_get(fd);
 	}
 
diff --git a/tests/xe/xe_exec_basic.c b/tests/xe/xe_exec_basic.c
index 2a176a5b..52ae2505 100644
--- a/tests/xe/xe_exec_basic.c
+++ b/tests/xe/xe_exec_basic.c
@@ -17,6 +17,7 @@
 
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
+#include "xe/xe_gpu.h"
 #include <string.h>
 
 #define MAX_N_ENGINES 16
@@ -313,6 +314,7 @@ igt_main
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
+		xe_require_gpu(fd);
 		xe_device_get(fd);
 	}
 
diff --git a/tests/xe/xe_exec_compute_mode.c b/tests/xe/xe_exec_compute_mode.c
index 68519399..e6aa2a00 100644
--- a/tests/xe/xe_exec_compute_mode.c
+++ b/tests/xe/xe_exec_compute_mode.c
@@ -20,6 +20,7 @@
 
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
+#include "xe/xe_gpu.h"
 #include <string.h>
 
 #define MAX_N_ENGINES 16
@@ -329,6 +330,7 @@ igt_main
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
+		xe_require_gpu(fd);
 		xe_device_get(fd);
 	}
 
diff --git a/tests/xe/xe_exec_fault_mode.c b/tests/xe/xe_exec_fault_mode.c
index a3ab1727..cbb2dc2d 100644
--- a/tests/xe/xe_exec_fault_mode.c
+++ b/tests/xe/xe_exec_fault_mode.c
@@ -21,6 +21,7 @@
 
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
+#include "xe/xe_gpu.h"
 #include <string.h>
 
 #define MAX_N_ENGINES 16
@@ -524,6 +525,7 @@ igt_main
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
+		xe_require_gpu(fd);
 		xe_device_get(fd);
 		igt_require(xe_supports_faults(fd));
 	}
diff --git a/tests/xe/xe_exec_reset.c b/tests/xe/xe_exec_reset.c
index 0d72a3f2..922f7ee4 100644
--- a/tests/xe/xe_exec_reset.c
+++ b/tests/xe/xe_exec_reset.c
@@ -19,6 +19,7 @@
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
 #include "xe/xe_spin.h"
+#include "xe/xe_gpu.h"
 #include <string.h>
 
 /**
@@ -833,6 +834,7 @@ igt_main
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
+		xe_require_gpu(fd);
 		xe_device_get(fd);
 	}
 
diff --git a/tests/xe/xe_exec_threads.c b/tests/xe/xe_exec_threads.c
index 3f2c2de9..64d3741a 100644
--- a/tests/xe/xe_exec_threads.c
+++ b/tests/xe/xe_exec_threads.c
@@ -21,6 +21,7 @@
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
 #include "xe/xe_spin.h"
+#include "xe/xe_gpu.h"
 #include <string.h>
 
 #define MAX_N_ENGINES	16
@@ -1393,6 +1394,7 @@ igt_main
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
+		xe_require_gpu(fd);
 		xe_device_get(fd);
 	}
 
diff --git a/tests/xe/xe_guc_pc.c b/tests/xe/xe_guc_pc.c
index 5c71ae14..bebbd189 100644
--- a/tests/xe/xe_guc_pc.c
+++ b/tests/xe/xe_guc_pc.c
@@ -18,6 +18,7 @@
 #include "xe_drm.h"
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
+#include "xe/xe_gpu.h"
 
 #include <string.h>
 #include <sys/time.h>
@@ -387,6 +388,7 @@ igt_main
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
+		xe_require_gpu(fd);
 		xe_device_get(fd);
 
 		sysfs = igt_sysfs_open(fd);
diff --git a/tests/xe/xe_huc_copy.c b/tests/xe/xe_huc_copy.c
index cd68dbb5..36b5df40 100644
--- a/tests/xe/xe_huc_copy.c
+++ b/tests/xe/xe_huc_copy.c
@@ -22,6 +22,7 @@
 #include "xe_drm.h"
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
+#include "xe/xe_gpu.h"
 
 #define SIZE_DATA           0x1000
 #define SIZE_BATCH          0x1000
@@ -158,6 +159,7 @@ igt_main
 
 	igt_fixture {
 		xe = drm_open_driver(DRIVER_XE);
+		xe_require_gpu(xe);
 		xe_device_get(xe);
 	}
 
diff --git a/tests/xe/xe_mmap.c b/tests/xe/xe_mmap.c
index 6b313a18..e93a53a0 100644
--- a/tests/xe/xe_mmap.c
+++ b/tests/xe/xe_mmap.c
@@ -16,6 +16,7 @@
 #include "xe_drm.h"
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
+#include "xe/xe_gpu.h"
 
 #include <string.h>
 
@@ -63,6 +64,7 @@ igt_main
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
+		xe_require_gpu(fd);
 		xe_device_get(fd);
 	}
 
diff --git a/tests/xe/xe_mmio.c b/tests/xe/xe_mmio.c
index 42b6241b..7215787b 100644
--- a/tests/xe/xe_mmio.c
+++ b/tests/xe/xe_mmio.c
@@ -16,6 +16,7 @@
 #include "xe_drm.h"
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
+#include "xe/xe_gpu.h"
 
 #include <string.h>
 
@@ -79,6 +80,7 @@ igt_main
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
+		xe_require_gpu(fd);
 		xe_device_get(fd);
 	}
 
diff --git a/tests/xe/xe_noexec_ping_pong.c b/tests/xe/xe_noexec_ping_pong.c
index 36767188..7034728d 100644
--- a/tests/xe/xe_noexec_ping_pong.c
+++ b/tests/xe/xe_noexec_ping_pong.c
@@ -10,6 +10,7 @@
 
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
+#include "xe/xe_gpu.h"
 
 #define NUM_VMS 10
 #define NUM_BOS 1
@@ -99,6 +100,7 @@ igt_simple_main
 {
 
 	fd = drm_open_driver(DRIVER_XE);
+	xe_require_gpu(fd);
 	xe_device_get(fd);
 
 	test_ping_pong(fd, xe_hw_engine(fd, 0));
diff --git a/tests/xe/xe_pm.c b/tests/xe/xe_pm.c
index 44154143..7db07dd1 100644
--- a/tests/xe/xe_pm.c
+++ b/tests/xe/xe_pm.c
@@ -25,6 +25,7 @@
 #include "xe_drm.h"
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
+#include "xe/xe_gpu.h"
 
 #define MAX_N_ENGINES 16
 #define NO_SUSPEND -1
@@ -367,6 +368,7 @@ igt_main
 	igt_fixture {
 		memset(&device, 0, sizeof(device));
 		device.fd_xe = drm_open_driver(DRIVER_XE);
+		xe_require_gpu(device.fd_xe);
 		device.pci_xe = igt_device_get_pci_device(device.fd_xe);
 		device.pci_root = igt_device_get_pci_root_port(device.fd_xe);
 
diff --git a/tests/xe/xe_prime_self_import.c b/tests/xe/xe_prime_self_import.c
index 4e8fd5d4..22848a7b 100644
--- a/tests/xe/xe_prime_self_import.c
+++ b/tests/xe/xe_prime_self_import.c
@@ -51,6 +51,7 @@
 #include "drm.h"
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
+#include "xe/xe_gpu.h"
 
 IGT_TEST_DESCRIPTION("Check whether prime import/export works on the same"
 		     " device... but with different fds.");
@@ -534,6 +535,7 @@ igt_main
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
+		xe_require_gpu(fd);
 		xe_device_get(fd);
 	}
 
diff --git a/tests/xe/xe_query.c b/tests/xe/xe_query.c
index 3f038225..724e863a 100644
--- a/tests/xe/xe_query.c
+++ b/tests/xe/xe_query.c
@@ -18,6 +18,7 @@
 #include "xe_drm.h"
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
+#include "xe/xe_gpu.h"
 #include "intel_hwconfig_types.h"
 
 void dump_hex(void *buffer, int len);
@@ -441,6 +442,7 @@ igt_main
 
 	igt_fixture {
 		xe = drm_open_driver(DRIVER_XE);
+		xe_require_gpu(xe);
 		xe_device_get(xe);
 	}
 
diff --git a/tests/xe/xe_vm.c b/tests/xe/xe_vm.c
index d4cec104..987b457f 100644
--- a/tests/xe/xe_vm.c
+++ b/tests/xe/xe_vm.c
@@ -18,6 +18,7 @@
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
 #include "xe/xe_spin.h"
+#include "xe/xe_gpu.h"
 #include <string.h>
 
 static uint32_t
@@ -1621,6 +1622,7 @@ igt_main
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
+		xe_require_gpu(fd);
 		xe_device_get(fd);
 
 		xe_for_each_hw_engine(fd, hwe)
diff --git a/tests/xe/xe_waitfence.c b/tests/xe/xe_waitfence.c
index cdfcacdb..4f4e5ddf 100644
--- a/tests/xe/xe_waitfence.c
+++ b/tests/xe/xe_waitfence.c
@@ -11,6 +11,7 @@
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
 #include "xe/xe_spin.h"
+#include "xe/xe_gpu.h"
 #include <string.h>
 
 /**
@@ -90,6 +91,7 @@ igt_main
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
+		xe_require_gpu(fd);
 		xe_device_get(fd);
 	}
 
-- 
2.25.1

---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.
Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.



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

* Re: [igt-dev] [RFC 0/2] lib/xe_gpu: Introduce xe_gpu library
  2023-04-20 19:14 [igt-dev] [RFC 0/2] lib/xe_gpu: Introduce xe_gpu library Anna Karas
  2023-04-20 19:14 ` [igt-dev] [RFC 1/2] " Anna Karas
  2023-04-20 19:14 ` [igt-dev] [RFC 2/2] tests/xe: Use xe_require_gpu() in existing tests Anna Karas
@ 2023-04-20 20:38 ` Souza, Jose
  2023-04-24 11:38   ` Karas, Anna
  2023-04-20 20:58 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
  2023-04-21  5:28 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  4 siblings, 1 reply; 11+ messages in thread
From: Souza, Jose @ 2023-04-20 20:38 UTC (permalink / raw)
  To: Karas, Anna, igt-dev@lists.freedesktop.org
  Cc: Lahtinen, Joonas, Lankhorst, Maarten

On Thu, 2023-04-20 at 21:14 +0200, Anna Karas wrote:
> OPENS:
> 1. Lack of wedged concept in XE: @Matthew informed me that there is no
> intent to have reporting wedged device in XE. However, @Joonas believes
> that it may be useful - "it's used at least in specific diagnostics and
> hardware repair flows for PVC and FLR for all platforms, where we
> prevent further accesses to the hardware. So an alternative mechanism is
> needed for those". Since xe_require_gpu() is a direct port of i915's 
> igt_require_gem() stripped of wedged device reporting, this could be a
> good opportunity to discuss this.

I guess you could create a Xe engine, submit NOPs and check for XE_ENGINE_GET_PROPERTY_BAN to detect if GPU is wedged.

> 
> 2. igt_require_gem() was also responsible for restoring reset and
> enable_hangcheck modparams. Do we need those parameters here? Do/will we
> need different ones do restore?
> 
> 3. Would you find adding equivalent of gem_quiescent_gpu here worth?
> 
> Reference: Jira VLK-46235
> Signed-off-by: Anna Karas <anna.karas@intel.com>
> 
> Anna Karas (2):
>   lib/xe_gpu: Introduce xe_gpu library
>   tests/xe: Use xe_require_gpu() in existing tests
> 
>  lib/meson.build                 |   1 +
>  lib/xe/xe_gpu.c                 | 136 ++++++++++++++++++++++++++++++++
>  lib/xe/xe_gpu.h                 |  19 +++++
>  tests/xe/xe_compute.c           |   2 +
>  tests/xe/xe_create.c            |   2 +
>  tests/xe/xe_debugfs.c           |   2 +
>  tests/xe/xe_dma_buf_sync.c      |   2 +
>  tests/xe/xe_evict.c             |   2 +
>  tests/xe/xe_exec_balancer.c     |   2 +
>  tests/xe/xe_exec_basic.c        |   2 +
>  tests/xe/xe_exec_compute_mode.c |   2 +
>  tests/xe/xe_exec_fault_mode.c   |   2 +
>  tests/xe/xe_exec_reset.c        |   2 +
>  tests/xe/xe_exec_threads.c      |   2 +
>  tests/xe/xe_guc_pc.c            |   2 +
>  tests/xe/xe_huc_copy.c          |   2 +
>  tests/xe/xe_mmap.c              |   2 +
>  tests/xe/xe_mmio.c              |   2 +
>  tests/xe/xe_noexec_ping_pong.c  |   2 +
>  tests/xe/xe_pm.c                |   2 +
>  tests/xe/xe_prime_self_import.c |   2 +
>  tests/xe/xe_query.c             |   2 +
>  tests/xe/xe_vm.c                |   2 +
>  tests/xe/xe_waitfence.c         |   2 +
>  24 files changed, 198 insertions(+)
>  create mode 100644 lib/xe/xe_gpu.c
>  create mode 100644 lib/xe/xe_gpu.h
> 


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

* [igt-dev] ✓ Fi.CI.BAT: success for lib/xe_gpu: Introduce xe_gpu library
  2023-04-20 19:14 [igt-dev] [RFC 0/2] lib/xe_gpu: Introduce xe_gpu library Anna Karas
                   ` (2 preceding siblings ...)
  2023-04-20 20:38 ` [igt-dev] [RFC 0/2] lib/xe_gpu: Introduce xe_gpu library Souza, Jose
@ 2023-04-20 20:58 ` Patchwork
  2023-04-21  5:28 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  4 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2023-04-20 20:58 UTC (permalink / raw)
  To: Anna Karas; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 5102 bytes --]

== Series Details ==

Series: lib/xe_gpu: Introduce xe_gpu library
URL   : https://patchwork.freedesktop.org/series/116776/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_13035 -> IGTPW_8834
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

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

Participating hosts (36 -> 37)
------------------------------

  Additional (2): fi-kbl-soraka bat-mtlp-8 
  Missing    (1): fi-snb-2520m 

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

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

### IGT changes ###

#### Issues hit ####

  * igt@gem_huc_copy@huc-copy:
    - fi-kbl-soraka:      NOTRUN -> [SKIP][1] ([fdo#109271] / [i915#2190])
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/fi-kbl-soraka/igt@gem_huc_copy@huc-copy.html

  * igt@gem_lmem_swapping@basic:
    - fi-kbl-soraka:      NOTRUN -> [SKIP][2] ([fdo#109271] / [i915#4613]) +3 similar issues
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/fi-kbl-soraka/igt@gem_lmem_swapping@basic.html

  * igt@i915_selftest@live@gt_pm:
    - fi-kbl-soraka:      NOTRUN -> [DMESG-FAIL][3] ([i915#1886])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html

  * igt@i915_selftest@live@requests:
    - bat-rpls-1:         [PASS][4] -> [ABORT][5] ([i915#7911])
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13035/bat-rpls-1/igt@i915_selftest@live@requests.html
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/bat-rpls-1/igt@i915_selftest@live@requests.html

  * igt@kms_chamelium_frames@hdmi-crc-fast:
    - fi-kbl-soraka:      NOTRUN -> [SKIP][6] ([fdo#109271]) +16 similar issues
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/fi-kbl-soraka/igt@kms_chamelium_frames@hdmi-crc-fast.html

  
#### Possible fixes ####

  * igt@gem_exec_suspend@basic-s3@lmem0:
    - bat-dg2-9:          [FAIL][7] ([fdo#103375]) -> [PASS][8] +3 similar issues
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13035/bat-dg2-9/igt@gem_exec_suspend@basic-s3@lmem0.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/bat-dg2-9/igt@gem_exec_suspend@basic-s3@lmem0.html

  * igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-dp-3:
    - bat-dg2-9:          [FAIL][9] ([fdo#103375] / [i915#7932]) -> [PASS][10]
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13035/bat-dg2-9/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-dp-3.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/bat-dg2-9/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-dp-3.html

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

  [fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
  [i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
  [i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
  [i915#3595]: https://gitlab.freedesktop.org/drm/intel/issues/3595
  [i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
  [i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
  [i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
  [i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
  [i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
  [i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
  [i915#4579]: https://gitlab.freedesktop.org/drm/intel/issues/4579
  [i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
  [i915#5190]: https://gitlab.freedesktop.org/drm/intel/issues/5190
  [i915#5274]: https://gitlab.freedesktop.org/drm/intel/issues/5274
  [i915#7456]: https://gitlab.freedesktop.org/drm/intel/issues/7456
  [i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
  [i915#7911]: https://gitlab.freedesktop.org/drm/intel/issues/7911
  [i915#7932]: https://gitlab.freedesktop.org/drm/intel/issues/7932
  [i915#8346]: https://gitlab.freedesktop.org/drm/intel/issues/8346
  [i915#8368]: https://gitlab.freedesktop.org/drm/intel/issues/8368
  [i915#8369]: https://gitlab.freedesktop.org/drm/intel/issues/8369
  [i915#8370]: https://gitlab.freedesktop.org/drm/intel/issues/8370
  [i915#8379]: https://gitlab.freedesktop.org/drm/intel/issues/8379


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

  * CI: CI-20190529 -> None
  * IGT: IGT_7263 -> IGTPW_8834

  CI-20190529: 20190529
  CI_DRM_13035: 182419213bd7d88fead18eb0830855b675b093d7 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_8834: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/index.html
  IGT_7263: a6bd8f415c4ec41b5a014c7db47e46c81ffd0074 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git


Testlist changes
----------------

-igt@i915_hangman@multigpu-error-basic

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/index.html

[-- Attachment #2: Type: text/html, Size: 4849 bytes --]

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

* [igt-dev] ✓ Fi.CI.IGT: success for lib/xe_gpu: Introduce xe_gpu library
  2023-04-20 19:14 [igt-dev] [RFC 0/2] lib/xe_gpu: Introduce xe_gpu library Anna Karas
                   ` (3 preceding siblings ...)
  2023-04-20 20:58 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
@ 2023-04-21  5:28 ` Patchwork
  4 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2023-04-21  5:28 UTC (permalink / raw)
  To: Anna Karas; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 16306 bytes --]

== Series Details ==

Series: lib/xe_gpu: Introduce xe_gpu library
URL   : https://patchwork.freedesktop.org/series/116776/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_13035_full -> IGTPW_8834_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

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

Participating hosts (7 -> 7)
------------------------------

  No changes in participating hosts

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

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

### IGT changes ###

#### Suppressed ####

  The following results come from untrusted machines, tests, or statuses.
  They do not affect the overall result.

  * igt@kms_flip@2x-flip-vs-fences:
    - {shard-dg1}:        NOTRUN -> [SKIP][1] +1 similar issue
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/shard-dg1-17/igt@kms_flip@2x-flip-vs-fences.html

  * igt@kms_flip@flip-vs-suspend@b-hdmi-a1:
    - {shard-tglu}:       [PASS][2] -> [INCOMPLETE][3]
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13035/shard-tglu-6/igt@kms_flip@flip-vs-suspend@b-hdmi-a1.html
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/shard-tglu-7/igt@kms_flip@flip-vs-suspend@b-hdmi-a1.html

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

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

### IGT changes ###

#### Issues hit ####

  * igt@gem_exec_fair@basic-deadline:
    - shard-apl:          [PASS][4] -> [FAIL][5] ([i915#2846])
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13035/shard-apl4/igt@gem_exec_fair@basic-deadline.html
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/shard-apl4/igt@gem_exec_fair@basic-deadline.html

  * igt@gem_exec_fair@basic-none-solo@rcs0:
    - shard-apl:          [PASS][6] -> [FAIL][7] ([i915#2842])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13035/shard-apl3/igt@gem_exec_fair@basic-none-solo@rcs0.html
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/shard-apl1/igt@gem_exec_fair@basic-none-solo@rcs0.html

  * igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size:
    - shard-glk:          [PASS][8] -> [FAIL][9] ([i915#2346])
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13035/shard-glk8/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/shard-glk1/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html

  * igt@kms_psr@psr2_sprite_plane_onoff:
    - shard-snb:          NOTRUN -> [SKIP][10] ([fdo#109271]) +54 similar issues
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/shard-snb6/igt@kms_psr@psr2_sprite_plane_onoff.html

  * igt@kms_setmode@basic@pipe-a-hdmi-a-1:
    - shard-snb:          NOTRUN -> [FAIL][11] ([i915#5465]) +1 similar issue
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/shard-snb1/igt@kms_setmode@basic@pipe-a-hdmi-a-1.html

  * igt@kms_vblank@pipe-c-accuracy-idle:
    - shard-glk:          [PASS][12] -> [FAIL][13] ([i915#43])
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13035/shard-glk4/igt@kms_vblank@pipe-c-accuracy-idle.html
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/shard-glk9/igt@kms_vblank@pipe-c-accuracy-idle.html

  * igt@perf@stress-open-close@0-rcs0:
    - shard-glk:          [PASS][14] -> [ABORT][15] ([i915#5213])
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13035/shard-glk9/igt@perf@stress-open-close@0-rcs0.html
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/shard-glk4/igt@perf@stress-open-close@0-rcs0.html

  
#### Possible fixes ####

  * igt@drm_fdinfo@most-busy-check-all@rcs0:
    - {shard-rkl}:        [FAIL][16] ([i915#7742]) -> [PASS][17]
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13035/shard-rkl-2/igt@drm_fdinfo@most-busy-check-all@rcs0.html
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/shard-rkl-7/igt@drm_fdinfo@most-busy-check-all@rcs0.html

  * igt@gem_exec_fair@basic-pace-solo@rcs0:
    - shard-apl:          [FAIL][18] ([i915#2842]) -> [PASS][19]
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13035/shard-apl7/igt@gem_exec_fair@basic-pace-solo@rcs0.html
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/shard-apl7/igt@gem_exec_fair@basic-pace-solo@rcs0.html

  * igt@gem_exec_suspend@basic-s4-devices@smem:
    - {shard-tglu}:       [ABORT][20] ([i915#7975]) -> [PASS][21]
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13035/shard-tglu-10/igt@gem_exec_suspend@basic-s4-devices@smem.html
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/shard-tglu-9/igt@gem_exec_suspend@basic-s4-devices@smem.html

  * igt@i915_pm_rpm@modeset-non-lpsp-stress-no-wait:
    - {shard-rkl}:        [SKIP][22] ([i915#1397]) -> [PASS][23]
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13035/shard-rkl-7/igt@i915_pm_rpm@modeset-non-lpsp-stress-no-wait.html
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/shard-rkl-3/igt@i915_pm_rpm@modeset-non-lpsp-stress-no-wait.html

  * igt@i915_pm_rps@reset:
    - shard-snb:          [INCOMPLETE][24] ([i915#7790]) -> [PASS][25]
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13035/shard-snb1/igt@i915_pm_rps@reset.html
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/shard-snb2/igt@i915_pm_rps@reset.html

  * igt@i915_selftest@live@gt_heartbeat:
    - shard-apl:          [DMESG-FAIL][26] ([i915#5334]) -> [PASS][27]
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13035/shard-apl6/igt@i915_selftest@live@gt_heartbeat.html
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/shard-apl2/igt@i915_selftest@live@gt_heartbeat.html

  * igt@kms_big_fb@y-tiled-max-hw-stride-64bpp-rotate-180-hflip-async-flip:
    - {shard-rkl}:        [FAIL][28] ([i915#3743]) -> [PASS][29] +1 similar issue
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13035/shard-rkl-7/igt@kms_big_fb@y-tiled-max-hw-stride-64bpp-rotate-180-hflip-async-flip.html
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/shard-rkl-1/igt@kms_big_fb@y-tiled-max-hw-stride-64bpp-rotate-180-hflip-async-flip.html

  * igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions:
    - shard-glk:          [FAIL][30] ([i915#2346]) -> [PASS][31]
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13035/shard-glk2/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions.html
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/shard-glk1/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions.html
    - shard-apl:          [FAIL][32] ([i915#2346]) -> [PASS][33]
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13035/shard-apl1/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions.html
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/shard-apl1/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions.html

  * igt@kms_cursor_legacy@forked-move@pipe-b:
    - {shard-rkl}:        [INCOMPLETE][34] ([i915#8011]) -> [PASS][35]
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13035/shard-rkl-7/igt@kms_cursor_legacy@forked-move@pipe-b.html
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/shard-rkl-4/igt@kms_cursor_legacy@forked-move@pipe-b.html

  * igt@perf_pmu@idle@rcs0:
    - {shard-rkl}:        [FAIL][36] ([i915#4349]) -> [PASS][37]
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13035/shard-rkl-4/igt@perf_pmu@idle@rcs0.html
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/shard-rkl-2/igt@perf_pmu@idle@rcs0.html

  
#### Warnings ####

  * igt@i915_pm_dc@dc9-dpms:
    - shard-apl:          [FAIL][38] ([i915#4275]) -> [SKIP][39] ([fdo#109271])
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13035/shard-apl6/igt@i915_pm_dc@dc9-dpms.html
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/shard-apl6/igt@i915_pm_dc@dc9-dpms.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
  [fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
  [fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
  [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
  [fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
  [fdo#109302]: https://bugs.freedesktop.org/show_bug.cgi?id=109302
  [fdo#109303]: https://bugs.freedesktop.org/show_bug.cgi?id=109303
  [fdo#109314]: https://bugs.freedesktop.org/show_bug.cgi?id=109314
  [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
  [fdo#109506]: https://bugs.freedesktop.org/show_bug.cgi?id=109506
  [fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
  [fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
  [fdo#111614]: https://bugs.freedesktop.org/show_bug.cgi?id=111614
  [fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
  [fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
  [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
  [fdo#112054]: https://bugs.freedesktop.org/show_bug.cgi?id=112054
  [fdo#112283]: https://bugs.freedesktop.org/show_bug.cgi?id=112283
  [i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
  [i915#1397]: https://gitlab.freedesktop.org/drm/intel/issues/1397
  [i915#1825]: https://gitlab.freedesktop.org/drm/intel/issues/1825
  [i915#1839]: https://gitlab.freedesktop.org/drm/intel/issues/1839
  [i915#1937]: https://gitlab.freedesktop.org/drm/intel/issues/1937
  [i915#2346]: https://gitlab.freedesktop.org/drm/intel/issues/2346
  [i915#2437]: https://gitlab.freedesktop.org/drm/intel/issues/2437
  [i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
  [i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
  [i915#2587]: https://gitlab.freedesktop.org/drm/intel/issues/2587
  [i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
  [i915#2681]: https://gitlab.freedesktop.org/drm/intel/issues/2681
  [i915#2705]: https://gitlab.freedesktop.org/drm/intel/issues/2705
  [i915#280]: https://gitlab.freedesktop.org/drm/intel/issues/280
  [i915#284]: https://gitlab.freedesktop.org/drm/intel/issues/284
  [i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
  [i915#2846]: https://gitlab.freedesktop.org/drm/intel/issues/2846
  [i915#3023]: https://gitlab.freedesktop.org/drm/intel/issues/3023
  [i915#315]: https://gitlab.freedesktop.org/drm/intel/issues/315
  [i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
  [i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
  [i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
  [i915#3299]: https://gitlab.freedesktop.org/drm/intel/issues/3299
  [i915#3359]: https://gitlab.freedesktop.org/drm/intel/issues/3359
  [i915#3458]: https://gitlab.freedesktop.org/drm/intel/issues/3458
  [i915#3539]: https://gitlab.freedesktop.org/drm/intel/issues/3539
  [i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
  [i915#3591]: https://gitlab.freedesktop.org/drm/intel/issues/3591
  [i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
  [i915#3638]: https://gitlab.freedesktop.org/drm/intel/issues/3638
  [i915#3689]: https://gitlab.freedesktop.org/drm/intel/issues/3689
  [i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
  [i915#3743]: https://gitlab.freedesktop.org/drm/intel/issues/3743
  [i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
  [i915#4070]: https://gitlab.freedesktop.org/drm/intel/issues/4070
  [i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
  [i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
  [i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
  [i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
  [i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
  [i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
  [i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
  [i915#4215]: https://gitlab.freedesktop.org/drm/intel/issues/4215
  [i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
  [i915#4275]: https://gitlab.freedesktop.org/drm/intel/issues/4275
  [i915#43]: https://gitlab.freedesktop.org/drm/intel/issues/43
  [i915#4349]: https://gitlab.freedesktop.org/drm/intel/issues/4349
  [i915#4538]: https://gitlab.freedesktop.org/drm/intel/issues/4538
  [i915#4579]: https://gitlab.freedesktop.org/drm/intel/issues/4579
  [i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
  [i915#4771]: https://gitlab.freedesktop.org/drm/intel/issues/4771
  [i915#4812]: https://gitlab.freedesktop.org/drm/intel/issues/4812
  [i915#4816]: https://gitlab.freedesktop.org/drm/intel/issues/4816
  [i915#4833]: https://gitlab.freedesktop.org/drm/intel/issues/4833
  [i915#4852]: https://gitlab.freedesktop.org/drm/intel/issues/4852
  [i915#4860]: https://gitlab.freedesktop.org/drm/intel/issues/4860
  [i915#4880]: https://gitlab.freedesktop.org/drm/intel/issues/4880
  [i915#4881]: https://gitlab.freedesktop.org/drm/intel/issues/4881
  [i915#4958]: https://gitlab.freedesktop.org/drm/intel/issues/4958
  [i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
  [i915#5213]: https://gitlab.freedesktop.org/drm/intel/issues/5213
  [i915#5235]: https://gitlab.freedesktop.org/drm/intel/issues/5235
  [i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
  [i915#5288]: https://gitlab.freedesktop.org/drm/intel/issues/5288
  [i915#5289]: https://gitlab.freedesktop.org/drm/intel/issues/5289
  [i915#5325]: https://gitlab.freedesktop.org/drm/intel/issues/5325
  [i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
  [i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
  [i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
  [i915#5431]: https://gitlab.freedesktop.org/drm/intel/issues/5431
  [i915#5465]: https://gitlab.freedesktop.org/drm/intel/issues/5465
  [i915#5563]: https://gitlab.freedesktop.org/drm/intel/issues/5563
  [i915#6095]: https://gitlab.freedesktop.org/drm/intel/issues/6095
  [i915#6245]: https://gitlab.freedesktop.org/drm/intel/issues/6245
  [i915#6301]: https://gitlab.freedesktop.org/drm/intel/issues/6301
  [i915#6524]: https://gitlab.freedesktop.org/drm/intel/issues/6524
  [i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
  [i915#6768]: https://gitlab.freedesktop.org/drm/intel/issues/6768
  [i915#6946]: https://gitlab.freedesktop.org/drm/intel/issues/6946
  [i915#6953]: https://gitlab.freedesktop.org/drm/intel/issues/6953
  [i915#7116]: https://gitlab.freedesktop.org/drm/intel/issues/7116
  [i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
  [i915#7697]: https://gitlab.freedesktop.org/drm/intel/issues/7697
  [i915#7701]: https://gitlab.freedesktop.org/drm/intel/issues/7701
  [i915#7711]: https://gitlab.freedesktop.org/drm/intel/issues/7711
  [i915#7742]: https://gitlab.freedesktop.org/drm/intel/issues/7742
  [i915#7790]: https://gitlab.freedesktop.org/drm/intel/issues/7790
  [i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
  [i915#7975]: https://gitlab.freedesktop.org/drm/intel/issues/7975
  [i915#8011]: https://gitlab.freedesktop.org/drm/intel/issues/8011
  [i915#8247]: https://gitlab.freedesktop.org/drm/intel/issues/8247
  [i915#8292]: https://gitlab.freedesktop.org/drm/intel/issues/8292
  [i915#8304]: https://gitlab.freedesktop.org/drm/intel/issues/8304


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

  * CI: CI-20190529 -> None
  * IGT: IGT_7263 -> IGTPW_8834
  * Piglit: piglit_4509 -> None

  CI-20190529: 20190529
  CI_DRM_13035: 182419213bd7d88fead18eb0830855b675b093d7 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_8834: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/index.html
  IGT_7263: a6bd8f415c4ec41b5a014c7db47e46c81ffd0074 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8834/index.html

[-- Attachment #2: Type: text/html, Size: 11272 bytes --]

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

* Re: [igt-dev] [RFC 1/2] lib/xe_gpu: Introduce xe_gpu library
  2023-04-20 19:14 ` [igt-dev] [RFC 1/2] " Anna Karas
@ 2023-04-21  7:56   ` Zbigniew Kempczyński
  2023-05-15  9:51   ` Manszewski, Christoph
  1 sibling, 0 replies; 11+ messages in thread
From: Zbigniew Kempczyński @ 2023-04-21  7:56 UTC (permalink / raw)
  To: Anna Karas; +Cc: igt-dev, Joonas Lahtinen, Maarten Lankhorst

On Thu, Apr 20, 2023 at 09:14:53PM +0200, Anna Karas wrote:
> Add helpers for requiring the XE driver, reopening drm fd and restoring
> engine properties between tests.
> This lib is a direct port of gem.c from i915.
> 
> Reference: Jira VLK-46235
> Signed-off-by: Anna Karas <anna.karas@intel.com>
> ---
>  lib/meson.build |   1 +
>  lib/xe/xe_gpu.c | 136 ++++++++++++++++++++++++++++++++++++++++++++++++
>  lib/xe/xe_gpu.h |  19 +++++++
>  3 files changed, 156 insertions(+)
>  create mode 100644 lib/xe/xe_gpu.c
>  create mode 100644 lib/xe/xe_gpu.h
> 
> diff --git a/lib/meson.build b/lib/meson.build
> index b21c252b..b33f8ae6 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -100,6 +100,7 @@ lib_sources = [
>  	'igt_msm.c',
>  	'igt_dsc.c',
>  	'xe/xe_compute.c',
> +	'xe/xe_gpu.c',
>  	'xe/xe_compute_square_kernels.c',
>  	'xe/xe_ioctl.c',
>  	'xe/xe_query.c',
> diff --git a/lib/xe/xe_gpu.c b/lib/xe/xe_gpu.c
> new file mode 100644
> index 00000000..7abd8057
> --- /dev/null
> +++ b/lib/xe/xe_gpu.c
> @@ -0,0 +1,136 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2023 Intel Corporation
> + *
> + * Authors:
> + *    Anna Karas <anna.karas@intel.com>
> + */
> +
> +#include <dirent.h>
> +#include <fcntl.h>
> +#include <sys/ioctl.h>
> +
> +#include "xe/xe_gpu.h"
> +#include "igt_sysfs.h"
> +#include "igt.h"
> +
> +
> +/*
> + * Resets all engine properties to defaults prior to the start of a test.
> + */
> +static void __restore_defaults(int engine)
> +{
> +	struct dirent *de;
> +	int defaults;
> +	DIR *dir;
> +
> +	defaults = openat(engine, ".defaults", O_RDONLY);
> +	if (defaults < 0)
> +		return;
> +
> +	dir = fdopendir(defaults);
> +	if (!dir) {
> +		close(defaults);
> +		return;
> +	}
> +
> +	while ((de = readdir(dir))) {
> +		char buf[256];
> +		int fd, len;
> +
> +		if (*de->d_name == '.')
> +			continue;
> +
> +		fd = openat(defaults, de->d_name, O_RDONLY);
> +		if (fd < 0)
> +			continue;
> +
> +		len = read(fd, buf, sizeof(buf));
> +		close(fd);
> +		if (len < 0)
> +			continue;
> +
> +		fd = openat(engine, de->d_name, O_WRONLY);
> +		if (fd < 0)
> +			continue;
> +
> +		write(fd, buf, len);
> +		close(fd);
> +	}
> +
> +	closedir(dir);
> +}
> +
> +static void restore_defaults(int fd)
> +{
> +	struct dirent *de;
> +	int engines;
> +	DIR *dir;
> +	int sys;
> +
> +	sys = igt_sysfs_open(fd);
> +	if (sys < 0)
> +		return;
> +
> +	engines = openat(sys, "engine", O_RDONLY);
> +	if (engines < 0)
> +		goto close_sys;
> +
> +	dir = fdopendir(engines);
> +	if (!dir) {
> +		close(engines);
> +		goto close_sys;
> +	}
> +
> +	while ((de = readdir(dir))) {
> +		int engine;
> +
> +		if (*de->d_name == '.')
> +			continue;
> +
> +		engine = openat(engines, de->d_name, O_RDONLY);
> +		if (engine < 0)
> +			continue;
> +
> +		__restore_defaults(engine);
> +		close(engine);
> +	}
> +
> +	closedir(dir);
> +
> +close_sys:
> +	close(sys);
> +}
> +
> +/**
> + * xe_reopen_driver:
> + * @fd: re-open the xe drm file descriptor
> + *
> + * Re-opens the drm fd which is useful in instances where a clean default
> + * context is needed.
> + */
> +int xe_reopen_driver(int fd)
> +{
> +	char path[256];
> +
> +	snprintf(path, sizeof(path), "/proc/self/fd/%d", fd);
> +	fd = open(path, O_RDWR);
> +	igt_assert_fd(fd);
> +
> +	return fd;
> +}

On quick first look:

Duplicates gem_reopen_driver() code, maybe just replace 'i915' to 'fd'
there?

--
Zbigniew

> +
> +/**
> + * xe_require_gpu:
> + * @fd: the xe drm file descriptor
> + *
> + * Helper to be used prior to the start of a tests, useful in instances
> + * where a clean default context is needed.
> + */
> +void xe_require_gpu(int fd)
> +{
> +	igt_require_xe(fd);
> +	fd = xe_reopen_driver(fd);
> +	restore_defaults(fd);
> +	close(fd);
> +}
> diff --git a/lib/xe/xe_gpu.h b/lib/xe/xe_gpu.h
> new file mode 100644
> index 00000000..020040ac
> --- /dev/null
> +++ b/lib/xe/xe_gpu.h
> @@ -0,0 +1,19 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2023 Intel Corporation
> + *
> + * Authors:
> + *    Anna Karas <anna.karas@intel.com>
> + */
> +
> +#ifndef XE_GPU_H
> +#define XE_GPU_H
> +
> +#include <stdint.h>
> +#include <xe_drm.h>
> +
> +int xe_reopen_driver(int fd);
> +void xe_require_gpu(int fd);
> +
> +#endif	/* XE_GPU_H */
> +
> -- 
> 2.25.1
> 
> ---------------------------------------------------------------------
> Intel Technology Poland sp. z o.o.
> ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.
> Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych.
> 
> Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
> This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.

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

* Re: [igt-dev] [RFC 0/2] lib/xe_gpu: Introduce xe_gpu library
  2023-04-20 20:38 ` [igt-dev] [RFC 0/2] lib/xe_gpu: Introduce xe_gpu library Souza, Jose
@ 2023-04-24 11:38   ` Karas, Anna
  2023-04-25  3:41     ` Zbigniew Kempczyński
  0 siblings, 1 reply; 11+ messages in thread
From: Karas, Anna @ 2023-04-24 11:38 UTC (permalink / raw)
  To: Souza, Jose, igt-dev@lists.freedesktop.org

Hi all,
CC-ing Mauro, Matthew and Zbyszek to this thread (btw. sorry for using 
@intel.com instead of @linux.intel.com in the original email)

@all - folks, any thoughts on opens? :)

On 20.04.2023 22:38, Souza, Jose wrote:
> On Thu, 2023-04-20 at 21:14 +0200, Anna Karas wrote:
>> OPENS:
>> 1. Lack of wedged concept in XE: @Matthew informed me that there is no
>> intent to have reporting wedged device in XE. However, @Joonas believes
>> that it may be useful - "it's used at least in specific diagnostics and
>> hardware repair flows for PVC and FLR for all platforms, where we
>> prevent further accesses to the hardware. So an alternative mechanism is
>> needed for those". Since xe_require_gpu() is a direct port of i915's
>> igt_require_gem() stripped of wedged device reporting, this could be a
>> good opportunity to discuss this.
> 
> I guess you could create a Xe engine, submit NOPs and check for XE_ENGINE_GET_PROPERTY_BAN to detect if GPU is wedged.
> 

@Jose - It seems that this may help here, thanks

On 21.04.2023 09:56, Zbigniew Kempczyński wrote:
 >> +int xe_reopen_driver(int fd)
 >> +{
 >> +	char path[256];
 >> +
 >> +	snprintf(path, sizeof(path), "/proc/self/fd/%d", fd);
 >> +	fd = open(path, O_RDWR);
 >> +	igt_assert_fd(fd);
 >> +
 >> +	return fd;
 >> +}
 >
 > On quick first look:
 >
 > Duplicates gem_reopen_driver() code, maybe just replace 'i915' to 'fd'
 > there?
 >
 > --
 > Zbigniew

@Zbyszek - I agree. gem_reopen_driver() is currently placed in lib/i915, 
would it be a good idea to move it (as "drm_reopen_driver()", with 
'i915' replaced with 'fd') to lib/drmtest.c?

Ania
---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.
Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.

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

* Re: [igt-dev] [RFC 0/2] lib/xe_gpu: Introduce xe_gpu library
  2023-04-24 11:38   ` Karas, Anna
@ 2023-04-25  3:41     ` Zbigniew Kempczyński
  0 siblings, 0 replies; 11+ messages in thread
From: Zbigniew Kempczyński @ 2023-04-25  3:41 UTC (permalink / raw)
  To: Karas, Anna; +Cc: igt-dev@lists.freedesktop.org

On Mon, Apr 24, 2023 at 01:38:01PM +0200, Karas, Anna wrote:
> Hi all,
> CC-ing Mauro, Matthew and Zbyszek to this thread (btw. sorry for using
> @intel.com instead of @linux.intel.com in the original email)
> 
> @all - folks, any thoughts on opens? :)
> 
> On 20.04.2023 22:38, Souza, Jose wrote:
> > On Thu, 2023-04-20 at 21:14 +0200, Anna Karas wrote:
> > > OPENS:
> > > 1. Lack of wedged concept in XE: @Matthew informed me that there is no
> > > intent to have reporting wedged device in XE. However, @Joonas believes
> > > that it may be useful - "it's used at least in specific diagnostics and
> > > hardware repair flows for PVC and FLR for all platforms, where we
> > > prevent further accesses to the hardware. So an alternative mechanism is
> > > needed for those". Since xe_require_gpu() is a direct port of i915's
> > > igt_require_gem() stripped of wedged device reporting, this could be a
> > > good opportunity to discuss this.
> > 
> > I guess you could create a Xe engine, submit NOPs and check for XE_ENGINE_GET_PROPERTY_BAN to detect if GPU is wedged.
> > 
> 
> @Jose - It seems that this may help here, thanks
> 
> On 21.04.2023 09:56, Zbigniew Kempczyński wrote:
> >> +int xe_reopen_driver(int fd)
> >> +{
> >> +	char path[256];
> >> +
> >> +	snprintf(path, sizeof(path), "/proc/self/fd/%d", fd);
> >> +	fd = open(path, O_RDWR);
> >> +	igt_assert_fd(fd);
> >> +
> >> +	return fd;
> >> +}
> >
> > On quick first look:
> >
> > Duplicates gem_reopen_driver() code, maybe just replace 'i915' to 'fd'
> > there?
> >
> > --
> > Zbigniew
> 
> @Zbyszek - I agree. gem_reopen_driver() is currently placed in lib/i915,
> would it be a good idea to move it (as "drm_reopen_driver()", with 'i915'
> replaced with 'fd') to lib/drmtest.c?

Yes, looks reasonable. Go ahead.

--
Zbigniew


> 
> Ania

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

* Re: [igt-dev] [RFC 1/2] lib/xe_gpu: Introduce xe_gpu library
  2023-04-20 19:14 ` [igt-dev] [RFC 1/2] " Anna Karas
  2023-04-21  7:56   ` Zbigniew Kempczyński
@ 2023-05-15  9:51   ` Manszewski, Christoph
  2023-05-15 18:01     ` Karas, Anna
  1 sibling, 1 reply; 11+ messages in thread
From: Manszewski, Christoph @ 2023-05-15  9:51 UTC (permalink / raw)
  To: Anna Karas, igt-dev; +Cc: Joonas Lahtinen, Maarten Lankhorst

Hi Anna,

On 20.04.2023 21:14, Anna Karas wrote:
> Add helpers for requiring the XE driver, reopening drm fd and restoring
> engine properties between tests.
> This lib is a direct port of gem.c from i915.
> 
> Reference: Jira VLK-46235
> Signed-off-by: Anna Karas <anna.karas@intel.com>
> ---
>   lib/meson.build |   1 +
>   lib/xe/xe_gpu.c | 136 ++++++++++++++++++++++++++++++++++++++++++++++++
>   lib/xe/xe_gpu.h |  19 +++++++
>   3 files changed, 156 insertions(+)
>   create mode 100644 lib/xe/xe_gpu.c
>   create mode 100644 lib/xe/xe_gpu.h
> 
> diff --git a/lib/meson.build b/lib/meson.build
> index b21c252b..b33f8ae6 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -100,6 +100,7 @@ lib_sources = [
>   	'igt_msm.c',
>   	'igt_dsc.c',
>   	'xe/xe_compute.c',
> +	'xe/xe_gpu.c',
>   	'xe/xe_compute_square_kernels.c',
>   	'xe/xe_ioctl.c',
>   	'xe/xe_query.c',
> diff --git a/lib/xe/xe_gpu.c b/lib/xe/xe_gpu.c
> new file mode 100644
> index 00000000..7abd8057
> --- /dev/null
> +++ b/lib/xe/xe_gpu.c
> @@ -0,0 +1,136 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2023 Intel Corporation
> + *
> + * Authors:
> + *    Anna Karas <anna.karas@intel.com>
> + */
> +
> +#include <dirent.h>
> +#include <fcntl.h>
> +#include <sys/ioctl.h>
> +
> +#include "xe/xe_gpu.h"
> +#include "igt_sysfs.h"
> +#include "igt.h"
> +
> +
> +/*
> + * Resets all engine properties to defaults prior to the start of a test.
> + */
> +static void __restore_defaults(int engine)
> +{
> +	struct dirent *de;
> +	int defaults;
> +	DIR *dir;
> +
> +	defaults = openat(engine, ".defaults", O_RDONLY);
> +	if (defaults < 0)
> +		return;
> +
> +	dir = fdopendir(defaults);
> +	if (!dir) {
> +		close(defaults);
> +		return;
> +	}
> +
> +	while ((de = readdir(dir))) {
> +		char buf[256];
> +		int fd, len;
> +
> +		if (*de->d_name == '.')
> +			continue;
> +
> +		fd = openat(defaults, de->d_name, O_RDONLY);
> +		if (fd < 0)
> +			continue;
> +
> +		len = read(fd, buf, sizeof(buf));
> +		close(fd);
> +		if (len < 0)
> +			continue;
> +
> +		fd = openat(engine, de->d_name, O_WRONLY);
> +		if (fd < 0)
> +			continue;
> +
> +		write(fd, buf, len);
> +		close(fd);
> +	}
> +
> +	closedir(dir);
> +}
> +
> +static void restore_defaults(int fd)
> +{
> +	struct dirent *de;
> +	int engines;
> +	DIR *dir;
> +	int sys;
> +
> +	sys = igt_sysfs_open(fd);
> +	if (sys < 0)
> +		return;
> +
> +	engines = openat(sys, "engine", O_RDONLY);
> +	if (engines < 0)
> +		goto close_sys;
> +
> +	dir = fdopendir(engines);
> +	if (!dir) {
> +		close(engines);
> +		goto close_sys;
> +	}
> +
> +	while ((de = readdir(dir))) {
> +		int engine;
> +
> +		if (*de->d_name == '.')
> +			continue;
> +
> +		engine = openat(engines, de->d_name, O_RDONLY);
> +		if (engine < 0)
> +			continue;
> +
> +		__restore_defaults(engine);
> +		close(engine);
> +	}
> +
> +	closedir(dir);
> +
> +close_sys:
> +	close(sys);
> +}

Looks like this duplicates 'restore_defaults' and '__restore_defaults' 
from lib/i915/gem.c. Maybe better just move the existing code higher up 
and reuse it?

Christoph


> +
> +/**
> + * xe_reopen_driver:
> + * @fd: re-open the xe drm file descriptor
> + *
> + * Re-opens the drm fd which is useful in instances where a clean default
> + * context is needed.
> + */
> +int xe_reopen_driver(int fd)
> +{
> +	char path[256];
> +
> +	snprintf(path, sizeof(path), "/proc/self/fd/%d", fd);
> +	fd = open(path, O_RDWR);
> +	igt_assert_fd(fd);
> +
> +	return fd;
> +}
> +
> +/**
> + * xe_require_gpu:
> + * @fd: the xe drm file descriptor
> + *
> + * Helper to be used prior to the start of a tests, useful in instances
> + * where a clean default context is needed.
> + */
> +void xe_require_gpu(int fd)
> +{
> +	igt_require_xe(fd);
> +	fd = xe_reopen_driver(fd);
> +	restore_defaults(fd);
> +	close(fd);
> +}
> diff --git a/lib/xe/xe_gpu.h b/lib/xe/xe_gpu.h
> new file mode 100644
> index 00000000..020040ac
> --- /dev/null
> +++ b/lib/xe/xe_gpu.h
> @@ -0,0 +1,19 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2023 Intel Corporation
> + *
> + * Authors:
> + *    Anna Karas <anna.karas@intel.com>
> + */
> +
> +#ifndef XE_GPU_H
> +#define XE_GPU_H
> +
> +#include <stdint.h>
> +#include <xe_drm.h>
> +
> +int xe_reopen_driver(int fd);
> +void xe_require_gpu(int fd);
> +
> +#endif	/* XE_GPU_H */
> +

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

* Re: [igt-dev] [RFC 1/2] lib/xe_gpu: Introduce xe_gpu library
  2023-05-15  9:51   ` Manszewski, Christoph
@ 2023-05-15 18:01     ` Karas, Anna
  0 siblings, 0 replies; 11+ messages in thread
From: Karas, Anna @ 2023-05-15 18:01 UTC (permalink / raw)
  To: Manszewski, Christoph, igt-dev

Hi Christoph,

On 15.05.2023 11:51, Manszewski, Christoph wrote:
> Hi Anna,
> 
> On 20.04.2023 21:14, Anna Karas wrote:
>> Add helpers for requiring the XE driver, reopening drm fd and restoring
>> engine properties between tests.
>> This lib is a direct port of gem.c from i915.
>>
>> Reference: Jira VLK-46235
>> Signed-off-by: Anna Karas <anna.karas@intel.com>
>> ---
>>   lib/meson.build |   1 +
>>   lib/xe/xe_gpu.c | 136 ++++++++++++++++++++++++++++++++++++++++++++++++
>>   lib/xe/xe_gpu.h |  19 +++++++
>>   3 files changed, 156 insertions(+)
>>   create mode 100644 lib/xe/xe_gpu.c
>>   create mode 100644 lib/xe/xe_gpu.h
>>
>> diff --git a/lib/meson.build b/lib/meson.build
>> index b21c252b..b33f8ae6 100644
>> --- a/lib/meson.build
>> +++ b/lib/meson.build
>> @@ -100,6 +100,7 @@ lib_sources = [
>>       'igt_msm.c',
>>       'igt_dsc.c',
>>       'xe/xe_compute.c',
>> +    'xe/xe_gpu.c',
>>       'xe/xe_compute_square_kernels.c',
>>       'xe/xe_ioctl.c',
>>       'xe/xe_query.c',
>> diff --git a/lib/xe/xe_gpu.c b/lib/xe/xe_gpu.c
>> new file mode 100644
>> index 00000000..7abd8057
>> --- /dev/null
>> +++ b/lib/xe/xe_gpu.c
>> @@ -0,0 +1,136 @@
>> +/* SPDX-License-Identifier: MIT */
>> +/*
>> + * Copyright © 2023 Intel Corporation
>> + *
>> + * Authors:
>> + *    Anna Karas <anna.karas@intel.com>
>> + */
>> +
>> +#include <dirent.h>
>> +#include <fcntl.h>
>> +#include <sys/ioctl.h>
>> +
>> +#include "xe/xe_gpu.h"
>> +#include "igt_sysfs.h"
>> +#include "igt.h"
>> +
>> +
>> +/*
>> + * Resets all engine properties to defaults prior to the start of a 
>> test.
>> + */
>> +static void __restore_defaults(int engine)
>> +{
>> +    struct dirent *de;
>> +    int defaults;
>> +    DIR *dir;
>> +
>> +    defaults = openat(engine, ".defaults", O_RDONLY);
>> +    if (defaults < 0)
>> +        return;
>> +
>> +    dir = fdopendir(defaults);
>> +    if (!dir) {
>> +        close(defaults);
>> +        return;
>> +    }
>> +
>> +    while ((de = readdir(dir))) {
>> +        char buf[256];
>> +        int fd, len;
>> +
>> +        if (*de->d_name == '.')
>> +            continue;
>> +
>> +        fd = openat(defaults, de->d_name, O_RDONLY);
>> +        if (fd < 0)
>> +            continue;
>> +
>> +        len = read(fd, buf, sizeof(buf));
>> +        close(fd);
>> +        if (len < 0)
>> +            continue;
>> +
>> +        fd = openat(engine, de->d_name, O_WRONLY);
>> +        if (fd < 0)
>> +            continue;
>> +
>> +        write(fd, buf, len);
>> +        close(fd);
>> +    }
>> +
>> +    closedir(dir);
>> +}
>> +
>> +static void restore_defaults(int fd)
>> +{
>> +    struct dirent *de;
>> +    int engines;
>> +    DIR *dir;
>> +    int sys;
>> +
>> +    sys = igt_sysfs_open(fd);
>> +    if (sys < 0)
>> +        return;
>> +
>> +    engines = openat(sys, "engine", O_RDONLY);
>> +    if (engines < 0)
>> +        goto close_sys;
>> +
>> +    dir = fdopendir(engines);
>> +    if (!dir) {
>> +        close(engines);
>> +        goto close_sys;
>> +    }
>> +
>> +    while ((de = readdir(dir))) {
>> +        int engine;
>> +
>> +        if (*de->d_name == '.')
>> +            continue;
>> +
>> +        engine = openat(engines, de->d_name, O_RDONLY);
>> +        if (engine < 0)
>> +            continue;
>> +
>> +        __restore_defaults(engine);
>> +        close(engine);
>> +    }
>> +
>> +    closedir(dir);
>> +
>> +close_sys:
>> +    close(sys);
>> +}
> 
> Looks like this duplicates 'restore_defaults' and '__restore_defaults' 
> from lib/i915/gem.c. Maybe better just move the existing code higher up 
> and reuse it?
> 
> ChristophYou're right, I did something similar with gem_reopen_driver.

During the review process (no record on ML, unfortunately. See more: 
VLK-47609, VLK-46133) it turned out that there is no need for resetting 
the defaults anyway.

Anna

> 
> 
>> +
>> +/**
>> + * xe_reopen_driver:
>> + * @fd: re-open the xe drm file descriptor
>> + *
>> + * Re-opens the drm fd which is useful in instances where a clean 
>> default
>> + * context is needed.
>> + */
>> +int xe_reopen_driver(int fd)
>> +{
>> +    char path[256];
>> +
>> +    snprintf(path, sizeof(path), "/proc/self/fd/%d", fd);
>> +    fd = open(path, O_RDWR);
>> +    igt_assert_fd(fd);
>> +
>> +    return fd;
>> +}
>> +
>> +/**
>> + * xe_require_gpu:
>> + * @fd: the xe drm file descriptor
>> + *
>> + * Helper to be used prior to the start of a tests, useful in instances
>> + * where a clean default context is needed.
>> + */
>> +void xe_require_gpu(int fd)
>> +{
>> +    igt_require_xe(fd);
>> +    fd = xe_reopen_driver(fd);
>> +    restore_defaults(fd);
>> +    close(fd);
>> +}
>> diff --git a/lib/xe/xe_gpu.h b/lib/xe/xe_gpu.h
>> new file mode 100644
>> index 00000000..020040ac
>> --- /dev/null
>> +++ b/lib/xe/xe_gpu.h
>> @@ -0,0 +1,19 @@
>> +/* SPDX-License-Identifier: MIT */
>> +/*
>> + * Copyright © 2023 Intel Corporation
>> + *
>> + * Authors:
>> + *    Anna Karas <anna.karas@intel.com>
>> + */
>> +
>> +#ifndef XE_GPU_H
>> +#define XE_GPU_H
>> +
>> +#include <stdint.h>
>> +#include <xe_drm.h>
>> +
>> +int xe_reopen_driver(int fd);
>> +void xe_require_gpu(int fd);
>> +
>> +#endif    /* XE_GPU_H */
>> +

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

end of thread, other threads:[~2023-05-15 18:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-20 19:14 [igt-dev] [RFC 0/2] lib/xe_gpu: Introduce xe_gpu library Anna Karas
2023-04-20 19:14 ` [igt-dev] [RFC 1/2] " Anna Karas
2023-04-21  7:56   ` Zbigniew Kempczyński
2023-05-15  9:51   ` Manszewski, Christoph
2023-05-15 18:01     ` Karas, Anna
2023-04-20 19:14 ` [igt-dev] [RFC 2/2] tests/xe: Use xe_require_gpu() in existing tests Anna Karas
2023-04-20 20:38 ` [igt-dev] [RFC 0/2] lib/xe_gpu: Introduce xe_gpu library Souza, Jose
2023-04-24 11:38   ` Karas, Anna
2023-04-25  3:41     ` Zbigniew Kempczyński
2023-04-20 20:58 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2023-04-21  5:28 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox