[PATCH i-g-t 2/3] lib/eudebug: Fix xe_eudebug_client_stop corner case
Dominik Karol Piątkowski
dominik.karol.piatkowski at intel.com
Mon Feb 24 13:08:06 UTC 2025
After `token_signal(c->p_in, CLIENT_STOP, c->pid)`, the client is
expected to end its work and exit. By the time the waitpid() is called,
the client process may be gone already, resulting in a failed assert.
Fix it by skipping the assert in case of errno being ECHILD, meaning
the process already exited.
Signed-off-by: Dominik Karol Piątkowski <dominik.karol.piatkowski at intel.com>
---
lib/xe/xe_eudebug.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/xe/xe_eudebug.c b/lib/xe/xe_eudebug.c
index ad8bdf68a..58acb1dea 100644
--- a/lib/xe/xe_eudebug.c
+++ b/lib/xe/xe_eudebug.c
@@ -1450,12 +1450,16 @@ void xe_eudebug_client_stop(struct xe_eudebug_client *c)
{
if (c->pid) {
int waitstatus;
+ int ret;
xe_eudebug_client_wait_done(c);
token_signal(c->p_in, CLIENT_STOP, c->pid);
- igt_assert_eq(waitpid(c->pid, &waitstatus, 0),
- c->pid);
+ ret = waitpid(c->pid, &waitstatus, 0);
+ /* process may be gone already */
+ if (!(ret == -1 && errno == ECHILD))
+ igt_assert_eq(ret, c->pid);
+
c->pid = 0;
}
}
--
2.34.1
More information about the igt-dev
mailing list