From: Shuicheng Lin <shuicheng.lin@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Shuicheng Lin <shuicheng.lin@intel.com>
Subject: [PATCH] tests/intel/xe_fault_injection: Close drm fd before unbind
Date: Fri, 9 Jan 2026 22:40:48 +0000 [thread overview]
Message-ID: <20260109224047.2483497-2-shuicheng.lin@intel.com> (raw)
Close the sysfs and DRM device fd before unbinding the xe driver. Otherwise the
open fd holds a reference, and the subsequent bind can come up with different
card/render minor numbers (e.g. renderD128 -> renderD129, card0 -> card1).
Also drop the unused DRM fd parameter from inject_fault_probe() and
probe_fail_guc() now that these paths don't require it.
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
---
tests/intel/xe_fault_injection.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tests/intel/xe_fault_injection.c b/tests/intel/xe_fault_injection.c
index f3bfc4b40..76d1c6fa3 100644
--- a/tests/intel/xe_fault_injection.c
+++ b/tests/intel/xe_fault_injection.c
@@ -260,7 +260,7 @@ static void ignore_fail_dump_in_dmesg(const char function_name[], bool enable)
* @xe_wopcm_init: xe_wopcm_init
*/
static int
-inject_fault_probe(int fd, const char pci_slot[], const char function_name[])
+inject_fault_probe(const char pci_slot[], const char function_name[])
{
int err = 0;
igt_info("Injecting error \"%s\" (%d) in function \"%s\"\n",
@@ -289,7 +289,7 @@ inject_fault_probe(int fd, const char pci_slot[], const char function_name[])
* @xe_guc_mmio_send_recv: Inject an error when calling xe_guc_mmio_send_recv
* @xe_guc_ct_send_recv: Inject an error when calling xe_guc_ct_send_recv
*/
-static void probe_fail_guc(int fd, const char pci_slot[], const char function_name[],
+static void probe_fail_guc(const char pci_slot[], const char function_name[],
struct fault_injection_params *fault_params)
{
int iter_start = 0, iter_end = 0, iter = 0;
@@ -308,7 +308,7 @@ static void probe_fail_guc(int fd, const char pci_slot[], const char function_na
fault_params->space = i;
fault_params->times = MAX_INJECTIONS_PER_ITER;
setup_injection_fault(fault_params);
- inject_fault_probe(fd, pci_slot, function_name);
+ inject_fault_probe(pci_slot, function_name);
igt_kmod_unbind("xe", pci_slot);
/*
@@ -662,6 +662,8 @@ int igt_main_args("I:", NULL, help_str, opt_handler, NULL)
oa_add_config_fail(fd, sysfs, devid, pci_slot, s->name);
igt_fixture() {
+ close(sysfs);
+ drm_close_driver(fd);
igt_kmod_unbind("xe", pci_slot);
}
@@ -670,7 +672,7 @@ int igt_main_args("I:", NULL, help_str, opt_handler, NULL)
bool should_pass = s->pf_only && is_vf_device;
int err;
- err = inject_fault_probe(fd, pci_slot, s->name);
+ err = inject_fault_probe(pci_slot, s->name);
igt_assert_eq(should_pass ? 0 : INJECT_ERRNO, err);
igt_kmod_unbind("xe", pci_slot);
@@ -680,12 +682,10 @@ int igt_main_args("I:", NULL, help_str, opt_handler, NULL)
igt_subtest_f("probe-fail-guc-%s", s->name) {
memcpy(&fault_params, &default_fault_params,
sizeof(struct fault_injection_params));
- probe_fail_guc(fd, pci_slot, s->name, &fault_params);
+ probe_fail_guc(pci_slot, s->name, &fault_params);
}
igt_fixture() {
- close(sysfs);
- drm_close_driver(fd);
injection_list_clear();
igt_kmod_bind("xe", pci_slot);
}
--
2.50.1
next reply other threads:[~2026-01-09 22:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-09 22:40 Shuicheng Lin [this message]
2026-01-10 0:33 ` ✓ Xe.CI.BAT: success for tests/intel/xe_fault_injection: Close drm fd before unbind Patchwork
2026-01-10 0:37 ` ✓ i915.CI.BAT: " Patchwork
2026-01-10 3:18 ` ✗ i915.CI.Full: failure " Patchwork
2026-02-17 16:43 ` Lin, Shuicheng
2026-01-10 5:31 ` ✓ Xe.CI.Full: success " Patchwork
2026-01-21 2:43 ` [PATCH] " Lin, Shuicheng
2026-02-17 16:29 ` Dandamudi, Priyanka
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=20260109224047.2483497-2-shuicheng.lin@intel.com \
--to=shuicheng.lin@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