[igt-dev] [PATCH i-g-t 3/3] lib/igt_gt: Extend hang library support to XE

Ch, Sai Gowtham sai.gowtham.ch at intel.com
Thu Aug 10 12:58:51 UTC 2023



>-----Original Message-----
>From: Kumar, Janga Rahul <janga.rahul.kumar at intel.com>
>Sent: Monday, August 7, 2023 9:28 AM
>To: igt-dev at lists.freedesktop.org; Gandi, Ramadevi
><ramadevi.gandi at intel.com>; Kumar, Janga Rahul
><janga.rahul.kumar at intel.com>
>Cc: Ch, Sai Gowtham <sai.gowtham.ch at intel.com>; Joshi, Kunal1
><kunal1.joshi at intel.com>; kamil.konieczny at linux.intel.com; Karas, Anna
><anna.karas at intel.com>
>Subject: [PATCH i-g-t 3/3] lib/igt_gt: Extend hang library support to XE
>
>From: Janga Rahul Kumar <janga.rahul.kumar at intel.com>
>
>Extend hang library support to XE driver and update the documentation.
>
>Cc: Sai Gowtham Ch <sai.gowtham.ch at intel.com>
>Cc: Kunal Joshi <kunal1.joshi at intel.com>
>Cc: Kamil Konieczny <kamil.konieczny at linux.intel.com>
>Cc: Anna Karas <anna.karas at intel.com>
>Signed-off-by: Janga Rahul Kumar <janga.rahul.kumar at intel.com>
>Tested-by: Kunal Joshi <kunal1.joshi at intel.com>
>---
> lib/igt_gt.c | 26 ++++++++++++++++++++++----
> 1 file changed, 22 insertions(+), 4 deletions(-)
>

You Might have missed extending igt_force_gpu_reset() to your change xe_force_gt_reset_all, 
Rest looks good to me.
Reviewed-by: Sai Gowtham Ch <sai.gowtham.ch at intel.com>

>diff --git a/lib/igt_gt.c b/lib/igt_gt.c index d4a825e66..245984f7f 100644
>--- a/lib/igt_gt.c
>+++ b/lib/igt_gt.c
>@@ -44,6 +44,7 @@
> #include "intel_reg.h"
> #include "intel_chipset.h"
> #include "igt_dummyload.h"
>+#include "xe/xe_gt.h"
>
> /**
>  * SECTION:igt_gt
>@@ -179,6 +180,12 @@ igt_hang_t igt_allow_hang(int fd, unsigned ctx,
>unsigned flags)
> 	 */
> 	if (!igt_check_boolean_env_var("IGT_HANG", true))
> 		igt_skip("hang injection disabled by user [IGT_HANG=0]\n");
>+
>+	if (is_xe_device(fd)) {
>+		igt_require(has_gpu_reset(fd));
>+		return (struct igt_hang){ 0, ctx, 0, flags };
>+	}
>+
> 	gem_context_require_bannable(fd);
>
> 	if (flags & HANG_WANT_ENGINE_RESET)
>@@ -215,6 +222,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) { @@ -269,8 +279,8 @@
>static bool has_ctx_exec(int fd, unsigned ring, uint32_t ctx)
>
> /**
>  * igt_hang_ring_ctx:
>- * @fd: open i915 drm file descriptor
>- * @ctx: the contxt specifier
>+ * @fd: open i915/xe drm file descriptor
>+ * @ctx: the context specifier
>  * @ring: execbuf ring flag
>  * @flags: set of flags to control execution
>  * @offset: The resultant gtt offset of the exec obj @@ -290,6 +300,9 @@
>static igt_hang_t __igt_hang_ctx(int fd, uint64_t ahnd, uint32_t ctx, int ring,
> 	igt_spin_t *spin;
> 	unsigned ban;
>
>+	if (is_xe_device(fd))
>+		return xe_hang_ring(fd, ahnd, ctx, ring, flags);
>+
> 	igt_require_hang_ring(fd, ctx, ring);
>
> 	/* check if non-default ctx submission is allowed */ @@ -334,7 +347,7
>@@ igt_hang_t igt_hang_ctx_with_ahnd(int fd, uint64_t ahnd, uint32_t ctx,
>int ring,
>
> /**
>  * igt_hang_ring:
>- * @fd: open i915 drm file descriptor
>+ * @fd: open i915/xe drm file descriptor
>  * @ring: execbuf ring flag
>  *
>  * This helper function injects a hanging batch into @ring. It returns a @@ -
>357,7 +370,7 @@ igt_hang_t igt_hang_ring_with_ahnd(int fd, int ring,
>uint64_t ahnd)
>
> /**
>  * igt_post_hang_ring:
>- * @fd: open i915 drm file descriptor
>+ * @fd: open i915/xe drm file descriptor
>  * @arg: hang state from igt_hang_ring()
>  *
>  * This function does the necessary post-processing after a gpu hang injected
>@@ -368,6 +381,11 @@ 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);
>+	}
>+
> 	gem_sync(fd, arg.spin->handle); /* Wait until it hangs */
> 	igt_spin_free(fd, arg.spin);
>
>--
>2.25.1



More information about the igt-dev mailing list