aux: Suspend signal helper for shell commands
PATCH v2 1/2 aux: Suspend signal helper for shell commands
The clone() system call with a larger executable (like /bin/sh) may have difficulty to make progress on some platforms if interrupted frequently. So suspend the signal helper process for the duration of the syscall. This is needed to solve an actual problem by the next patch.
v2:
- Clarify/fix code comments. (Chris)
- Update igt_system_quiet() as well accordingly.
--- lib/igt_aux.c | 38 ++++++++++++++++++++++++++++++++++++++ lib/igt_aux.h | 2 ++ lib/igt_core.c | 16 ++++++++++++++++ 3 files changed, 56 insertions(+)
lib/igt_aux.c +38 -0
@@ -350,6 +350,44 @@ void igt_stop_signal_helper(void) sig_stat =0 ; } +/** +* igt_suspend_signal_helper: +* +* Suspends the child process spawned with igt_fork_signal_helper(). This +* should be called before a critical section of code that has difficulty to +* make progress if interrupted frequently, like the clone() syscall called +* from a largish executable. igt_resume_signal_helper() must be called after +* the critical section to restart interruptions for the test. +*/ +void igt_suspend_signal_helper (void ) +{ +int status; + +if (!signal_helper.running) +return ; + +kill (signal_helper.pid,SIGSTOP ); +while (waitpid (signal_helper.pid, &status,WUNTRACED ) ==-1 && + errno ==EINTR ) + ; +} + +/** +* igt_resume_signal_helper: +* +* Resumes the child process spawned with igt_fork_signal_helper(). +* +* This should be paired with igt_suspend_signal_helper() and called after the +* problematic code sensitive to signals. +*/ +void igt_resume_signal_helper (void ) +{ +if (!signal_helper.running) +return ; + +kill (signal_helper.pid,SIGCONT ); +} +static struct igt_helper_process shrink_helper;static void __attribute__((noreturn))shrink_helper_process (int fd,pid_t pid) {
lib/igt_aux.h +2 -0
@@ -55,6 +55,8 @@ extern int num_trash_bos;/* generally useful helpers */ void igt_fork_signal_helper (void );void igt_stop_signal_helper (void ); +void igt_suspend_signal_helper (void ); +void igt_resume_signal_helper (void );void igt_fork_shrink_helper (int fd);void igt_stop_shrink_helper (void );
lib/igt_core.c +16 -0
@@ -2282,6 +2282,13 @@ int igt_system(const char *command)if (pipe (errpipe) <0 ) goto err; +/* +* The clone() system call called from a largish executable has +* difficulty to make progress if interrupted too frequently, so +* suspend the signal helper for the time of the syscall. +*/ +igt_suspend_signal_helper (); + igt_fork_helper(&process) {close (outpipe[0 ]);close (errpipe[0 ]);
@@ -2298,6 +2305,8 @@ int igt_system(const char *command)exit (EXIT_FAILURE ); } +igt_resume_signal_helper (); +close (outpipe[1 ]);close (errpipe[1 ]);
@@ -2340,9 +2349,14 @@ int igt_system_quiet(const char *command)if (dup2 (nullfd,STDERR_FILENO ) ==-1 ) goto err; +/* See igt_system() for the reason for suspending the signal helper. */ +igt_suspend_signal_helper (); +if ((status =system (command)) ==-1 ) goto err; +igt_resume_signal_helper (); +/* restore */ if (dup2 (stdout_fd_copy,STDOUT_FILENO ) ==-1 ) goto err;
@@ -2355,6 +2369,8 @@ int igt_system_quiet(const char *command)return WEXITSTATUS (status); err: +igt_resume_signal_helper (); +close (stderr_fd_copy);close (stdout_fd_copy);close (nullfd);
Signature · 6 lines
2.13.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/2 aux: Use IGT version of system() call to run rtcwake
The clone() system call has difficulty to make progress if interrupted frequently by the signal helper process. At least on an APL, like in the Bugzilla ticket below, this can introduce minutes of overhead to a single system() call (leading to a global CI timeout). To get rid of the overhead suspend the signal helper process for the duration of the system() call, which is provided already by igt_system().
Cc: Chris Wilson <[email protected]>
Cc: Daniel Vetter <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103160
--- lib/igt_aux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/igt_aux.c +2 -2
@@ -794,7 +794,7 @@ static void suspend_via_rtcwake(enum igt_suspend_state state)*/ snprintf (cmd,sizeof (cmd),"rtcwake -n -s %d -m %s " SQUELCH , delay, suspend_state_name[state]); - ret =system (cmd); + ret =igt_system (cmd); igt_require_f(ret == 0, "rtcwake test failed with %i\n" "This failure could mean that something is wrong with " "the rtcwake tool or how your distro is set up.\n",
@@ -802,7 +802,7 @@ static void suspend_via_rtcwake(enum igt_suspend_state state)snprintf (cmd,sizeof (cmd),"rtcwake -s %d -m %s " , delay, suspend_state_name[state]); - ret =system (cmd); + ret =igt_system (cmd); igt_assert_f(ret == 0, "rtcwake failed with %i\n" "Check dmesg for further details.\n",
Signature · 6 lines
2.13.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for series starting with [v2,1/2] aux: Suspend signal helper for shell commands
In reply to Imre Deak== Series Details ==
== Series Details ==
Series: series starting with [v2,1/2] aux: Suspend signal helper for shell commands
URL : https://patchwork.freedesktop.org/series/31908/
State : failure
== Summary ==
IGT patchset tested on top of latest successful build 58616272b23efce1e62a3ee0d37e13de6ffc012f igt/gem_eio: Check hang/eio recovery during suspend
with latest DRM-Tip kernel build CI_DRM_3228b2c76c5c6dce drm-tip: 2017y-10m-13d-09h-16m-12s UTC integration manifest
No testlist changes.
Test kms_pipe_crc_basic:
Subgroup hang-read-crc-pipe-b:
pass -> INCOMPLETE (fi-snb-2520m)fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:457s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:475s fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:395s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:574s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:289s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:522s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:519s fi-byt-j1900 total:289 pass:253 dwarn:1 dfail:0 fail:0 skip:35 time:541s fi-byt-n2820 total:289 pass:249 dwarn:1 dfail:0 fail:0 skip:39 time:528s fi-cfl-s total:289 pass:253 dwarn:4 dfail:0 fail:0 skip:32 time:560s fi-cnl-y total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:633s fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:432s fi-gdg-551 total:289 pass:178 dwarn:1 dfail:0 fail:1 skip:109 time:278s fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:605s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:441s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:466s fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:505s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:477s fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:501s fi-kbl-7567u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:486s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:582s fi-pnv-d510 total:289 pass:222 dwarn:1 dfail:0 fail:0 skip:66 time:657s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:480s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:666s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:544s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:560s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:479s fi-snb-2520m total:231 pass:202 dwarn:0 dfail:0 fail:0 skip:28 fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:0 skip:40 time:433s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_349/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.IGT: warning for series starting with [v2,1/2] aux: Suspend signal helper for shell commands
In reply to Imre Deak== Series Details ==
== Series Details ==
Series: series starting with [v2,1/2] aux: Suspend signal helper for shell commands
URL : https://patchwork.freedesktop.org/series/31908/
State : warning
== Summary ==
Test gem_userptr_blits:
Subgroup sync-unmap-cycles:
pass -> DMESG-WARN (shard-hsw) fdo#103251
Test kms_setmode:
Subgroup basic:
fail -> PASS (shard-hsw) fdo#99912
Test kms_atomic_transition:
Subgroup plane-toggle-modeset-transition:
dmesg-warn -> PASS (shard-hsw) fdo#102614
Test kms_busy:
Subgroup extended-modeset-hang-newfb-with-reset-render-A:
pass -> DMESG-WARN (shard-hsw)
Test kms_flip:
Subgroup plain-flip-fb-recreate-interruptible:
pass -> FAIL (shard-hsw) fdo#100368fdo#103251 https://bugs.freedesktop.org/show_bug.cgi?id=103251
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
shard-hsw total:2553 pass:1438 dwarn:3 dfail:0 fail:9 skip:1103 time:9615s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_349/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: ✗ Fi.CI.IGT: warning for series starting with [v2,1/2] aux: Suspend signal helper for shell commands
Quoted 29 lines · Patchwork
== Series Details ==
Series: series starting with [v2,1/2] aux: Suspend signal helper for shell commands
URL : https://patchwork.freedesktop.org/series/31908/
State : warning== Summary ==
Test
gem_userptr_blits:Subgroup sync-unmap-cycles: pass -> DMESG-WARN (shard-hsw) fdo#103251 Test kms_setmode: Subgroup basic: fail -> PASS (shard-hsw) fdo#99912 Test kms_atomic_transition: Subgroup plane-toggle-modeset-transition: dmesg-warn -> PASS (shard-hsw) fdo#102614 Test kms_busy: Subgroup extended-modeset-hang-newfb-with-reset-render-A: pass -> DMESG-WARN (shard-hsw) Test kms_flip: Subgroup plain-flip-fb-recreate-interruptible: pass -> FAIL (shard-hsw) fdo#100368fdo#103251 https://bugs.freedesktop.org/show_bug.cgi?id=103251
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
Quoted 5 lines
shard-hsw total:2553 pass:1438 dwarn:3 dfail:0 fail:9 skip:1103 time:9615s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_349/shards.html
Only visible when clicking on the link, but the the following tests on APL changed from hang to pass:
kms_flip@vblank-vs-modeset-suspend-interruptible
kms_flip@vblank-vs-suspend-interruptible
The following went from pass to hang:
kms_flip@flip-vs-modeset-interruptible
due to the following unrelated problem:
<2>[ 88.159865] kernel BUG at drivers/gpu/drm/i915/intel_lrc.c:880! <4>[ 88.159905] invalid opcode: 0000 [#1] PREEMPT SMP
The following went from pass to fail:
kms_flip@plain-flip-fb-recreate-interruptible
due to the following unrelated problem (fdo#100368):
(kms_flip:1690) CRITICAL: Test assertion failure function calibrate_ts, file kms_flip.c:1200:
(kms_flip:1690) CRITICAL: Failed assertion: ev.sequence == last_seq + 1
Based on the above I'll merge the patches.
--Imre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: ✗ Fi.CI.IGT: warning for series starting with [v2,1/2] aux: Suspend signal helper for shell commands
Quoted 8 lines · Imre Deak
Quoted 7 lines · Patchwork
== Series Details ==
Series: series starting with [v2,1/2] aux: Suspend signal helper for shell commands
URL : https://patchwork.freedesktop.org/series/31908/
State : warning== Summary ==
Thanks for the reviews, I pushed the patches to igt.
Quoted 48 lines
Quoted 22 lines
Test
gem_userptr_blits:Subgroup sync-unmap-cycles: pass -> DMESG-WARN (shard-hsw) fdo#103251 Test kms_setmode: Subgroup basic: fail -> PASS (shard-hsw) fdo#99912 Test kms_atomic_transition: Subgroup plane-toggle-modeset-transition: dmesg-warn -> PASS (shard-hsw) fdo#102614 Test kms_busy: Subgroup extended-modeset-hang-newfb-with-reset-render-A: pass -> DMESG-WARN (shard-hsw) Test kms_flip: Subgroup plain-flip-fb-recreate-interruptible: pass -> FAIL (shard-hsw) fdo#100368fdo#103251 https://bugs.freedesktop.org/show_bug.cgi?id=103251
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368Quoted 5 lines
shard-hsw total:2553 pass:1438 dwarn:3 dfail:0 fail:9 skip:1103 time:9615s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_349/shards.html
Only visible when clicking on the link, but the the following tests on APL changed from hang to pass:
kms_flip@vblank-vs-modeset-suspend-interruptible
kms_flip@vblank-vs-suspend-interruptibleThe following went from pass to hang:
kms_flip@flip-vs-modeset-interruptibledue to the following unrelated problem:
<2>[ 88.159865] kernel BUG at drivers/gpu/drm/i915/intel_lrc.c:880! <4>[ 88.159905] invalid opcode: 0000 [#1] PREEMPT SMPThe following went from pass to fail:
kms_flip@plain-flip-fb-recreate-interruptibledue to the following unrelated problem (fdo#100368):
(kms_flip:1690) CRITICAL: Test assertion failure functioncalibrate_ts, file kms_flip.c:1200:
(kms_flip:1690) CRITICAL: Failed assertion: ev.sequence ==last_seq+ 1
Quoted 7 lines
Based on the above I'll merge the patches.
--Imre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx