Skip to contentSkip to conversation

Add Xe lib support for hang & GT reset

PATCH In review [email protected] 5 participants 11 messages Jul 25, 2023 – Aug 7, 2023 Library code

lore
Share & tools
lore
#0 lore raw

cover Add Xe lib support for hang & GT reset

From: Janga Rahul Kumar <[email protected]>

Add library support for hang and resetting all the GT's.

Cc Sai Gowtham Ch <[email protected]>
Cc Kunal Joshi <[email protected]>

Janga Rahul Kumar (2):
lib/xe: Add support to reset all GT's
lib/xe: Add hang library support

 lib/igt_gt.c      | 28 ++++++++++++++++++
 lib/xe/xe_ioctl.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/xe/xe_ioctl.h |  8 ++++++
 3 files changed, 108 insertions(+)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 lib/xe: Add support to reset all GT's

From: Janga Rahul Kumar <[email protected]>

Add library support to check support for GT reset and force reset all GT's.

Cc Sai Gowtham Ch <[email protected]>
Cc Kunal Joshi <[email protected]>
---
 lib/igt_gt.c      |  7 +++++++
 lib/xe/xe_ioctl.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/xe/xe_ioctl.h |  2 ++
 3 files changed, 61 insertions(+)
lib/igt_gt.c +7 -0
index d4a825e66..2ce464ba6 100644
@@ -45,6 +45,7 @@
 #include "intel_chipset.h"
 #include "igt_dummyload.h"
 
+#include "xe/xe_ioctl.h"
 /**
  * SECTION:igt_gt
  * @short_description: GT support library
@@ -60,6 +61,9 @@ static int reset_query_once = -1;
 
 static bool has_gpu_reset(int fd)
 {
+	if (is_xe_device(fd))
+		has_xe_gt_reset(fd);
+
 	if (reset_query_once < 0) {
 		reset_query_once = gem_gpu_reset_type(fd);
 
@@ -395,6 +399,9 @@ void igt_post_hang_ring(int fd, igt_hang_t arg)
  */
 void igt_force_gpu_reset(int drm_fd)
 {
+	if (is_xe_device(drm_fd))
+		xe_force_gt_reset_all(drm_fd);
+
 	int dir, wedged;
 
 	igt_debug("Triggering GPU reset\n");
lib/xe/xe_ioctl.c +52 -0

64 lines not on this page · raw message

lib/xe/xe_ioctl.h +2 -0
index 320e0f9f6..5a528b345 100644
@@ -87,6 +87,8 @@ int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value,
 			       struct drm_xe_engine_class_instance *eci,
 			       int64_t timeout);
 void xe_force_gt_reset(int fd, int gt);
+void xe_force_gt_reset_all(int fd);
+bool has_xe_gt_reset(int fd);
 void xe_vm_madvise(int fd, uint32_t vm, uint64_t addr, uint64_t size,
 		   uint32_t property, uint32_t value);
 
Signature · 1 line
2.25.1
#2 lore raw

Re: [igt-dev] [PATCH i-g-t 1/2] lib/xe: Add support to reset all GT's

Hi Janga,

Quoted 19 lines · On 2023-07-25 at 12:46:21 +0530, [email protected] wrote:

From: Janga Rahul Kumar <[email protected]>

Add library support to check support for GT reset and force reset all GT's.

Cc Sai Gowtham Ch <[email protected]>
Cc Kunal Joshi <[email protected]>
---
 lib/igt_gt.c      |  7 +++++++
 lib/xe/xe_ioctl.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/xe/xe_ioctl.h |  2 ++
 3 files changed, 61 insertions(+)
lib/igt_gt.c +0 -0
index d4a825e66..2ce464ba6 100644

lib/igt_gt.c line 48

Quoted 4 lines
lib/igt_gt.c +1 -0
@@ -45,6 +45,7 @@
 #include "intel_chipset.h"
 #include "igt_dummyload.h"
 
+#include "xe/xe_ioctl.h"

Add newline here.

Quoted 14 lines
lib/igt_gt.c +3 -0
 /**
  * SECTION:igt_gt
  * @short_description: GT support library
@@ -60,6 +61,9 @@ static int reset_query_once = -1;
 
 static bool has_gpu_reset(int fd)
 {
+	if (is_xe_device(fd))
+		has_xe_gt_reset(fd);
+
 	if (reset_query_once < 0) {
 		reset_query_once = gem_gpu_reset_type(fd);
 

lib/igt_gt.c void igt_post_hang_ring(int fd, igt_hang_t arg) · line 404

Quoted 6 lines
lib/igt_gt.c +3 -0
@@ -395,6 +399,9 @@ void igt_post_hang_ring(int fd, igt_hang_t arg)
  */
 void igt_force_gpu_reset(int drm_fd)
 {
+	if (is_xe_device(drm_fd))
+		xe_force_gt_reset_all(drm_fd);
+

Move above code after igt_debug below.

Quoted 25 lines
lib/igt_gt.c +0 -0
 	int dir, wedged;
 
 	igt_debug("Triggering GPU reset\n");
lib/xe/xe_ioctl.c +7 -0
index 1f9240cd9..488aa218e 100644
@@ -41,6 +41,7 @@
 #include "config.h"
 #include "drmtest.h"
 #include "igt_syncobj.h"
+#include "igt_sysfs.h"
 #include "ioctl_wrappers.h"
 #include "xe_ioctl.h"
 #include "xe_query.h"
@@ -455,6 +456,57 @@ int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value,
 	return ts.tv_sec * 1e9 + ts.tv_nsec;
 }
 
+
+/**
+ * has_xe_gt_reset:
+ * @fd: open xe drm file descriptor
+ *
+ * Check gt force reset syfs entry is available or not

lib/xe/xe_ioctl.c int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value, · line 474

Quoted 10 lines
lib/xe/xe_ioctl.c +10 -0
+ *
+ * Returns: reset sysfs entry available
+ */
+bool has_xe_gt_reset(int fd)
+{
+	char reset_sysfs_path[100];
+	struct stat st;
+	int gt;
+	int reset_sysfs_fd = -1;
+	int sysfs_fd = -1;

Add newline here.

Quoted 20 lines
lib/xe/xe_ioctl.c +20 -0
+	igt_assert_eq(fstat(fd, &st), 0);
+
+	sysfs_fd = igt_sysfs_open(fd);
+	igt_assert(sysfs_fd != -1);
+
+	xe_for_each_gt(fd, gt) {
+		sprintf(reset_sysfs_path, "/sys/kernel/debug/dri/%d/gt%d/force_reset", minor(st.st_rdev), gt);
+		reset_sysfs_fd = openat(sysfs_fd, reset_sysfs_path, O_RDONLY);
+
+		if(reset_sysfs_fd == -1) {
+			close(sysfs_fd);
+			return 0;
+		}
+
+		close(reset_sysfs_fd);
+       }
+
+	close(sysfs_fd);
+	return 1;
+}

lib/xe/xe_ioctl.c int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value, · line 504

Quoted 10 lines
lib/xe/xe_ioctl.c +10 -0
+
+/**
+ * xe_force_gt_reset_all:
+ *
+ * Forces reset of all the GT's.
+ *
+ */
+void xe_force_gt_reset_all(int xe_fd)
+{
+	int gt;

Add newline.

Regards,
Kamil

Quoted 24 lines
lib/xe/xe_ioctl.c +5 -0
+	xe_for_each_gt(xe_fd, gt)
+		xe_force_gt_reset(xe_fd, gt);
+}
+
+
 void xe_force_gt_reset(int fd, int gt)
 {
 	char reset_string[128];
lib/xe/xe_ioctl.h +2 -0
index 320e0f9f6..5a528b345 100644
@@ -87,6 +87,8 @@ int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value,
 			       struct drm_xe_engine_class_instance *eci,
 			       int64_t timeout);
 void xe_force_gt_reset(int fd, int gt);
+void xe_force_gt_reset_all(int fd);
+bool has_xe_gt_reset(int fd);
 void xe_vm_madvise(int fd, uint32_t vm, uint64_t addr, uint64_t size,
 		   uint32_t property, uint32_t value);
 
Signature · 1 line
2.25.1
#3 lore raw

Re: [igt-dev] [PATCH i-g-t 1/2] lib/xe: Add support to reset all GT's

Hi all,
I have a few minor remarks to add.

Quoted 71 lines · Kamil Konieczny

Hi Janga,

Quoted 19 lines · On 2023-07-25 at 12:46:21 +0530, [email protected] wrote:

From: Janga Rahul Kumar <[email protected]>

Add library support to check support for GT reset and force reset all GT's.

Cc Sai Gowtham Ch <[email protected]>
Cc Kunal Joshi <[email protected]>
---
  lib/igt_gt.c      |  7 +++++++
  lib/xe/xe_ioctl.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++
  lib/xe/xe_ioctl.h |  2 ++
  3 files changed, 61 insertions(+)
lib/igt_gt.c +0 -0
index d4a825e66..2ce464ba6 100644

lib/igt_gt.c line 48

Quoted 4 lines
lib/igt_gt.c +1 -0
@@ -45,6 +45,7 @@
  #include "intel_chipset.h"
  #include "igt_dummyload.h"
 
+#include "xe/xe_ioctl.h"

Add newline here.

Quoted 14 lines
lib/igt_gt.c +3 -0
  /**
   * SECTION:igt_gt
   * @short_description: GT support library
@@ -60,6 +61,9 @@ static int reset_query_once = -1;
 
  static bool has_gpu_reset(int fd)
  {
+	if (is_xe_device(fd))
+		has_xe_gt_reset(fd);
+
  	if (reset_query_once < 0) {
  		reset_query_once = gem_gpu_reset_type(fd);
 

lib/igt_gt.c void igt_post_hang_ring(int fd, igt_hang_t arg) · line 404

Quoted 6 lines
lib/igt_gt.c +3 -0
@@ -395,6 +399,9 @@ void igt_post_hang_ring(int fd, igt_hang_t arg)
   */
  void igt_force_gpu_reset(int drm_fd)
  {
+	if (is_xe_device(drm_fd))
+		xe_force_gt_reset_all(drm_fd);
+

Move above code after igt_debug below.

Quoted 19 lines
lib/igt_gt.c +0 -0
  	int dir, wedged;
 
  	igt_debug("Triggering GPU reset\n");
lib/xe/xe_ioctl.c +1 -0
index 1f9240cd9..488aa218e 100644
@@ -41,6 +41,7 @@
  #include "config.h"
  #include "drmtest.h"
  #include "igt_syncobj.h"
+#include "igt_sysfs.h"
  #include "ioctl_wrappers.h"
  #include "xe_ioctl.h"
  #include "xe_query.h"
@@ -455,6 +456,57 @@ int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value,
  	return ts.tv_sec * 1e9 + ts.tv_nsec;
  }
 
Quoted 6 lines

lib/xe/xe_ioctl.c int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value, · line 464

Quoted 6 lines
lib/xe/xe_ioctl.c +6 -0
+
+/**
+ * has_xe_gt_reset:
+ * @fd: open xe drm file descriptor
+ *
+ * Check gt force reset syfs entry is available or not

Typo: sysfs.

Quoted 13 lines

lib/xe/xe_ioctl.c int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value, · line 474

Quoted 10 lines
lib/xe/xe_ioctl.c +10 -0
+ *
+ * Returns: reset sysfs entry available
+ */
+bool has_xe_gt_reset(int fd)
+{
+	char reset_sysfs_path[100];
+	struct stat st;
+	int gt;
+	int reset_sysfs_fd = -1;
+	int sysfs_fd = -1;

Add newline here.

Quoted 10 lines

lib/xe/xe_ioctl.c int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value, · line 484

Quoted 10 lines
lib/xe/xe_ioctl.c +10 -0
+	igt_assert_eq(fstat(fd, &st), 0);
+
+	sysfs_fd = igt_sysfs_open(fd);
+	igt_assert(sysfs_fd != -1);
+
+	xe_for_each_gt(fd, gt) {
+		sprintf(reset_sysfs_path, "/sys/kernel/debug/dri/%d/gt%d/force_reset", minor(st.st_rdev), gt);
+		reset_sysfs_fd = openat(sysfs_fd, reset_sysfs_path, O_RDONLY);
+
+		if(reset_sysfs_fd == -1) {

Separate if and ( with space.

Quoted 8 lines
Quoted 8 lines
lib/xe/xe_ioctl.c +8 -0
+			close(sysfs_fd);
+			return 0;
+		}
+
+		close(reset_sysfs_fd);
+       }
+
+	close(sysfs_fd);
Quoted 8 lines

lib/xe/xe_ioctl.c int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value, · line 500

Quoted 8 lines
lib/xe/xe_ioctl.c +8 -0
+	return 1;
+}
+
+/**
+ * xe_force_gt_reset_all:
+ *
+ * Forces reset of all the GT's.
+ *

This line is not necessary.

Quoted 31 lines

lib/xe/xe_ioctl.c int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value, · line 504

Quoted 4 lines
lib/xe/xe_ioctl.c +4 -0
+ */
+void xe_force_gt_reset_all(int xe_fd)
+{
+	int gt;

Add newline.

Regards,
Kamil

Quoted 21 lines
lib/xe/xe_ioctl.c +5 -0
+	xe_for_each_gt(xe_fd, gt)
+		xe_force_gt_reset(xe_fd, gt);
+}
+
+
  void xe_force_gt_reset(int fd, int gt)
  {
  	char reset_string[128];
lib/xe/xe_ioctl.h +2 -0
index 320e0f9f6..5a528b345 100644
@@ -87,6 +87,8 @@ int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value,
  			       struct drm_xe_engine_class_instance *eci,
  			       int64_t timeout);
  void xe_force_gt_reset(int fd, int gt);
+void xe_force_gt_reset_all(int fd);
+bool has_xe_gt_reset(int fd);
  void xe_vm_madvise(int fd, uint32_t vm, uint64_t addr, uint64_t size,
  		   uint32_t property, uint32_t value);
 
Quoted 3 lines
Quoted 3 lines
Signature · 1 line
2.25.1

Apart from my comments, please check your patch with checkpatch before sending v2. Regards,
Anna

#4 lore raw

PATCH 2/2 lib/xe: Add hang library support

In reply to [email protected]

From: Janga Rahul Kumar <[email protected]>

Add hang library support using spinners.

Cc Sai Gowtham Ch <[email protected]>
Cc Kunal Joshi <[email protected]>
---
 lib/igt_gt.c      | 21 +++++++++++++++++++++
 lib/xe/xe_ioctl.c | 20 ++++++++++++++++++++
 lib/xe/xe_ioctl.h |  6 ++++++
 3 files changed, 47 insertions(+)
lib/igt_gt.c +21 -0
index 2ce464ba6..6821179ca 100644
@@ -170,6 +170,15 @@ static void context_set_ban(int fd, unsigned ctx, unsigned ban)
 
 igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)
 {
+	if (is_xe_device(fd)) {
+		if (!igt_check_boolean_env_var("IGT_HANG", true))
+			igt_skip("hang injection disabled by user [IGT_HANG=0]\n");
+
+		igt_require(has_gpu_reset(fd));
+
+		return (struct igt_hang){ 0, ctx, 0, flags };
+       }
+
 	struct drm_i915_gem_context_param param = {
 		.ctx_id = ctx,
 	};
@@ -219,6 +228,9 @@ igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)
 
 void igt_disallow_hang(int fd, igt_hang_t arg)
 {
+	if (is_xe_device(fd))
+		return;
+
 	context_set_ban(fd, arg.ctx, arg.ban);
 
 	if ((arg.flags & HANG_ALLOW_CAPTURE) == 0) {
@@ -290,6 +302,9 @@ static bool has_ctx_exec(int fd, unsigned ring, uint32_t ctx)
 static igt_hang_t __igt_hang_ctx(int fd, uint64_t ahnd, uint32_t ctx, int ring,
 				 unsigned flags)
 {
+	if (is_xe_device(fd))
+		return xe_hang_engine(fd, ahnd, ctx, ring, flags);
+
 	struct drm_i915_gem_context_param param;
 	igt_spin_t *spin;
 	unsigned ban;
@@ -372,6 +387,12 @@ void igt_post_hang_ring(int fd, igt_hang_t arg)
 	if (!arg.spin)
 		return;
 
+	if (is_xe_device(fd)) {
+		igt_spin_free(fd, arg.spin);
+		xe_post_hang_ring(fd, arg);
+		return;
+	}
+
 	gem_sync(fd, arg.spin->handle); /* Wait until it hangs */
 	igt_spin_free(fd, arg.spin);
 
lib/xe/xe_ioctl.c +20 -0
index 488aa218e..5ec85239a 100644
@@ -520,6 +520,26 @@ void xe_force_gt_reset(int fd, int gt)
 	system(reset_string);
 }
 
+
+igt_hang_t xe_hang_engine(int fd, uint64_t ahnd, uint32_t ctx, int ring,
+				unsigned flags)
+{
+	uint32_t vm;
+	unsigned int engine;
+	igt_spin_t *spin_t;
+	vm = xe_vm_create(fd, 0, 0);
+	engine = xe_engine_create_class(fd, vm, DRM_XE_ENGINE_CLASS_COPY);
+
+	spin_t = igt_spin_new(fd, .ahnd = ahnd, .engine = engine, .vm = vm, .flags = IGT_SPIN_NO_PREEMPTION);
+	return (igt_hang_t){ spin_t, engine, 0, flags };
+}
+
+void xe_post_hang_ring(int fd, igt_hang_t arg)
+{
+	xe_engine_destroy(fd, arg.ctx);
+	xe_vm_destroy(fd, arg.spin->vm);
+}
+
 void xe_vm_madvise(int fd, uint32_t vm, uint64_t addr, uint64_t size,
 		   uint32_t property, uint32_t value)
 {
lib/xe/xe_ioctl.h +6 -0
index 5a528b345..0e9708194 100644
@@ -15,6 +15,9 @@
 #include <stdint.h>
 #include <xe_drm.h>
 
+#include "lib/igt_gt.h"
+#include "xe_spin.h"
+
 uint32_t xe_cs_prefetch_size(int fd);
 uint32_t xe_vm_create(int fd, uint32_t flags, uint64_t ext);
 int  __xe_vm_bind(int fd, uint32_t vm, uint32_t engine, uint32_t bo,
@@ -89,6 +92,9 @@ int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value,
 void xe_force_gt_reset(int fd, int gt);
 void xe_force_gt_reset_all(int fd);
 bool has_xe_gt_reset(int fd);
+igt_hang_t xe_hang_engine(int fd, uint64_t ahnd, uint32_t ctx, int ring,
+				unsigned flags);
+void xe_post_hang_ring(int fd, igt_hang_t arg);
 void xe_vm_madvise(int fd, uint32_t vm, uint64_t addr, uint64_t size,
 		   uint32_t property, uint32_t value);
 
Signature · 1 line
2.25.1
#5 lore raw

Re: [igt-dev] [PATCH i-g-t 2/2] lib/xe: Add hang library support

Hi Janga,

Quoted 9 lines · On 2023-07-25 at 12:46:22 +0530, [email protected] wrote:

From: Janga Rahul Kumar <[email protected]>

Add hang library support using spinners.

Cc Sai Gowtham Ch <[email protected]>
Cc Kunal Joshi <[email protected]>
---
 lib/igt_gt.c      | 21 +++++++++++++++++++++

------ ^^^^^^
Move this change into separate patch.

Quoted 11 lines
 lib/xe/xe_ioctl.c | 20 ++++++++++++++++++++
 lib/xe/xe_ioctl.h |  6 ++++++
 3 files changed, 47 insertions(+)
lib/igt_gt.c +0 -0
index 2ce464ba6..6821179ca 100644
@@ -170,6 +170,15 @@ static void context_set_ban(int fd, unsigned ctx, unsigned ban)
 
 igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)

lib/igt_gt.c static void context_set_ban(int fd, unsigned ctx, unsigned ban) · line 181

Quoted 10 lines
lib/igt_gt.c +9 -0
 {
+	if (is_xe_device(fd)) {
+		if (!igt_check_boolean_env_var("IGT_HANG", true))
+			igt_skip("hang injection disabled by user [IGT_HANG=0]\n");
+
+		igt_require(has_gpu_reset(fd));
+
+		return (struct igt_hang){ 0, ctx, 0, flags };
+       }
+

Move code after declarations of vars.

Quoted 14 lines
lib/igt_gt.c +3 -0
 	struct drm_i915_gem_context_param param = {
 		.ctx_id = ctx,
 	};
@@ -219,6 +228,9 @@ igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)
 
 void igt_disallow_hang(int fd, igt_hang_t arg)
 {
+	if (is_xe_device(fd))
+		return;
+
 	context_set_ban(fd, arg.ctx, arg.ban);
 
 	if ((arg.flags & HANG_ALLOW_CAPTURE) == 0) {

lib/igt_gt.c static bool has_ctx_exec(int fd, unsigned ring, uint32_t ctx) · line 307

Quoted 6 lines
lib/igt_gt.c +3 -0
@@ -290,6 +302,9 @@ static bool has_ctx_exec(int fd, unsigned ring, uint32_t ctx)
 static igt_hang_t __igt_hang_ctx(int fd, uint64_t ahnd, uint32_t ctx, int ring,
 				 unsigned flags)
 {
+	if (is_xe_device(fd))
+		return xe_hang_engine(fd, ahnd, ctx, ring, flags);
+

Move this after var declatarions.

lib/igt_gt.c void igt_post_hang_ring(int fd, igt_hang_t arg) · line 392

Quoted 10 lines
lib/igt_gt.c +3 -0
 	struct drm_i915_gem_context_param param;
 	igt_spin_t *spin;
 	unsigned ban;
@@ -372,6 +387,12 @@ void igt_post_hang_ring(int fd, igt_hang_t arg)
 	if (!arg.spin)
 		return;
 
+	if (is_xe_device(fd)) {
+		igt_spin_free(fd, arg.spin);
+		xe_post_hang_ring(fd, arg);

It looks like spinner is not used here?

Quoted 11 lines
lib/igt_gt.c +3 -0
+		return;
+	}
+
 	gem_sync(fd, arg.spin->handle); /* Wait until it hangs */
 	igt_spin_free(fd, arg.spin);
 
lib/xe/xe_ioctl.c +0 -0
index 488aa218e..5ec85239a 100644

lib/xe/xe_ioctl.c void xe_force_gt_reset(int fd, int gt) · line 529

Quoted 10 lines
lib/xe/xe_ioctl.c +7 -0
@@ -520,6 +520,26 @@ void xe_force_gt_reset(int fd, int gt)
 	system(reset_string);
 }
 
+
+igt_hang_t xe_hang_engine(int fd, uint64_t ahnd, uint32_t ctx, int ring,
+				unsigned flags)
+{
+	uint32_t vm;
+	unsigned int engine;
+	igt_spin_t *spin_t;

Add newline.

lib/xe/xe_ioctl.c void xe_force_gt_reset(int fd, int gt) · line 531

Quoted 2 lines
lib/xe/xe_ioctl.c +2 -0
+	vm = xe_vm_create(fd, 0, 0);
+	engine = xe_engine_create_class(fd, vm, DRM_XE_ENGINE_CLASS_COPY);

----------------------------------------------- ^
Only one engine class here?

lib/xe/xe_ioctl.c void xe_force_gt_reset(int fd, int gt) · line 533

Quoted 2 lines
lib/xe/xe_ioctl.c +2 -0
+
+	spin_t = igt_spin_new(fd, .ahnd = ahnd, .engine = engine, .vm = vm, .flags = IGT_SPIN_NO_PREEMPTION);

Add newline.

lib/xe/xe_ioctl.c void xe_force_gt_reset(int fd, int gt) · line 534

Quoted 1 line
lib/xe/xe_ioctl.c +1 -0
+	return (igt_hang_t){ spin_t, engine, 0, flags };

Unused ring var?

Quoted 16 lines
lib/xe/xe_ioctl.c +8 -0
+}
+
+void xe_post_hang_ring(int fd, igt_hang_t arg)
+{
+	xe_engine_destroy(fd, arg.ctx);
+	xe_vm_destroy(fd, arg.spin->vm);
+}
+
 void xe_vm_madvise(int fd, uint32_t vm, uint64_t addr, uint64_t size,
 		   uint32_t property, uint32_t value)
 {
lib/xe/xe_ioctl.h +0 -0
index 5a528b345..0e9708194 100644

lib/xe/xe_ioctl.h line 20

Quoted 6 lines
lib/xe/xe_ioctl.h +3 -0
@@ -15,6 +15,9 @@
 #include <stdint.h>
 #include <xe_drm.h>
 
+#include "lib/igt_gt.h"
+#include "xe_spin.h"
+

Are you using new ioctl? If not maybe add xe_hang and xe_post_hang to other library? Or create new one?

Regards,
Kamil

Quoted 16 lines
lib/xe/xe_ioctl.h +3 -0
 uint32_t xe_cs_prefetch_size(int fd);
 uint32_t xe_vm_create(int fd, uint32_t flags, uint64_t ext);
 int  __xe_vm_bind(int fd, uint32_t vm, uint32_t engine, uint32_t bo,
@@ -89,6 +92,9 @@ int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value,
 void xe_force_gt_reset(int fd, int gt);
 void xe_force_gt_reset_all(int fd);
 bool has_xe_gt_reset(int fd);
+igt_hang_t xe_hang_engine(int fd, uint64_t ahnd, uint32_t ctx, int ring,
+				unsigned flags);
+void xe_post_hang_ring(int fd, igt_hang_t arg);
 void xe_vm_madvise(int fd, uint32_t vm, uint64_t addr, uint64_t size,
 		   uint32_t property, uint32_t value);
 
Signature · 1 line
2.25.1
#6 lore raw

Re: [igt-dev] [PATCH i-g-t 2/2] lib/xe: Add hang library support

Hi all,

Quoted 51 lines · Kamil Konieczny

Hi Janga,

Quoted 9 lines · On 2023-07-25 at 12:46:22 +0530, [email protected] wrote:

From: Janga Rahul Kumar <[email protected]>

Add hang library support using spinners.

Cc Sai Gowtham Ch <[email protected]>
Cc Kunal Joshi <[email protected]>
---
  lib/igt_gt.c      | 21 +++++++++++++++++++++

------ ^^^^^^
Move this change into separate patch.

Quoted 11 lines
  lib/xe/xe_ioctl.c | 20 ++++++++++++++++++++
  lib/xe/xe_ioctl.h |  6 ++++++
  3 files changed, 47 insertions(+)
lib/igt_gt.c +0 -0
index 2ce464ba6..6821179ca 100644
@@ -170,6 +170,15 @@ static void context_set_ban(int fd, unsigned ctx, unsigned ban)
 
  igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)

lib/igt_gt.c static void context_set_ban(int fd, unsigned ctx, unsigned ban) · line 181

Quoted 10 lines
lib/igt_gt.c +9 -0
  {
+	if (is_xe_device(fd)) {
+		if (!igt_check_boolean_env_var("IGT_HANG", true))
+			igt_skip("hang injection disabled by user [IGT_HANG=0]\n");
+
+		igt_require(has_gpu_reset(fd));
+
+		return (struct igt_hang){ 0, ctx, 0, flags };
+       }
+

Move code after declarations of vars.

Quoted 12 lines
lib/igt_gt.c +3 -0
  	struct drm_i915_gem_context_param param = {
  		.ctx_id = ctx,
  	};
@@ -219,6 +228,9 @@ igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)
 
  void igt_disallow_hang(int fd, igt_hang_t arg)
  {
+	if (is_xe_device(fd))
+		return;
+
  	context_set_ban(fd, arg.ctx, arg.ban);
 
Quoted 10 lines

lib/igt_gt.c static bool has_ctx_exec(int fd, unsigned ring, uint32_t ctx) · line 307

Quoted 8 lines
lib/igt_gt.c +3 -0
  	if ((arg.flags & HANG_ALLOW_CAPTURE) == 0) {
@@ -290,6 +302,9 @@ static bool has_ctx_exec(int fd, unsigned ring, uint32_t ctx)
  static igt_hang_t __igt_hang_ctx(int fd, uint64_t ahnd, uint32_t ctx, int ring,
  				 unsigned flags)
  {
+	if (is_xe_device(fd))
+		return xe_hang_engine(fd, ahnd, ctx, ring, flags);
+

Move this after var declatarions.

One more thing: with your change the doc of __igt_hang_ctx is no longer valid. Please delete i915 reference in the doc, as now fd can be both i915 and xe. You can also fix already existing typo: @ctx: the contxt -> context

Quoted 8 lines
Quoted 8 lines
lib/igt_gt.c +0 -0
  	struct drm_i915_gem_context_param param;
  	igt_spin_t *spin;
  	unsigned ban;
@@ -372,6 +387,12 @@ void igt_post_hang_ring(int fd, igt_hang_t arg)
  	if (!arg.spin)
  		return;
 
Quoted 5 lines

lib/igt_gt.c void igt_post_hang_ring(int fd, igt_hang_t arg) · line 392

Quoted 3 lines
lib/igt_gt.c +3 -0
+	if (is_xe_device(fd)) {
+		igt_spin_free(fd, arg.spin);
+		xe_post_hang_ring(fd, arg);

It looks like spinner is not used here?

Please update the doc also for igt_post_hang_ring - @fd.

Quoted 30 lines
Quoted 12 lines
lib/igt_gt.c +3 -0
+		return;
+	}
+
  	gem_sync(fd, arg.spin->handle); /* Wait until it hangs */
  	igt_spin_free(fd, arg.spin);
 
lib/xe/xe_ioctl.c +0 -0
index 488aa218e..5ec85239a 100644

lib/xe/xe_ioctl.c void xe_force_gt_reset(int fd, int gt) · line 529

Quoted 10 lines
lib/xe/xe_ioctl.c +7 -0
@@ -520,6 +520,26 @@ void xe_force_gt_reset(int fd, int gt)
  	system(reset_string);
  }
 
+
+igt_hang_t xe_hang_engine(int fd, uint64_t ahnd, uint32_t ctx, int ring,
+				unsigned flags)
+{
+	uint32_t vm;
+	unsigned int engine;
+	igt_spin_t *spin_t;

Add newline.

lib/xe/xe_ioctl.c void xe_force_gt_reset(int fd, int gt) · line 531

Quoted 2 lines
lib/xe/xe_ioctl.c +2 -0
+	vm = xe_vm_create(fd, 0, 0);
+	engine = xe_engine_create_class(fd, vm, DRM_XE_ENGINE_CLASS_COPY);

----------------------------------------------- ^
Only one engine class here?

Quoted 8 lines

lib/xe/xe_ioctl.c void xe_force_gt_reset(int fd, int gt) · line 533

Quoted 2 lines
lib/xe/xe_ioctl.c +2 -0
+
+	spin_t = igt_spin_new(fd, .ahnd = ahnd, .engine = engine, .vm = vm, .flags = IGT_SPIN_NO_PREEMPTION);

Add newline.

lib/xe/xe_ioctl.c void xe_force_gt_reset(int fd, int gt) · line 534

Quoted 1 line
lib/xe/xe_ioctl.c +1 -0
+	return (igt_hang_t){ spin_t, engine, 0, flags };

Unused ring var?

Ctx also seems to be unused.

Quoted 43 lines
Quoted 17 lines
lib/xe/xe_ioctl.c +8 -0
+}
+
+void xe_post_hang_ring(int fd, igt_hang_t arg)
+{
+	xe_engine_destroy(fd, arg.ctx);
+	xe_vm_destroy(fd, arg.spin->vm);
+}
+
  void xe_vm_madvise(int fd, uint32_t vm, uint64_t addr, uint64_t size,
  		   uint32_t property, uint32_t value)
  {
lib/xe/xe_ioctl.h +0 -0
index 5a528b345..0e9708194 100644

lib/xe/xe_ioctl.h line 20

Quoted 6 lines
lib/xe/xe_ioctl.h +3 -0
@@ -15,6 +15,9 @@
  #include <stdint.h>
  #include <xe_drm.h>
 
+#include "lib/igt_gt.h"
+#include "xe_spin.h"
+

Are you using new ioctl? If not maybe add xe_hang and xe_post_hang to other library? Or create new one?

Regards,
Kamil

Quoted 13 lines
lib/xe/xe_ioctl.h +3 -0
  uint32_t xe_cs_prefetch_size(int fd);
  uint32_t xe_vm_create(int fd, uint32_t flags, uint64_t ext);
  int  __xe_vm_bind(int fd, uint32_t vm, uint32_t engine, uint32_t bo,
@@ -89,6 +92,9 @@ int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value,
  void xe_force_gt_reset(int fd, int gt);
  void xe_force_gt_reset_all(int fd);
  bool has_xe_gt_reset(int fd);
+igt_hang_t xe_hang_engine(int fd, uint64_t ahnd, uint32_t ctx, int ring,
+				unsigned flags);
+void xe_post_hang_ring(int fd, igt_hang_t arg);
  void xe_vm_madvise(int fd, uint32_t vm, uint64_t addr, uint64_t size,
  		   uint32_t property, uint32_t value);
 
Quoted 3 lines
Quoted 3 lines
Signature · 1 line
2.25.1

As with previous patch, please remember to check it with checkpatch.pl before sending v2.

Ania

#7 lore raw

Re: [igt-dev] [PATCH i-g-t 2/2] lib/xe: Add hang library support

Quoted 79 lines

-----Original Message-----
From: Karas, Anna <[email protected]>
Sent: 27 July 2023 02:15
To: [email protected]
Cc: Kamil Konieczny <[email protected]>; Kumar, Janga Rahul <[email protected]>; Gandi, Ramadevi <[email protected]>; Ch, Sai Gowtham <[email protected]>; Joshi, Kunal1 <[email protected]>
Subject: Re: [igt-dev] [PATCH i-g-t 2/2] lib/xe: Add hang library support

Hi all,

Quoted 26 lines · Kamil Konieczny

Hi Janga,

Quoted 9 lines · On 2023-07-25 at 12:46:22 +0530, [email protected] wrote:

From: Janga Rahul Kumar <[email protected]>

Add hang library support using spinners.

Cc Sai Gowtham Ch <[email protected]>
Cc Kunal Joshi <[email protected]>
---
  lib/igt_gt.c      | 21 +++++++++++++++++++++

------ ^^^^^^
Move this change into separate patch.

Quoted 11 lines
  lib/xe/xe_ioctl.c | 20 ++++++++++++++++++++
  lib/xe/xe_ioctl.h |  6 ++++++
  3 files changed, 47 insertions(+)
lib/igt_gt.c index 2ce464ba6..6821179ca renamed from lib/igt_gt.c +0 -0

100644

lib/igt_gt.c +0 -0
@@ -170,6 +170,15 @@ static void context_set_ban(int fd, unsigned
 ctx, unsigned ban)
 
Quoted 5 lines

lib/igt_gt.c static void context_set_ban(int fd, unsigned ctx, unsigned ban)

Quoted 5 lines
lib/igt_gt.c +3 -0
  igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)
  {
+	if (is_xe_device(fd)) {
+		if (!igt_check_boolean_env_var("IGT_HANG", true))
+			igt_skip("hang injection disabled by user

[IGT_HANG=0]\n");

Quoted 22 lines

lib/igt_gt.c static void context_set_ban(int fd, unsigned ctx, unsigned ban) · line 181

Quoted 6 lines
lib/igt_gt.c +6 -0
+
+		igt_require(has_gpu_reset(fd));
+
+		return (struct igt_hang){ 0, ctx, 0, flags };
+       }
+

Move code after declarations of vars.

Quoted 13 lines
lib/igt_gt.c +0 -0
  	struct drm_i915_gem_context_param param = {
  		.ctx_id = ctx,
  	};
lib/igt_gt.c +3 -0
@@ -219,6 +228,9 @@ igt_hang_t igt_allow_hang(int fd, unsigned ctx,
 unsigned flags)
 
  void igt_disallow_hang(int fd, igt_hang_t arg)
  {
+	if (is_xe_device(fd))
+		return;
+
  	context_set_ban(fd, arg.ctx, arg.ban);
 
Quoted 10 lines

lib/igt_gt.c static bool has_ctx_exec(int fd, unsigned ring, uint32_t ctx) · line 307

Quoted 8 lines

if ((arg.flags & HANG_ALLOW_CAPTURE) == 0) { @@ -290,6 +302,9 @@
static bool has_ctx_exec(int fd, unsigned ring, uint32_t ctx)
static igt_hang_t __igt_hang_ctx(int fd, uint64_t ahnd, uint32_t ctx, int ring,
unsigned flags)
{

lib/igt_gt.c +3 -0
+	if (is_xe_device(fd))
+		return xe_hang_engine(fd, ahnd, ctx, ring, flags);
+

Move this after var declatarions.

Quoted 4 lines

One more thing: with your change the doc of __igt_hang_ctx is no longer valid. Please delete i915 reference in the doc, as now fd can be both i915 and xe.
You can also fix already existing typo: @ctx: the contxt -> context

Done.

Quoted 41 lines
Quoted 9 lines
Quoted 9 lines

struct drm_i915_gem_context_param param;
igt_spin_t *spin;
unsigned ban;

lib/igt_gt.c +0 -0
@@ -372,6 +387,12 @@ void igt_post_hang_ring(int fd, igt_hang_t arg)
  	if (!arg.spin)
  		return;
 
Quoted 5 lines

lib/igt_gt.c void igt_post_hang_ring(int fd, igt_hang_t arg) · line 392

Quoted 3 lines
lib/igt_gt.c +3 -0
+	if (is_xe_device(fd)) {
+		igt_spin_free(fd, arg.spin);
+		xe_post_hang_ring(fd, arg);

It looks like spinner is not used here?

Please update the doc also for igt_post_hang_ring - @fd.

Quoted 25 lines
Quoted 12 lines
lib/igt_gt.c +3 -0
+		return;
+	}
+
  	gem_sync(fd, arg.spin->handle); /* Wait until it hangs */
  	igt_spin_free(fd, arg.spin);
 
lib/xe/xe_ioctl.c index renamed from lib/xe/xe_ioctl.c +0 -0

488aa218e..5ec85239a 100644

lib/xe/xe_ioctl.c void xe_force_gt_reset(int fd, int gt) · line 529

Quoted 10 lines
lib/xe/xe_ioctl.c +7 -0
@@ -520,6 +520,26 @@ void xe_force_gt_reset(int fd, int gt)
  	system(reset_string);
  }
 
+
+igt_hang_t xe_hang_engine(int fd, uint64_t ahnd, uint32_t ctx, int ring,
+				unsigned flags)
+{
+	uint32_t vm;
+	unsigned int engine;
+	igt_spin_t *spin_t;

Add newline.

Quoted 5 lines
Quoted 2 lines

lib/xe/xe_ioctl.c void xe_force_gt_reset(int fd, int gt) · line 531

Quoted 2 lines
lib/xe/xe_ioctl.c +2 -0
+	vm = xe_vm_create(fd, 0, 0);
+	engine = xe_engine_create_class(fd, vm,

DRM_XE_ENGINE_CLASS_COPY);

Quoted 2 lines

----------------------------------------------- ^ Only one engine class here?

Updated it in v2

Quoted 11 lines
Quoted 10 lines

lib/xe/xe_ioctl.c void xe_force_gt_reset(int fd, int gt) · line 534

Quoted 4 lines
lib/xe/xe_ioctl.c +3 -0
+
+	spin_t = igt_spin_new(fd, .ahnd = ahnd, .engine = engine, .vm = vm,
+.flags = IGT_SPIN_NO_PREEMPTION);

Add newline.

lib/xe/xe_ioctl.c void xe_force_gt_reset(int fd, int gt) · line 534

Quoted 1 line
lib/xe/xe_ioctl.c +1 -0
+	return (igt_hang_t){ spin_t, engine, 0, flags };

Unused ring var?

Ctx also seems to be unused.

In Xe, we need to create engine(exec_queue) hence not used here.

Thanks,
Rahul

Quoted 52 lines
Quoted 27 lines
Quoted 17 lines
lib/xe/xe_ioctl.c +7 -0
+}
+
+void xe_post_hang_ring(int fd, igt_hang_t arg) {
+	xe_engine_destroy(fd, arg.ctx);
+	xe_vm_destroy(fd, arg.spin->vm);
+}
+
  void xe_vm_madvise(int fd, uint32_t vm, uint64_t addr, uint64_t size,
  		   uint32_t property, uint32_t value)
  {
lib/xe/xe_ioctl.h index renamed from lib/xe/xe_ioctl.h +0 -0

5a528b345..0e9708194 100644

lib/xe/xe_ioctl.h line 20

Quoted 6 lines
lib/xe/xe_ioctl.h +3 -0
@@ -15,6 +15,9 @@
  #include <stdint.h>
  #include <xe_drm.h>
 
+#include "lib/igt_gt.h"
+#include "xe_spin.h"
+

Are you using new ioctl? If not maybe add xe_hang and xe_post_hang to other library? Or create new one?

Quoted 7 lines

Regards,
Kamil

Quoted 4 lines
lib/xe/xe_ioctl.h +0 -0
  uint32_t xe_cs_prefetch_size(int fd);
  uint32_t xe_vm_create(int fd, uint32_t flags, uint64_t ext);
  int  __xe_vm_bind(int fd, uint32_t vm, uint32_t engine, uint32_t

bo, @@ -89,6 +92,9 @@ int64_t xe_wait_ufence_abstime(int fd, uint64_t

*addr, uint64_t value,

Quoted 9 lines
Quoted 9 lines
  void xe_force_gt_reset(int fd, int gt);
  void xe_force_gt_reset_all(int fd);
  bool has_xe_gt_reset(int fd);
lib/xe/xe_ioctl.h +3 -0
+igt_hang_t xe_hang_engine(int fd, uint64_t ahnd, uint32_t ctx, int ring,
+				unsigned flags);
+void xe_post_hang_ring(int fd, igt_hang_t arg);
  void xe_vm_madvise(int fd, uint32_t vm, uint64_t addr, uint64_t size,
  		   uint32_t property, uint32_t value);
Quoted 3 lines
Quoted 3 lines

--
2.25.1

As with previous patch, please remember to check it with checkpatch.pl before sending v2.

Ania

#8 lore raw

Re: [igt-dev] [PATCH i-g-t 2/2] lib/xe: Add hang library support

In reply to Kamil Konieczny
Quoted 81 lines

-----Original Message-----
From: Kamil Konieczny <[email protected]>
Sent: 25 July 2023 23:34
To: [email protected]
Cc: Kumar, Janga Rahul <[email protected]>; Gandi, Ramadevi <[email protected]>; Ch, Sai Gowtham <[email protected]>; Joshi, Kunal1 <[email protected]>
Subject: Re: [igt-dev] [PATCH i-g-t 2/2] lib/xe: Add hang library support

Hi Janga,

Quoted 9 lines · On 2023-07-25 at 12:46:22 +0530, [email protected] wrote:

From: Janga Rahul Kumar <[email protected]>

Add hang library support using spinners.

Cc Sai Gowtham Ch <[email protected]>
Cc Kunal Joshi <[email protected]>
---
 lib/igt_gt.c      | 21 +++++++++++++++++++++

------ ^^^^^^
Move this change into separate patch.

Quoted 9 lines
 lib/xe/xe_ioctl.c | 20 ++++++++++++++++++++  lib/xe/xe_ioctl.h |  6
++++++
 3 files changed, 47 insertions(+)
lib/igt_gt.c index 2ce464ba6..6821179ca renamed from lib/igt_gt.c +0 -0

100644

lib/igt_gt.c static void context_set_ban(int fd, unsigned ctx, · line 175

Quoted 6 lines
lib/igt_gt.c +3 -0
@@ -170,6 +170,15 @@ static void context_set_ban(int fd, unsigned ctx,
 unsigned ban)
 
 igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)  {
+	if (is_xe_device(fd)) {
+		if (!igt_check_boolean_env_var("IGT_HANG", true))
+			igt_skip("hang injection disabled by user

[IGT_HANG=0]\n");

lib/igt_gt.c static void context_set_ban(int fd, unsigned ctx, unsigned ban) · line 181

Quoted 6 lines
lib/igt_gt.c +6 -0
+
+		igt_require(has_gpu_reset(fd));
+
+		return (struct igt_hang){ 0, ctx, 0, flags };
+       }
+

Move code after declarations of vars.

Quoted 15 lines
lib/igt_gt.c +3 -0
 	struct drm_i915_gem_context_param param = {
 		.ctx_id = ctx,
 	};
@@ -219,6 +228,9 @@ igt_hang_t igt_allow_hang(int fd, unsigned ctx,
 unsigned flags)
 
 void igt_disallow_hang(int fd, igt_hang_t arg)  {
+	if (is_xe_device(fd))
+		return;
+
 	context_set_ban(fd, arg.ctx, arg.ban);
 
 	if ((arg.flags & HANG_ALLOW_CAPTURE) == 0) { @@ -290,6 +302,9 @@

static bool has_ctx_exec(int fd, unsigned ring, uint32_t ctx) static igt_hang_t __igt_hang_ctx(int fd, uint64_t ahnd, uint32_t ctx, int ring,

lib/igt_gt.c static bool has_ctx_exec(int fd, unsigned ring, uint32_t ctx) · line 307

Quoted 5 lines
lib/igt_gt.c +3 -0
 				 unsigned flags)
 {
+	if (is_xe_device(fd))
+		return xe_hang_engine(fd, ahnd, ctx, ring, flags);
+

Move this after var declatarions.

Quoted 7 lines
lib/igt_gt.c +0 -0
 	struct drm_i915_gem_context_param param;
 	igt_spin_t *spin;
 	unsigned ban;
@@ -372,6 +387,12 @@ void igt_post_hang_ring(int fd, igt_hang_t arg)
 	if (!arg.spin)
 		return;
 
Quoted 5 lines

lib/igt_gt.c void igt_post_hang_ring(int fd, igt_hang_t arg) · line 392

Quoted 3 lines
lib/igt_gt.c +3 -0
+	if (is_xe_device(fd)) {
+		igt_spin_free(fd, arg.spin);
+		xe_post_hang_ring(fd, arg);

It looks like spinner is not used here?

In post hang, we free the spinner.

Quoted 36 lines
Quoted 12 lines
lib/igt_gt.c +3 -0
+		return;
+	}
+
 	gem_sync(fd, arg.spin->handle); /* Wait until it hangs */
 	igt_spin_free(fd, arg.spin);
 
lib/xe/xe_ioctl.c index renamed from lib/xe/xe_ioctl.c +0 -0

488aa218e..5ec85239a 100644

lib/xe/xe_ioctl.c void xe_force_gt_reset(int fd, int gt) · line 529

Quoted 10 lines
lib/xe/xe_ioctl.c +7 -0
@@ -520,6 +520,26 @@ void xe_force_gt_reset(int fd, int gt)
 	system(reset_string);
 }
 
+
+igt_hang_t xe_hang_engine(int fd, uint64_t ahnd, uint32_t ctx, int ring,
+				unsigned flags)
+{
+	uint32_t vm;
+	unsigned int engine;
+	igt_spin_t *spin_t;

Add newline.

lib/xe/xe_ioctl.c void xe_force_gt_reset(int fd, int gt) · line 531

Quoted 2 lines
lib/xe/xe_ioctl.c +2 -0
+	vm = xe_vm_create(fd, 0, 0);
+	engine = xe_engine_create_class(fd, vm,

DRM_XE_ENGINE_CLASS_COPY); ----------------------------------------------- ^ Only one engine class here?

lib/xe/xe_ioctl.c void xe_force_gt_reset(int fd, int gt) · line 534

Quoted 3 lines
lib/xe/xe_ioctl.c +3 -0
+
+	spin_t = igt_spin_new(fd, .ahnd = ahnd, .engine = engine, .vm = vm,
+.flags = IGT_SPIN_NO_PREEMPTION);

Add newline.

Quoted 3 lines

lib/xe/xe_ioctl.c void xe_force_gt_reset(int fd, int gt) · line 534

Quoted 1 line
lib/xe/xe_ioctl.c +1 -0
+	return (igt_hang_t){ spin_t, engine, 0, flags };

Unused ring var?

Updated it in v2.

Quoted 18 lines
Quoted 18 lines
lib/xe/xe_ioctl.c +7 -0
+}
+
+void xe_post_hang_ring(int fd, igt_hang_t arg) {
+	xe_engine_destroy(fd, arg.ctx);
+	xe_vm_destroy(fd, arg.spin->vm);
+}
+
 void xe_vm_madvise(int fd, uint32_t vm, uint64_t addr, uint64_t size,
 		   uint32_t property, uint32_t value)  { diff --git

a/lib/xe/xe_ioctl.h b/lib/xe/xe_ioctl.h index 5a528b345..0e9708194 100644

lib/xe/xe_ioctl.h +0 -0
@@ -15,6 +15,9 @@
 #include <stdint.h>
 #include <xe_drm.h>
 
Quoted 6 lines

lib/xe/xe_ioctl.h line 20

Quoted 3 lines
lib/xe/xe_ioctl.h +3 -0
+#include "lib/igt_gt.h"
+#include "xe_spin.h"
+

Are you using new ioctl? If not maybe add xe_hang and xe_post_hang to other library? Or create new one?

Introduced xe_gt library and moved hang and rest helpers of xe into it.

Quoted 19 lines

Regards,
Kamil

Quoted 15 lines
lib/xe/xe_ioctl.h +0 -0
 uint32_t xe_cs_prefetch_size(int fd);  uint32_t xe_vm_create(int fd,
 uint32_t flags, uint64_t ext);  int  __xe_vm_bind(int fd, uint32_t vm,

uint32_t engine, uint32_t bo, @@ -89,6 +92,9 @@ int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value, void xe_force_gt_reset(int fd, int gt); void xe_force_gt_reset_all(int fd); bool has_xe_gt_reset(int fd);

lib/xe/xe_ioctl.h +3 -1
+igt_hang_t xe_hang_engine(int fd, uint64_t ahnd, uint32_t ctx, int ring,
+				unsigned flags);
+void xe_post_hang_ring(int fd, igt_hang_t arg);
 void xe_vm_madvise(int fd, uint32_t vm, uint64_t addr, uint64_t size,
 		   uint32_t property, uint32_t value);
 
--

2.25.1

#9 lore raw

[igt-dev] ✗ Fi.CI.BAT: failure for Add Xe lib support for hang & GT reset

In reply to [email protected]
== Series Details ==

== Series Details ==

Series: Add Xe lib support for hang & GT reset
URL : https://patchwork.freedesktop.org/series/121292/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_13418 -> IGTPW_9455
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with IGTPW_9455 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_9455, 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_9455/index.html

Participating hosts (41 -> 43)
------------------------------

Additional (2): fi-kbl-soraka fi-rkl-11600

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

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

### IGT changes ###

#### Possible regressions ####

* igt@debugfs_test@basic-hwmon:
- fi-kbl-soraka: NOTRUN -> [INCOMPLETE][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/fi-kbl-soraka/igt@[email protected]

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

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

### IGT changes ###

#### Issues hit ####

* igt@debugfs_test@basic-hwmon:
- fi-rkl-11600: NOTRUN -> [SKIP][2] ([i915#7456])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/fi-rkl-11600/igt@[email protected]

* igt@gem_huc_copy@huc-copy:
- fi-kbl-soraka: NOTRUN -> [SKIP][3] ([fdo#109271] / [i915#2190])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/fi-kbl-soraka/igt@[email protected]
- fi-rkl-11600: NOTRUN -> [SKIP][4] ([i915#2190])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/fi-rkl-11600/igt@[email protected]

* igt@gem_lmem_swapping@basic:
- fi-kbl-soraka: NOTRUN -> [SKIP][5] ([fdo#109271] / [i915#4613]) +3 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/fi-kbl-soraka/igt@[email protected]
- fi-rkl-11600: NOTRUN -> [SKIP][6] ([i915#4613]) +3 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/fi-rkl-11600/igt@[email protected]

* igt@gem_tiled_pread_basic:
- fi-rkl-11600: NOTRUN -> [SKIP][7] ([i915#3282])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/fi-rkl-11600/igt@gem_tiled_pread_basic.html

* igt@i915_pm_backlight@basic-brightness:
- fi-rkl-11600: NOTRUN -> [SKIP][8] ([i915#7561])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/fi-rkl-11600/igt@[email protected]

* igt@i915_pm_rpm@basic-pci-d3-state:
- fi-cfl-8109u: [PASS][9] -> [FAIL][10] ([i915#7940])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13418/fi-cfl-8109u/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/fi-cfl-8109u/igt@[email protected]

* igt@i915_pm_rpm@basic-rte:
- fi-cfl-guc: [PASS][11] -> [FAIL][12] ([i915#7940])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13418/fi-cfl-guc/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/fi-cfl-guc/igt@[email protected]

* igt@i915_selftest@live@gt_mocs:
- bat-mtlp-6: [PASS][13] -> [DMESG-FAIL][14] ([i915#7059])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13418/bat-mtlp-6/igt@i915_selftest@live@gt_mocs.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/bat-mtlp-6/igt@i915_selftest@live@gt_mocs.html

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

* igt@i915_selftest@live@reset:
- bat-rpls-1: [PASS][16] -> [ABORT][17] ([i915#4983] / [i915#7461] / [i915#8347] / [i915#8384])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13418/bat-rpls-1/igt@i915_selftest@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/bat-rpls-1/igt@i915_selftest@[email protected]
- bat-rpls-2: NOTRUN -> [ABORT][18] ([i915#4983] / [i915#7461] / [i915#7913] / [i915#8347])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/bat-rpls-2/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@slpc:
- bat-mtlp-6: [PASS][19] -> [DMESG-WARN][20] ([i915#6367])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13418/bat-mtlp-6/igt@i915_selftest@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/bat-mtlp-6/igt@i915_selftest@[email protected]

* igt@kms_chamelium_hpd@common-hpd-after-suspend:
- bat-dg2-11: NOTRUN -> [SKIP][21] ([i915#7828])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/bat-dg2-11/igt@[email protected]

* igt@kms_chamelium_hpd@dp-hpd-fast:
- fi-rkl-11600: NOTRUN -> [SKIP][22] ([i915#7828]) +8 similar issues
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/fi-rkl-11600/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
- fi-kbl-soraka: NOTRUN -> [SKIP][23] ([fdo#109271]) +14 similar issues
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/fi-kbl-soraka/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
- fi-rkl-11600: NOTRUN -> [SKIP][24] ([i915#4103]) +1 similar issue
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/fi-rkl-11600/igt@[email protected]

* igt@kms_force_connector_basic@force-load-detect:
- fi-rkl-11600: NOTRUN -> [SKIP][25] ([fdo#109285] / [i915#4098])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/fi-rkl-11600/igt@[email protected]

* igt@kms_pipe_crc_basic@read-crc-frame-sequence@pipe-d-edp-1:
- bat-rplp-1: [PASS][26] -> [ABORT][27] ([i915#8442] / [i915#8668])
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13418/bat-rplp-1/igt@kms_pipe_crc_basic@[email protected]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/bat-rplp-1/igt@kms_pipe_crc_basic@[email protected]

* igt@kms_psr@primary_page_flip:
- fi-rkl-11600: NOTRUN -> [SKIP][28] ([i915#1072]) +3 similar issues
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/fi-rkl-11600/igt@kms_psr@primary_page_flip.html

* igt@kms_setmode@basic-clone-single-crtc:
- fi-rkl-11600: NOTRUN -> [SKIP][29] ([i915#3555] / [i915#4098])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/fi-rkl-11600/igt@[email protected]

* igt@prime_vgem@basic-read:
- fi-rkl-11600: NOTRUN -> [SKIP][30] ([fdo#109295] / [i915#3291] / [i915#3708]) +2 similar issues
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/fi-rkl-11600/igt@[email protected]

#### Possible fixes ####

* igt@i915_selftest@live@gt_lrc:
- bat-dg2-11: [INCOMPLETE][31] ([i915#7609] / [i915#7913]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13418/bat-dg2-11/igt@i915_selftest@live@gt_lrc.html
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/bat-dg2-11/igt@i915_selftest@live@gt_lrc.html

* igt@i915_selftest@live@requests:
- bat-rpls-2: [ABORT][33] ([i915#4983] / [i915#7913]) -> [PASS][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13418/bat-rpls-2/igt@i915_selftest@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/bat-rpls-2/igt@i915_selftest@[email protected]

#### Warnings ####

* igt@i915_selftest@live@requests:
- bat-mtlp-8: [DMESG-FAIL][35] ([i915#8497]) -> [ABORT][36] ([i915#7982])
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13418/bat-mtlp-8/igt@i915_selftest@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/bat-mtlp-8/igt@i915_selftest@[email protected]

{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#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
[i915#7059]: https://gitlab.freedesktop.org/drm/intel/issues/7059
[i915#7456]: https://gitlab.freedesktop.org/drm/intel/issues/7456
[i915#7461]: https://gitlab.freedesktop.org/drm/intel/issues/7461
[i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
[i915#7609]: https://gitlab.freedesktop.org/drm/intel/issues/7609
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
[i915#7940]: https://gitlab.freedesktop.org/drm/intel/issues/7940
[i915#7982]: https://gitlab.freedesktop.org/drm/intel/issues/7982
[i915#8347]: https://gitlab.freedesktop.org/drm/intel/issues/8347
[i915#8384]: https://gitlab.freedesktop.org/drm/intel/issues/8384
[i915#8442]: https://gitlab.freedesktop.org/drm/intel/issues/8442
[i915#8497]: https://gitlab.freedesktop.org/drm/intel/issues/8497
[i915#8668]: https://gitlab.freedesktop.org/drm/intel/issues/8668

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

* CI: CI-20190529 -> None
* IGT: IGT_7401 -> IGTPW_9455

CI-20190529: 20190529
CI_DRM_13418: e31a5b300385ef52e6db1cda820518cb2da089ca @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_9455: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9455/index.html
IGT_7401: 0c66a6560eda687effa9088659577a520d913908 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

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

-igt@syncobj_sync_file@binary-import-export
-igt@syncobj_sync_file@invalid-fd-import
-igt@syncobj_sync_file@invalid-handle-export
-igt@syncobj_sync_file@invalid-handle-import
-igt@syncobj_sync_file@timeline-import-export
-igt@syncobj_sync_file@unsubmitted-export

== Logs ==

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