Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Senna Tschudin <peter.senna@linux.intel.com>
To: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	ashutosh.dixit@intel.com
Subject: [PATCH i-g-t] Do not require QUERY_OA_UNITS for all Xe tests
Date: Thu, 25 Jul 2024 11:36:37 +0200	[thread overview]
Message-ID: <f79e0043-2a5b-4b35-8533-86b3d6b08b84@linux.intel.com> (raw)

From 493a989dd9ba79a0daa9e88311b1128ef470a9fe Mon Sep 17 00:00:00 2001
From: Peter Senna Tschudin <peter.senna@intel.com>
Date: Thu, 25 Jul 2024 08:24:00 +0200
Subject: [PATCH i-g-t] Do not require QUERY_OA_UNITS for all Xe tests

Changes xe_query_oa_units_new() to return NULL instead of aborting
due to assertion failure when querying for DRM_XE_DEVICE_QUERY_OA_UNITS.

It adds a skip to xe_oa.c to make sure it will not try to run the tests if the
query has failed before.

The motivation is as follows:
 - The only test that requires oa_units is tests/intel/xe_oa.c, however current
   code will prevent all Xe tests from running if OA_UNITS is not supported
 - Before this patch, trying to run IGT on the Xe module from Fedora 40
   (6.9.9-200.fc40.x86_64) fails
 - After this patch, we can run some tests, such as xe_exec_basic
   successfully

Here is an example of the impact of this patch:
 1. Use Fedora 40 with the following kernel command line arguments:
    "xe.force_probe=* i915.force_probe=!* modprobe.blacklist=i915,ast,snd_hda_intel,xe"

 2. Running IGT without this patch will fail:
     $ sudo ./build/tests/xe_exec_basic
     $ echo $?
     98

 3. Running after fix applied will succeed:
    sudo ./build/tests/xe_exec_basic
     $ sudo ./build/tests/xe_exec_basic
     $ echo $?
     0

Signed-off-by: Peter Senna Tschudin <peter.senna@intel.com>
---
 lib/xe/xe_query.c   | 6 +++++-
 tests/intel/xe_oa.c | 9 ++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/lib/xe/xe_query.c b/lib/xe/xe_query.c
index 84eaaac96..f0643e1bc 100644
--- a/lib/xe/xe_query.c
+++ b/lib/xe/xe_query.c
@@ -124,7 +124,11 @@ static struct drm_xe_query_oa_units *xe_query_oa_units_new(int fd)
 		.data = 0,
 	};
 
-	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
+	/**
+	 * Only tests/intel/xe_oa.c needs OA_UNITS
+	 */
+	if (igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query) != 0)
+		return NULL;
 
 	oa_units = malloc(query.size);
 	igt_assert(oa_units);
diff --git a/tests/intel/xe_oa.c b/tests/intel/xe_oa.c
index ff2218300..dd02f8608 100644
--- a/tests/intel/xe_oa.c
+++ b/tests/intel/xe_oa.c
@@ -4503,6 +4503,7 @@ static const char *xe_engine_class_name(uint32_t engine_class)
 igt_main
 {
 	struct drm_xe_engine_class_instance *hwe = NULL;
+	struct xe_device *xe_dev;
 
 	igt_fixture {
 		struct stat sb;
@@ -4527,7 +4528,13 @@ igt_main
 		igt_assert_eq(drm_fd, -1);
 
 		drm_fd = drm_open_driver(DRIVER_XE);
-		xe_device_get(drm_fd);
+		xe_dev = xe_device_get(drm_fd);
+
+		/**
+		 * This test needs OA_UNITS to run, see xe_query_oa_units_new()
+		 * on lib/xe/xe_query.c
+		 */
+		igt_require(xe_dev->oa_units);
 
 		devid = intel_get_drm_devid(drm_fd);
 		sysfs = igt_sysfs_open(drm_fd);
-- 
2.34.1


             reply	other threads:[~2024-07-25  9:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-25  9:36 Peter Senna Tschudin [this message]
2024-07-25 11:22 ` ✗ Fi.CI.BUILD: failure for Do not require QUERY_OA_UNITS for all Xe tests Patchwork

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=f79e0043-2a5b-4b35-8533-86b3d6b08b84@linux.intel.com \
    --to=peter.senna@linux.intel.com \
    --cc=ashutosh.dixit@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.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