From: Christoph Manszewski <christoph.manszewski@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Piotr Rudnicki" <piotr.rudnicki@intel.com>,
"Dominik Karol Piątkowski" <dominik.karol.piatkowski@intel.com>,
"Jan Sokolowski" <jan.sokolowski@intel.com>
Subject: [PATCH i-g-t v5 2/5] lib/xe/xe_eudebug: Modify toggle error handling
Date: Wed, 11 Mar 2026 12:06:39 +0100 [thread overview]
Message-ID: <20260311110636.798120-9-christoph.manszewski@intel.com> (raw)
In-Reply-To: <20260311110636.798120-7-christoph.manszewski@intel.com>
From: Dominik Karol Piątkowski <dominik.karol.piatkowski@intel.com>
Convert __xe_eudebug_enable_getset to use errno. Abort in
xe_eudebug_enable on error (other than -ENOENT) to not leave
the environment in potentially dirty state.
Signed-off-by: Dominik Karol Piątkowski <dominik.karol.piatkowski@intel.com>
Reviewed-by: Piotr Rudnicki <piotr.rudnicki@intel.com>
Link: https://lore.kernel.org/r/20260220153748.210381-9-christoph.manszewski@intel.com
Signed-off-by: Christoph Manszewski <christoph.manszewski@intel.com>
---
lib/xe/xe_eudebug.c | 35 +++++++++++++++++++----------------
1 file changed, 19 insertions(+), 16 deletions(-)
diff --git a/lib/xe/xe_eudebug.c b/lib/xe/xe_eudebug.c
index 2387b74f8..41eed7614 100644
--- a/lib/xe/xe_eudebug.c
+++ b/lib/xe/xe_eudebug.c
@@ -1829,6 +1829,7 @@ static void metadata_event(struct xe_eudebug_client *c, uint32_t flags,
xe_eudebug_event_log_write(c->log, (void *)&em);
}
+#define EU_DEBUG_TOGGLE "device/enable_eudebug"
/**
* __xe_eudebug_enable_getset
* @fd: xe client
@@ -1838,13 +1839,12 @@ static void metadata_event(struct xe_eudebug_client *c, uint32_t flags,
* Stores current eudebug feature state in @old if not NULL. Sets new eudebug
* feature state to @new if not NULL. Asserts if both @old and @new are NULL.
*
- * Returns: 0 on success, -1 on failure.
+ * Returns: 0 on success, -errno on failure.
*/
int __xe_eudebug_enable_getset(int fd, bool *old, bool *new)
{
- static const char * const fname = "enable_eudebug";
int ret = 0;
- int sysfs, device_fd;
+ int sysfs;
bool val_before;
struct stat st;
@@ -1853,15 +1853,10 @@ int __xe_eudebug_enable_getset(int fd, bool *old, bool *new)
sysfs = igt_sysfs_open(fd);
if (sysfs < 0)
- return -1;
-
- device_fd = openat(sysfs, "device", O_DIRECTORY | O_RDONLY);
- close(sysfs);
- if (device_fd < 0)
- return -1;
+ return -errno;
- if (!__igt_sysfs_get_boolean(device_fd, fname, &val_before)) {
- ret = -1;
+ if (!__igt_sysfs_get_boolean(sysfs, EU_DEBUG_TOGGLE, &val_before)) {
+ ret = -errno;
goto out;
}
@@ -1871,14 +1866,14 @@ int __xe_eudebug_enable_getset(int fd, bool *old, bool *new)
*old = val_before;
if (new) {
- if (__igt_sysfs_set_boolean(device_fd, fname, *new))
- igt_assert_eq(igt_sysfs_get_boolean(device_fd, fname), *new);
+ if (__igt_sysfs_set_boolean(sysfs, EU_DEBUG_TOGGLE, *new))
+ igt_assert_eq(igt_sysfs_get_boolean(sysfs, EU_DEBUG_TOGGLE), *new);
else
- ret = -1;
+ ret = -errno;
}
out:
- close(device_fd);
+ close(sysfs);
return ret;
}
@@ -1896,10 +1891,18 @@ out:
*/
bool xe_eudebug_enable(int fd, bool enable)
{
+ char sysfs_path[PATH_MAX];
bool old = false;
int ret = __xe_eudebug_enable_getset(fd, &old, &enable);
- igt_skip_on(ret);
+ if (ret == -ENOENT) {
+ igt_assert(igt_sysfs_path(fd, sysfs_path, sizeof(sysfs_path)));
+ igt_skip("'%s/" EU_DEBUG_TOGGLE
+ "' sysfs attribute not found, EU DEBUG not supported\n", sysfs_path);
+ }
+
+ igt_abort_on_f(ret, "xe_eudebug_enable: Failed to %s eudebug\n",
+ enable ? "enable" : "disable");
return old;
}
--
2.47.1
next prev parent reply other threads:[~2026-03-11 11:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-11 11:06 [PATCH i-g-t v5 0/5] Improve eudebug test cleanup Christoph Manszewski
2026-03-11 11:06 ` [PATCH i-g-t v5 1/5] tests/xe/xe_eudebug: Change pthread_join to pthread_timedjoin_np Christoph Manszewski
2026-03-11 11:06 ` Christoph Manszewski [this message]
2026-03-11 11:06 ` [PATCH i-g-t v5 3/5] xe/xe_eudebug: Add reattach function and make plain connect private Christoph Manszewski
2026-03-11 11:06 ` [PATCH i-g-t v5 4/5] lib/xe/xe_eudebug: Track active debugger sessions and close when disabling Christoph Manszewski
2026-03-11 11:06 ` [PATCH i-g-t v5 5/5] lib/xe/xe_eudebug: Get drm card sysfs path Christoph Manszewski
2026-03-12 0:04 ` ✓ Xe.CI.BAT: success for Improve eudebug test cleanup (rev5) Patchwork
2026-03-12 0:07 ` ✓ i915.CI.BAT: " Patchwork
2026-03-12 19:08 ` ✓ i915.CI.Full: " Patchwork
2026-03-12 19:10 ` ✗ Xe.CI.FULL: failure " 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=20260311110636.798120-9-christoph.manszewski@intel.com \
--to=christoph.manszewski@intel.com \
--cc=dominik.karol.piatkowski@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jan.sokolowski@intel.com \
--cc=piotr.rudnicki@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