From: Jan Maslak <jan.maslak@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: maciej.patelczyk@intel.com, Jan Maslak <jan.maslak@intel.com>
Subject: [PATCH 2/2] tests/intel/xe_eudebug_online: Assert fsync return on debugger VM fd
Date: Wed, 4 Mar 2026 15:36:19 +0100 [thread overview]
Message-ID: <20260304143619.3854871-3-jan.maslak@intel.com> (raw)
In-Reply-To: <20260304143619.3854871-1-jan.maslak@intel.com>
fsync() on a debugger VM fd triggers GPU cache invalidation, ensuring
that pwrite() and pread() operations observe a consistent memory state.
All call sites were silently ignoring the return value, allowing cache
flush failures to go undetected.
Wrap all fsync() calls with igt_assert_eq() so that a failure causes
an immediate abort.
Signed-off-by: Jan Maslak <jan.maslak@intel.com>
Reviewed-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
---
tests/intel/xe_eudebug_online.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tests/intel/xe_eudebug_online.c b/tests/intel/xe_eudebug_online.c
index 1af887bba..8d3bc644f 100644
--- a/tests/intel/xe_eudebug_online.c
+++ b/tests/intel/xe_eudebug_online.c
@@ -621,7 +621,7 @@ static bool set_breakpoint_once(struct xe_eudebug_debugger *d,
instr_usdw |= breakpoint_bit;
igt_assert_eq(pwrite(data->vm_fd, &instr_usdw, sz,
data->bb_offset + aip), sz);
- fsync(data->vm_fd);
+ igt_assert_eq(fsync(data->vm_fd), 0);
breakpoint_set = true;
}
@@ -648,7 +648,7 @@ static void get_aips_offset_table(struct online_debug_data *data, int threads)
data->first_aip = first_aip;
data->aips_offset_table[table_index++] = 0;
- fsync(data->vm_fd);
+ igt_assert_eq(fsync(data->vm_fd), 0);
for (int i = sz; i < data->target_size; i += sz) {
igt_assert_eq(pread(data->vm_fd, &aip, sz, data->target_offset + i), sz);
if (aip == first_aip)
@@ -668,7 +668,7 @@ static int get_stepped_threads_count(struct online_debug_data *data, int threads
size_t sz = sizeof(uint32_t);
uint32_t aip;
- fsync(data->vm_fd);
+ igt_assert_eq(fsync(data->vm_fd), 0);
for (int i = 0; i < threads; i++) {
igt_assert_eq(pread(data->vm_fd, &aip, sz,
data->target_offset + data->aips_offset_table[i]), sz);
@@ -762,7 +762,7 @@ static void eu_attention_resume_trigger(struct xe_eudebug_debugger *d,
igt_assert_eq(pwrite(data->vm_fd, &val, sizeof(uint32_t),
data->target_offset + steering_offset(threads)),
sizeof(uint32_t));
- fsync(data->vm_fd);
+ igt_assert_eq(fsync(data->vm_fd), 0);
}
pthread_mutex_unlock(&data->mutex);
@@ -857,7 +857,7 @@ static void eu_attention_resume_single_step_trigger(struct xe_eudebug_debugger *
igt_assert_eq(pwrite(data->vm_fd, &val, sz,
data->target_offset + steering_offset(threads)), sz);
- fsync(data->vm_fd);
+ igt_assert_eq(fsync(data->vm_fd), 0);
data->last_eu_control_seqno = eu_ctl_resume(d->master_fd, d->fd, att->client_handle,
att->exec_queue_handle, att->lrc_handle,
@@ -988,7 +988,7 @@ static void overwrite_immediate_value_in_common_target_write(int vm_fd, uint64_t
igt_assert_eq(pread(vm_fd, &val, sizeof(uint32_t), addr),
sizeof(uint32_t));
igt_debug("val_before_fsync[%d]: %08x\n", vals_changed, val);
- fsync(vm_fd);
+ igt_assert_eq(fsync(vm_fd), 0);
igt_assert_eq(pread(vm_fd, &val, sizeof(uint32_t), addr),
sizeof(uint32_t));
igt_debug("val_after_fsync[%d]: %08x\n", vals_changed, val);
@@ -1043,7 +1043,7 @@ static void eu_attention_resume_caching_trigger(struct xe_eudebug_debugger *d,
data->bb_offset + *kernel_offset + shader_preamble->size * 4 +
shader_write_instr->size * 4 * *counter),
sizeof(instr_usdw));
- fsync(data->vm_fd);
+ igt_assert_eq(fsync(data->vm_fd), 0);
}
/* restore current instruction */
--
2.34.1
next prev parent reply other threads:[~2026-03-04 14:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-04 14:36 [PATCH 0/2] tests/intel/xe_eudebug_online: Fix sporadic failures due to unhandled fsync errors Jan Maslak
2026-03-04 14:36 ` [PATCH 1/2] tests/intel/xe_eudebug_online: Set timeout for debugger VM fd sync Jan Maslak
2026-03-04 14:36 ` Jan Maslak [this message]
2026-03-05 7:12 ` ✓ i915.CI.BAT: success for tests/intel/xe_eudebug_online: Fix sporadic failures due to unhandled fsync errors (rev2) Patchwork
2026-03-05 12:16 ` ✓ Xe.CI.BAT: " Patchwork
2026-03-05 18:28 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-05-07 9:11 ` [PATCH 0/2] tests/intel/xe_eudebug_online: Fix sporadic failures due to unhandled fsync errors Maciej Patelczyk
-- strict thread matches above, loose matches on Subject: below --
2026-02-27 11:41 Jan Maslak
2026-02-27 11:41 ` [PATCH 2/2] tests/intel/xe_eudebug_online: Assert fsync return on debugger VM fd Jan Maslak
2026-03-04 11:04 ` Maciej Patelczyk
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=20260304143619.3854871-3-jan.maslak@intel.com \
--to=jan.maslak@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=maciej.patelczyk@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