From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: "Dominik Karol Piątkowski" <dominik.karol.piatkowski@intel.com>,
igt-dev@lists.freedesktop.org
Cc: "Dominik Grzegorzek" <dominik.grzegorzek@intel.com>,
"Christoph Manszewski" <christoph.manszewski@intel.com>,
"Jan Sokolowski" <jan.sokolowski@intel.com>,
"Dominik Karol Piątkowski" <dominik.karol.piatkowski@intel.com>
Subject: Re: [PATCH i-g-t 1/3] lib/eudebug: Make debugger thread SIGINTable
Date: Mon, 10 Mar 2025 13:40:21 +0200 [thread overview]
Message-ID: <87senlktay.fsf@mkuoppal-desk> (raw)
In-Reply-To: <20250224130807.9249-2-dominik.karol.piatkowski@intel.com>
Dominik Karol Piątkowski <dominik.karol.piatkowski@intel.com> writes:
> Due to the fact that `pthread_kill(thread, SIGINT)` results in SIGINTing
> all of the threads - including main thread - by default, testcases that
> send SIGINT to debugger thread are crashing.
>
> Introduce SIGINT signal handler for debugger thread to fix this.
>
> Signed-off-by: Dominik Karol Piątkowski <dominik.karol.piatkowski@intel.com>
> ---
> lib/xe/xe_eudebug.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/lib/xe/xe_eudebug.c b/lib/xe/xe_eudebug.c
> index 1205d945b..ad8bdf68a 100644
> --- a/lib/xe/xe_eudebug.c
> +++ b/lib/xe/xe_eudebug.c
> @@ -1050,6 +1050,11 @@ xe_eudebug_read_event(int fd, struct drm_xe_eudebug_event *event)
> return ret;
> }
>
> +static void terminate_debugger(int sig)
> +{
> + pthread_exit(NULL);
> +}
> +
> static void *debugger_worker_loop(void *data)
> {
> uint8_t buf[MAX_EVENT_SIZE];
> @@ -1060,9 +1065,14 @@ static void *debugger_worker_loop(void *data)
> .revents = 0,
> };
> int timeout_ms = 100, ret;
> + struct sigaction sa;
We should be safe to assume sigaction initializes everything
that it will use. Regarless sa = { 0 }; would help to convince
the reader that everything will be allright.
Regarless,
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
>
> igt_assert(d->master_fd >= 0);
>
> + igt_assert_eq(sigaction(SIGINT, NULL, &sa), 0);
> + sa.sa_handler = terminate_debugger;
> + igt_assert_eq(sigaction(SIGINT, &sa, NULL), 0);
> +
> do {
> p.fd = d->fd;
> ret = poll(&p, 1, timeout_ms);
> --
> 2.34.1
next prev parent reply other threads:[~2025-03-10 11:40 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 [this message]
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
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=87senlktay.fsf@mkuoppal-desk \
--to=mika.kuoppala@linux.intel.com \
--cc=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