Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cavitt <jonathan.cavitt@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: jonathan.cavitt@intel.com, saurabhg.gupta@intel.com,
	alex.zuo@intel.com, zbigniew.kempczynski@intel.com,
	pravalika.gurram@intel.com
Subject: [PATCH] tests/intel/xe_drm_fdinfo: Do not destroy NULL xe_cork
Date: Wed, 18 Dec 2024 16:08:08 +0000	[thread overview]
Message-ID: <20241218160808.65340-1-jonathan.cavitt@intel.com> (raw)

Several xe_cork functionalities were recently unified into the xe_spin
library.  During this process, it was asserted that we always pass a
valid cork to the various xe_cork helper functions (namely,
xe_cork_sync_start, xe_cork_sync_end, and xe_cork_destroy).

While this assertion should normally hold, in xe_drm_fdinfo
specifically, some subtests declare the existence of an xe_cork but
bypass its initialization through xe_cork_create because the cork is
otherwise unused.  However, the cork itself is unconditionally destroyed
at the end of the tests, as prior to the unification under xe_spin,
passing a NULL pointer to the destroy function (previously
spin_ctx_destroy) would simply exit the function early.  Unfortunately,
passing a NULL pointer to the destroy function now (xe_cork_destory)
hits the new assertion, resulting in an error.

Do not run xe_cork_destroy on a NULL pointer if a NULL pointer is
expected in the subtest.

Fixes: 2feb1d6718a ("lib/xe/xe_spin: move the spinner related functions to lib")
Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/3869
Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
CC: Pravalika Gurram <pravalika.gurram@intel.com>
CC: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
---
 tests/intel/xe_drm_fdinfo.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/intel/xe_drm_fdinfo.c b/tests/intel/xe_drm_fdinfo.c
index 66a181d5ba..e83c55c646 100644
--- a/tests/intel/xe_drm_fdinfo.c
+++ b/tests/intel/xe_drm_fdinfo.c
@@ -447,7 +447,9 @@ utilization_single(int fd, struct drm_xe_engine_class_instance *hwe, unsigned in
 		close(new_fd);
 	}
 
-	xe_cork_destroy(fd, ctx);
+	if (flags & TEST_BUSY)
+		xe_cork_destroy(fd, ctx);
+
 	xe_vm_destroy(fd, vm);
 }
 
@@ -663,7 +665,8 @@ utilization_multi(int fd, int gt, int class, unsigned int flags)
 		close(fd_spill);
 	}
 
-	xe_cork_destroy(fd, ctx);
+	if (flags & TEST_BUSY)
+		xe_cork_destroy(fd, ctx);
 
 	xe_vm_destroy(fd, vm);
 }
-- 
2.43.0


             reply	other threads:[~2024-12-18 16:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18 16:08 Jonathan Cavitt [this message]
2024-12-18 23:29 ` ✗ i915.CI.BAT: failure for tests/intel/xe_drm_fdinfo: Do not destroy NULL xe_cork Patchwork
2024-12-20 16:22   ` Kamil Konieczny
2024-12-19  1:30 ` ✓ Xe.CI.BAT: success " Patchwork
2024-12-19  4:21 ` [PATCH] " Zbigniew Kempczyński
2024-12-19 19:16 ` ✗ Xe.CI.Full: failure for " Patchwork
2024-12-20 16:21   ` Kamil Konieczny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241218160808.65340-1-jonathan.cavitt@intel.com \
    --to=jonathan.cavitt@intel.com \
    --cc=alex.zuo@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=pravalika.gurram@intel.com \
    --cc=saurabhg.gupta@intel.com \
    --cc=zbigniew.kempczynski@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox