From: Christoph Manszewski <christoph.manszewski@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>,
"Kamil Konieczny" <kamil.konieczny@linux.intel.com>,
"Dominik Grzegorzek" <dominik.grzegorzek@intel.com>,
"Maciej Patelczyk" <maciej.patelczyk@intel.com>,
"Dominik Karol Piątkowski" <dominik.karol.piatkowski@intel.com>,
"Pawel Sikora" <pawel.sikora@intel.com>,
"Andrzej Hajda" <andrzej.hajda@intel.com>,
"Kolanupaka Naveena" <kolanupaka.naveena@intel.com>,
"Mika Kuoppala" <mika.kuoppala@intel.com>,
"Gwan-gyeong Mun" <gwan-gyeong.mun@intel.com>
Subject: [PATCH 53/66] tests/xe_eudebug_online: Set dynamic breakpoint on interrupt-all
Date: Mon, 29 Jul 2024 18:01:46 +0200 [thread overview]
Message-ID: <20240729160159.37036-54-christoph.manszewski@intel.com> (raw)
In-Reply-To: <20240729160159.37036-1-christoph.manszewski@intel.com>
From: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
Implement interrupt-all-set-breakpoint, which interrupts all threads,
and once spots attention it sets a breakpoint on the next instruction.
Signed-off-by: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
---
tests/intel/xe_eudebug_online.c | 81 ++++++++++++++++++++++++++++++++-
1 file changed, 80 insertions(+), 1 deletion(-)
diff --git a/tests/intel/xe_eudebug_online.c b/tests/intel/xe_eudebug_online.c
index 8791b29fa..5bb165fef 100644
--- a/tests/intel/xe_eudebug_online.c
+++ b/tests/intel/xe_eudebug_online.c
@@ -22,6 +22,7 @@
#define SHADER_BREAKPOINT (1 << 0)
#define SHADER_LOOP (1 << 1)
+#define TRIGGER_RESUME_SET_BP (1 << 28)
#define TRIGGER_RESUME_DELAYED (1 << 29)
#define TRIGGER_RESUME_DSS (1 << 30)
#define TRIGGER_RESUME_ONE (1 << 31)
@@ -276,6 +277,7 @@ struct online_debug_data {
uint64_t bb_offset;
size_t bb_size;
int vm_fd;
+ uint32_t first_aip;
struct timespec exception_arrived;
int last_eu_control_seqno;
};
@@ -342,6 +344,71 @@ static void copy_first_bit(uint8_t *dst, uint8_t *src, int size)
}
}
+/*
+ * Searches for the first instruction. It stands on assumption,
+ * that shader kernel is placed before sip within the bb.
+ */
+static uint32_t find_kernel_in_bb(struct gpgpu_shader *kernel,
+ struct online_debug_data *data)
+{
+ uint32_t *p = kernel->code;
+ size_t sz = 4 * sizeof(uint32_t);
+ uint32_t buf[4];
+ int i;
+
+ for (i = 0; i < data->bb_size; i += sz) {
+ igt_assert_eq(pread(data->vm_fd, &buf, sz, data->bb_offset + i), sz);
+
+
+ if (memcmp(p, buf, sz) == 0)
+ break;
+ }
+
+ igt_assert(i < data->bb_size);
+
+ return i;
+}
+
+static void set_breakpoint_once(struct xe_eudebug_debugger *d,
+ struct online_debug_data *data)
+{
+ const uint32_t breakpoint_bit = 1 << 30;
+ size_t sz = sizeof(uint32_t);
+ struct gpgpu_shader *kernel;
+ uint32_t aip;
+
+ kernel = get_shader(d->master_fd, d->flags);
+
+ if (data->first_aip) {
+ uint32_t expected = find_kernel_in_bb(kernel, data) + kernel->size * 4 - 0x10;
+
+ igt_assert_eq(pread(data->vm_fd, &aip, sz, data->target_offset), sz);
+ igt_assert_eq_u32(aip, expected);
+ } else {
+ uint32_t instr_usdw;
+
+ igt_assert(data->vm_fd != -1);
+ igt_assert(data->target_size != 0);
+ igt_assert(data->bb_size != 0);
+
+ igt_assert_eq(pread(data->vm_fd, &aip, sz, data->target_offset), sz);
+ data->first_aip = aip;
+
+ aip = find_kernel_in_bb(kernel, data);
+
+ /* set breakpoint on last instruction */
+ aip += kernel->size * 4 - 0x10;
+ igt_assert_eq(pread(data->vm_fd, &instr_usdw, sz,
+ data->bb_offset + aip), sz);
+ instr_usdw |= breakpoint_bit;
+ igt_assert_eq(pwrite(data->vm_fd, &instr_usdw, sz,
+ data->bb_offset + aip), sz);
+
+ }
+
+ gpgpu_shader_destroy(kernel);
+}
+
#define MAX_PREEMPT_TIMEOUT 10ull
static void eu_attention_resume_trigger(struct xe_eudebug_debugger *d,
struct drm_xe_eudebug_event *e)
@@ -382,6 +449,8 @@ static void eu_attention_resume_trigger(struct xe_eudebug_debugger *d,
resume[i] = event[i];
break;
}
+ } else if (d->flags & TRIGGER_RESUME_SET_BP) {
+ set_breakpoint_once(d, data);
}
if (d->flags & SHADER_LOOP) {
@@ -602,7 +671,7 @@ static void run_online_client(struct xe_eudebug_client *c)
data->threads_count = count_canaries_neq(ptr, w_dim, 0);
igt_assert_f(data->threads_count, "No canaries found, nothing executed?\n");
- if (c->flags & SHADER_BREAKPOINT) {
+ if (c->flags & SHADER_BREAKPOINT || c->flags & TRIGGER_RESUME_SET_BP) {
uint32_t aip = ptr[0];
igt_assert_f(aip != SHADER_CANARY, "Workload executed but breakpoint not hit!\n");
@@ -860,6 +929,13 @@ static void test_basic_online(int fd, struct drm_xe_engine_class_instance *hwe,
* Schedules EU workload which should last about a few seconds, then
* interrupts all threads, checks whether attention event came, and
* resumes stopped threads back.
+ *
+ * SUBTEST: interrupt-all-set-breakpoint
+ * Description:
+ * Schedules EU workload which should last about a few seconds, then
+ * interrupts all threads, once attention event come it sets breakpoint on
+ * the very next instruction and resumes stopped thereads back. It expects
+ * that every thread hits the breakpoint.
*/
static void test_interrupt_all(int fd, struct drm_xe_engine_class_instance *hwe, int flags)
{
@@ -970,6 +1046,9 @@ igt_main
test_gt_render_or_compute("interrupt-all", fd, hwe)
test_interrupt_all(fd, hwe, SHADER_LOOP);
+ test_gt_render_or_compute("interrupt-all-set-breakpoint", fd, hwe)
+ test_interrupt_all(fd, hwe, SHADER_LOOP | TRIGGER_RESUME_SET_BP);
+
igt_fixture {
intel_allocator_multiprocess_stop();
drm_close_driver(fd);
--
2.34.1
next prev parent reply other threads:[~2024-07-29 16:05 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-29 16:00 [PATCH 00/66] Test coverage for GPU debug support Christoph Manszewski
2024-07-29 16:00 ` [PATCH 01/66] tests/xe_eudebug: Test eudebug connection Christoph Manszewski
2024-07-30 7:58 ` Zbigniew Kempczyński
2024-07-30 9:42 ` Manszewski, Christoph
2024-07-29 16:00 ` [PATCH 02/66] lib/xe_eudebug: Introduce eu debug testing framework Christoph Manszewski
2024-07-29 16:00 ` [PATCH 03/66] lib/xe_eudebug: Allow client to wait for debugger Christoph Manszewski
2024-07-29 16:00 ` [PATCH 04/66] lib/xe_eudebug: Add exec_queue support Christoph Manszewski
2024-07-29 16:00 ` [PATCH 05/66] lib/xe_eudebug: Add attention events support Christoph Manszewski
2024-07-29 16:00 ` [PATCH 06/66] lib/xe_ioctl: Add wrapper with vm_bind_op extension parameter Christoph Manszewski
2024-07-29 16:01 ` [PATCH 07/66] lib/xe_eudebug: Add support for vm_bind events Christoph Manszewski
2024-07-29 16:01 ` [PATCH 08/66] lib/xe_eudebug: Add metadata support Christoph Manszewski
2024-07-29 16:01 ` [PATCH 09/66] lib/xe_eudebug: Add support for user fence acking Christoph Manszewski
2024-07-29 16:01 ` [PATCH 10/66] lib/xe_eudebug: Add support for dynamic debugger sysfs toggle Christoph Manszewski
2024-07-29 16:01 ` [PATCH 11/66] tests/xe_eudebug: Test open close events Christoph Manszewski
2024-07-29 16:01 ` [PATCH 12/66] tests/xe_eudebug: Exercise read_event ioctl Christoph Manszewski
2024-07-29 16:01 ` [PATCH 13/66] tests/xe_eudebug: Add vm events sanity check Christoph Manszewski
2024-07-29 16:01 ` [PATCH 14/66] tests/xe_eudebug: Race discovery against eudebug attach Christoph Manszewski
2024-07-29 16:01 ` [PATCH 15/66] tests/xe_eudebug: Add TEST/SUBTEST documentation Christoph Manszewski
2024-07-29 16:01 ` [PATCH 16/66] tests/xe_eudebug: Introduce basic exec_queue testing Christoph Manszewski
2024-07-29 16:01 ` [PATCH 17/66] tests/xe_eudebug: Include exec queues in discovery testing Christoph Manszewski
2024-07-29 16:01 ` [PATCH 18/66] tests/xe_eudebug: Add vm open/pread/pwrite basic tests Christoph Manszewski
2024-07-29 16:01 ` [PATCH 19/66] tests/xe_eudebug: Add basic vm-bind coverage Christoph Manszewski
2024-07-29 16:01 ` [PATCH 20/66] tests/xe_eudebug: Exercise debug metadata events sent to debugger Christoph Manszewski
2024-07-29 16:01 ` [PATCH 21/66] tests/xe_eudebug: Add support for dynamic debugger sysfs toggle Christoph Manszewski
2024-07-29 16:01 ` [PATCH 22/66] tests/xe_eudebug: Add coverage for sysfs debugger toggle Christoph Manszewski
2024-07-29 16:01 ` [PATCH 23/66] lib/xe_eudebug: Allow debugger to wait for client Christoph Manszewski
2024-07-29 16:01 ` [PATCH 24/66] tests/xe_eudebug: Add vm-bind discovery tests Christoph Manszewski
2024-07-29 16:01 ` [PATCH 25/66] tests/xe_eudebug: Add basic-vm-bind-metadata-discovery Christoph Manszewski
2024-07-29 16:01 ` [PATCH 26/66] tests/xe_eudebug: Add basic-vm-access-parameters test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 27/66] lib/xe_eudebug: Add mutex for log events write Christoph Manszewski
2024-07-29 16:01 ` [PATCH 28/66] tests/xe_eudebug: Add basic-client-th test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 29/66] tests/xe_eudebug: Added connect-user test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 30/66] tests/xe_eudebug: Add discovery-race-vmbind subtest Christoph Manszewski
2024-07-29 16:01 ` [PATCH 31/66] tests/xe_eudebug: Add userptr variant of basic-vm-access test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 32/66] tests/xe_eudebug: Add basic-vm-bind-ufence Christoph Manszewski
2024-07-29 16:01 ` [PATCH 33/66] tests/xe_eudebug: Add multigpu scenarios Christoph Manszewski
2024-07-29 16:01 ` [PATCH 34/66] tests/xe_eudebug: Add vm-bind-clear test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 35/66] tests/xe_eudebug: Exercise lseek Christoph Manszewski
2024-07-29 16:01 ` [PATCH 36/66] tests/xe_eudebug: Test multiple bo sizes Christoph Manszewski
2024-07-29 16:01 ` [PATCH 37/66] lib/gpgpu_shader: Extend shader building library Christoph Manszewski
2024-07-29 16:01 ` [PATCH 38/66] tests/xe_exec_sip: Port tests for shaders and sip Christoph Manszewski
2024-07-29 16:01 ` [PATCH 39/66] tests/xe_exec_sip: Check if we reset due to unhandled attention Christoph Manszewski
2024-07-29 16:01 ` [PATCH 40/66] tests/xe_exec_sip: Check usercoredump for attentions Christoph Manszewski
2024-07-29 16:01 ` [PATCH 41/66] tests/xe_exec_sip: Add support for dynamic debugger sysfs toggle Christoph Manszewski
2024-07-29 16:01 ` [PATCH 42/66] tests/xe_exec_sip: Add breakpoint-writesip-twice test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 43/66] tests/xe_exec_sip: Add sanity-after-timeout test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 44/66] tests/xe_exec_sip: Add breakpoint-waitsip-heavy test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 45/66] tests/xe_exec_sip: Add nodebug test cases Christoph Manszewski
2024-07-29 16:01 ` [PATCH 46/66] lib/gpgpu_shader: Add write_on_exception template Christoph Manszewski
2024-07-29 16:01 ` [PATCH 47/66] lib/gpgpu_shader: Add set/clear exception register (cr0.1) helpers Christoph Manszewski
2024-07-29 16:01 ` [PATCH 48/66] lib/intel_batchbuffer: Add helper to get pointer at specified offset Christoph Manszewski
2024-07-29 16:01 ` [PATCH 49/66] lib/gpgpu_shader: Allow enabling illegal opcode exceptions in shader Christoph Manszewski
2024-07-29 16:01 ` [PATCH 50/66] tests/xe_exec_sip: Rework invalid instruction tests Christoph Manszewski
2024-07-29 16:01 ` [PATCH 51/66] lib/intel_batchbuffer: Add support for long-running mode execution Christoph Manszewski
2024-07-29 16:01 ` [PATCH 52/66] tests/xe_eudebug_online: Debug client which runs workloads on EU Christoph Manszewski
2024-07-29 16:01 ` Christoph Manszewski [this message]
2024-07-29 16:01 ` [PATCH 54/66] tests/xe_eudebug_online: Add support for dynamic debugger sysfs toggle Christoph Manszewski
2024-07-29 16:01 ` [PATCH 55/66] tests/xe_eudebug_online: Add tdctl-parameters test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 56/66] tests/xe_eudebug_online: Add reset-with-attention test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 57/66] lib/xe_eudebug: Expose xe_eudebug_connect Christoph Manszewski
2024-07-29 16:01 ` [PATCH 58/66] tests/xe_eudebug_online: Add interrupt-reconnect test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 59/66] tests/xe_eudebug_online: Add single-step and single-step-one tests Christoph Manszewski
2024-07-29 16:01 ` [PATCH 60/66] tests/xe_eudebug_online: What if user does not set debug mode? Christoph Manszewski
2024-07-29 16:01 ` [PATCH 61/66] tests/xe_eudebug_online: Adds debugger-reopen test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 62/66] tests/xe_eudebug_online: Add caching tests Christoph Manszewski
2024-07-29 16:01 ` [PATCH 63/66] tests/xe_eudebug_online: Add subtests w/o long running mode Christoph Manszewski
2024-07-29 16:01 ` [PATCH 64/66] tests/xe_eudebug_online: Add multisession test cases Christoph Manszewski
2024-07-29 16:01 ` [PATCH 65/66] tests/xe_eudebug_online: Check if eu debugger disables preemption timeout Christoph Manszewski
2024-07-29 16:01 ` [PATCH 66/66] tests/xe_live_ktest: Add xe_eudebug live test Christoph Manszewski
2024-07-29 19:18 ` ✗ Fi.CI.BUILD: failure for Test coverage for GPU debug support Patchwork
2024-07-29 19:21 ` ✗ GitLab.Pipeline: warning " 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=20240729160159.37036-54-christoph.manszewski@intel.com \
--to=christoph.manszewski@intel.com \
--cc=andrzej.hajda@intel.com \
--cc=dominik.grzegorzek@intel.com \
--cc=dominik.karol.piatkowski@intel.com \
--cc=gwan-gyeong.mun@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.intel.com \
--cc=kolanupaka.naveena@intel.com \
--cc=maciej.patelczyk@intel.com \
--cc=mika.kuoppala@intel.com \
--cc=pawel.sikora@intel.com \
--cc=zbigniew.kempczynski@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