Message ID | 1533046208-8757-1-git-send-email-leitao@debian.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | powerpc/selftests: Avoid backgroud process/threads | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | next/apply_patch Successfully applied |
snowpatch_ozlabs/checkpatch | warning | Test checkpatch on branch next |
snowpatch_ozlabs/build-ppc64le | success | Test build-ppc64le on branch next |
snowpatch_ozlabs/build-ppc64be | success | Test build-ppc64be on branch next |
snowpatch_ozlabs/build-ppc64e | success | Test build-ppc64e on branch next |
snowpatch_ozlabs/build-ppc32 | success | Test build-ppc32 on branch next |
Breno Leitao <leitao@debian.org> writes: > Current tm-unavailable test runs for a long period (>120 seconds), and if it is > interrupted, as pressing CRTL-C (SIGINT), the foreground process (harness) dies > but the child process and threads continue to execute (with PPID = 1 now). > > In this case, you'd think the test is gone, but there are two threads being > executed in background, one of the thread ('pong') consumes 100% of the CPU and > the other one ('ping') dumps output message, from time to time, in the STDOUT, > which is annoying. > > This patch simply gets the child process to be SIGTERMed when the parent dies. Hmm, I think we should fix this in the harness if possible. In run_test() it does: /* Kill anything else in the process group that is still running */ kill(-pid, SIGTERM); But that doesn't work if the harness has been killed with Ctrl-C. I think the harness could have a SIGINT handler that basically does the above and then exits? cheers
diff --git a/tools/testing/selftests/powerpc/tm/tm-unavailable.c b/tools/testing/selftests/powerpc/tm/tm-unavailable.c index 156c8e750259..c42f8b60063c 100644 --- a/tools/testing/selftests/powerpc/tm/tm-unavailable.c +++ b/tools/testing/selftests/powerpc/tm/tm-unavailable.c @@ -23,6 +23,8 @@ #include <stdbool.h> #include <pthread.h> #include <sched.h> +#include <signal.h> +#include <sys/prctl.h> #include "tm.h" @@ -342,6 +344,9 @@ int tm_unavailable_test(void) SKIP_IF(!have_htm()); + /* Send me SIGTERM if PPID is dead (as SIGINTed) */ + prctl(PR_SET_PDEATHSIG, SIGTERM); + /* Set only CPU 0 in the mask. Both threads will be bound to CPU 0. */ CPU_ZERO(&cpuset); CPU_SET(0, &cpuset);