From: "Manszewski, Christoph" <christoph.manszewski@intel.com>
To: "Dominik Karol Piątkowski" <dominik.karol.piatkowski@intel.com>,
igt-dev@lists.freedesktop.org
Cc: Dominik Grzegorzek <dominik.grzegorzek@intel.com>,
Jan Sokolowski <jan.sokolowski@intel.com>
Subject: Re: [PATCH i-g-t 3/3] tests/xe_eudebug_online: Add set-breakpoint-sigint-debugger test
Date: Mon, 10 Mar 2025 13:23:26 +0100 [thread overview]
Message-ID: <b9da5d35-1845-4879-9046-31638db1ee91@intel.com> (raw)
In-Reply-To: <20250224130807.9249-4-dominik.karol.piatkowski@intel.com>
Hi Dominik,
On 24.02.2025 14:08, Dominik Karol Piątkowski wrote:
> Add a test that sends SIGINT to the debugger thread with random timing
> and checks if nothing breaks, exercising the scenario multiple times.
I have to admit I don't quite understand what this test is supposed to
test. The worker loop you are interrupting polls for new events and
reads them via a ioctl. Trying to understand what this test could test I
think I found a corner case of our read_event ioctl. We can end up with
a resource leak and missing event when the interrupt would happen during
copy_to_user (after the event got pulled from the fifo, and before it
got freed) but besides the possibility that this case would be triggered
it would still go unnoticed by this test.
It feels to me like it is more a test for our IGT lib and session
handling than actual Xe eudebug functionality. But I may be missing
something here and perhaps a more verbose explanation of the intention
of this test would prove me wrong.
Regards,
Christoph
>
> Signed-off-by: Dominik Karol Piątkowski <dominik.karol.piatkowski@intel.com>
> ---
> tests/intel/xe_eudebug_online.c | 75 +++++++++++++++++++++++++++++++++
> 1 file changed, 75 insertions(+)
>
> diff --git a/tests/intel/xe_eudebug_online.c b/tests/intel/xe_eudebug_online.c
> index 472013fe1..8a97c8066 100644
> --- a/tests/intel/xe_eudebug_online.c
> +++ b/tests/intel/xe_eudebug_online.c
> @@ -1506,6 +1506,77 @@ static void test_set_breakpoint_online(int fd, struct drm_xe_engine_class_instan
> online_debug_data_destroy(data);
> }
>
> +/**
> + * SUBTEST: set-breakpoint-sigint-debugger
> + * Description:
> + * A variant of set-breakpoint that sends SIGINT to the debugger thread with random timing
> + * and checks if nothing breaks, exercising the scenario multiple times.
> + */
> +static void test_set_breakpoint_online_sigint_debugger(int fd,
> + struct drm_xe_engine_class_instance *hwe,
> + int flags)
> +{
> + struct xe_eudebug_session *s;
> + struct online_debug_data *data;
> + struct timespec ts = { };
> + int loop_count = 0;
> + uint64_t sleep_time;
> + uint64_t set_breakpoint_time;
> + uint64_t max_sleep_time;
> +
> + /*
> + * Measure the average time required for basic set-breakpoint variant,
> + * so sleep_time range is correct.
> + */
> + igt_nsec_elapsed(&ts);
> + for (int i = 0; i < 10; i++)
> + test_set_breakpoint_online(fd, hwe, SHADER_NOP | TRIGGER_UFENCE_SET_BREAKPOINT);
> + set_breakpoint_time = igt_nsec_elapsed(&ts) / (NSEC_PER_MSEC / USEC_PER_MSEC) / 10;
> + igt_info("Average set-breakpoint execution time: %" PRIu64 " us\n", set_breakpoint_time);
> + max_sleep_time = set_breakpoint_time * 11 / 10;
> + igt_info("Maximum sleep_time: %" PRIu64 " us\n", max_sleep_time);
> +
> + ts = (struct timespec) { };
> + igt_nsec_elapsed(&ts);
> +
> + while (igt_seconds_elapsed(&ts) < 60) {
> + sleep_time = rand() % max_sleep_time;
> + igt_debug("Loop %d: SIGINT after %" PRIu64 " us\n", ++loop_count, sleep_time);
> +
> + data = online_debug_data_create(hwe);
> + s = xe_eudebug_session_create(fd, run_online_client, flags, data);
> + xe_eudebug_debugger_add_trigger(s->debugger, DRM_XE_EUDEBUG_EVENT_OPEN,
> + open_trigger);
> + xe_eudebug_debugger_add_trigger(s->debugger, DRM_XE_EUDEBUG_EVENT_EXEC_QUEUE,
> + exec_queue_trigger);
> + xe_eudebug_debugger_add_trigger(s->debugger, DRM_XE_EUDEBUG_EVENT_VM,
> + vm_open_trigger);
> + xe_eudebug_debugger_add_trigger(s->debugger, DRM_XE_EUDEBUG_EVENT_METADATA,
> + create_metadata_trigger);
> + xe_eudebug_debugger_add_trigger(s->debugger, DRM_XE_EUDEBUG_EVENT_VM_BIND_UFENCE,
> + ufence_ack_set_bp_trigger);
> + xe_eudebug_debugger_add_trigger(s->debugger, DRM_XE_EUDEBUG_EVENT_EU_ATTENTION,
> + eu_attention_resume_trigger);
> +
> + igt_assert_eq(xe_eudebug_debugger_attach(s->debugger, s->client), 0);
> + xe_eudebug_debugger_start_worker(s->debugger);
> + xe_eudebug_client_start(s->client);
> +
> + usleep(sleep_time);
> + igt_assert_eq(pthread_kill(s->debugger->worker_thread, SIGINT), 0);
> + close(s->debugger->fd);
> + s->debugger->worker_state = DEBUGGER_WORKER_INACTIVE;
> +
> + xe_eudebug_client_wait_done(s->client);
> +
> + xe_eudebug_event_log_print(s->debugger->log, true);
> + xe_eudebug_event_log_print(s->client->log, true);
> +
> + xe_eudebug_session_destroy(s);
> + online_debug_data_destroy(data);
> + }
> +}
> +
> /**
> * SUBTEST: pagefault-read
> * Description:
> @@ -2426,6 +2497,10 @@ igt_main
> test_gt_render_or_compute("set-breakpoint", fd, hwe)
> test_set_breakpoint_online(fd, hwe, SHADER_NOP | TRIGGER_UFENCE_SET_BREAKPOINT);
>
> + test_gt_render_or_compute("set-breakpoint-sigint-debugger", fd, hwe)
> + test_set_breakpoint_online_sigint_debugger(fd, hwe,
> + SHADER_NOP | TRIGGER_UFENCE_SET_BREAKPOINT);
> +
> test_gt_render_or_compute("breakpoint-not-in-debug-mode", fd, hwe)
> test_basic_online(fd, hwe, SHADER_BREAKPOINT | DISABLE_DEBUG_MODE);
>
next prev parent reply other threads:[~2025-03-10 12:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-24 13:08 [PATCH i-g-t 0/3] tests/xe_eudebug_online: Add set-breakpoint-sigint-debugger test Dominik Karol Piątkowski
2025-02-24 13:08 ` [PATCH i-g-t 1/3] lib/eudebug: Make debugger thread SIGINTable Dominik Karol Piątkowski
2025-03-10 11:40 ` Mika Kuoppala
2025-02-24 13:08 ` [PATCH i-g-t 2/3] lib/eudebug: Fix xe_eudebug_client_stop corner case Dominik Karol Piątkowski
2025-03-10 12:00 ` Mika Kuoppala
2025-02-24 13:08 ` [PATCH i-g-t 3/3] tests/xe_eudebug_online: Add set-breakpoint-sigint-debugger test Dominik Karol Piątkowski
2025-03-10 12:23 ` Manszewski, Christoph [this message]
2025-03-11 13:54 ` Piatkowski, Dominik Karol
2025-02-25 7:47 ` ✓ Xe.CI.BAT: success for " Patchwork
2025-02-25 7:53 ` ✗ i915.CI.BAT: failure " Patchwork
2025-02-25 13:37 ` ✗ 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=b9da5d35-1845-4879-9046-31638db1ee91@intel.com \
--to=christoph.manszewski@intel.com \
--cc=dominik.grzegorzek@intel.com \
--cc=dominik.karol.piatkowski@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jan.sokolowski@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