Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kamil Konieczny <kamil.konieczny@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Subject: [PATCH i-g-t v4 4/4] lib/igt_sysfs: improve xe sysfs checks
Date: Tue, 26 Nov 2024 19:10:23 +0100	[thread overview]
Message-ID: <20241126181024.1398259-6-kamil.konieczny@linux.intel.com> (raw)
In-Reply-To: <20241126181024.1398259-1-kamil.konieczny@linux.intel.com>

Improve check for Xe sysfs failed open. While at this, make sure
it will not be closed just before unbind and also use drmtest
close function, as it will properly call xe_device_put().

Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 lib/igt_sysfs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index e903a9857..850ca21b4 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -1447,7 +1447,7 @@ int xe_sysfs_driver_do(int xe_device, char pci_slot[], enum xe_sysfs_driver_acti
 	int sysfs;
 
 	sysfs = open("/sys/bus/pci/drivers/xe", O_DIRECTORY);
-	igt_assert(sysfs);
+	igt_assert_f(sysfs != -1, "Sysfs open failed, errno=%d\n", errno);
 	__drm_invalidate_opened_fds();
 
 	switch(action) {
@@ -1470,7 +1470,8 @@ int xe_sysfs_driver_do(int xe_device, char pci_slot[], enum xe_sysfs_driver_acti
 		 * We need to close the client for a proper release, before
 		 * binding back again.
 		 */
-		close(xe_device);
+		igt_assert_neq(xe_device, sysfs);
+		drm_close_driver(xe_device);
 
 		igt_assert(igt_sysfs_set(sysfs, "bind", pci_slot));
 		close(sysfs);
-- 
2.34.1


  parent reply	other threads:[~2024-11-26 18:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-26 18:10 [PATCH i-g-t v3 0/2] Ignore more warns in xe_wedged tests Kamil Konieczny
2024-11-26 18:10 ` [PATCH i-g-t v4 0/4] " Kamil Konieczny
2024-11-26 18:10 ` [PATCH i-g-t v4 1/4] tests/intel/xe_wedged: Ignore more dmesg warnings Kamil Konieczny
2024-11-26 23:09   ` Matt Roper
2024-11-26 18:10 ` [PATCH i-g-t v4 2/4] HAX/DO_NOT_MERGE: xe-fast-feedback: test xe_wedged Kamil Konieczny
2024-11-26 18:10 ` [PATCH i-g-t v4 3/4] lib/drmtest: invalidate cached fds after unbind Kamil Konieczny
2024-12-19 15:17   ` Lucas De Marchi
2024-11-26 18:10 ` Kamil Konieczny [this message]
2024-11-26 19:07 ` ✗ Xe.CI.BAT: failure for Ignore more warns in xe_wedged tests (rev5) Patchwork
2024-11-26 20:15 ` ✗ Xe.CI.Full: " Patchwork
2024-11-26 20:40 ` ✓ i915.CI.BAT: success " Patchwork
2024-11-26 21:50 ` ✗ i915.CI.Full: failure " Patchwork
2024-11-29 21:21 ` ✗ Xe.CI.BAT: failure for Ignore more warns in xe_wedged tests (rev6) Patchwork
2024-11-30  6:06 ` ✗ Xe.CI.Full: " 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=20241126181024.1398259-6-kamil.konieczny@linux.intel.com \
    --to=kamil.konieczny@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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