All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t v2 1/2] aux: Suspend signal helper for shell commands
@ 2017-10-13 11:30 Imre Deak
  2017-10-13 11:30 ` [PATCH i-g-t v2 2/2] aux: Use IGT version of system() call to run rtcwake Imre Deak
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Imre Deak @ 2017-10-13 11:30 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter

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.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v1)
---
 lib/igt_aux.c  | 38 ++++++++++++++++++++++++++++++++++++++
 lib/igt_aux.h  |  2 ++
 lib/igt_core.c | 16 ++++++++++++++++
 3 files changed, 56 insertions(+)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index fa6594c3..8dde9a12 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -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)
 {
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index 499a1679..688ad1b8 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -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);
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 950ea9b0..538a4472 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -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);
-- 
2.13.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH i-g-t v2 2/2] aux: Use IGT version of system() call to run rtcwake
  2017-10-13 11:30 [PATCH i-g-t v2 1/2] aux: Suspend signal helper for shell commands Imre Deak
@ 2017-10-13 11:30 ` Imre Deak
  2017-10-13 12:09 ` ✗ Fi.CI.BAT: failure for series starting with [v2,1/2] aux: Suspend signal helper for shell commands Patchwork
  2017-10-16  8:29 ` ✗ Fi.CI.IGT: warning " Patchwork
  2 siblings, 0 replies; 6+ messages in thread
From: Imre Deak @ 2017-10-13 11:30 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter

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 <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103160
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/igt_aux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 8dde9a12..ee53559c 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -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",
-- 
2.13.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* ✗ Fi.CI.BAT: failure for series starting with [v2,1/2] aux: Suspend signal helper for shell commands
  2017-10-13 11:30 [PATCH i-g-t v2 1/2] aux: Suspend signal helper for shell commands Imre Deak
  2017-10-13 11:30 ` [PATCH i-g-t v2 2/2] aux: Use IGT version of system() call to run rtcwake Imre Deak
@ 2017-10-13 12:09 ` Patchwork
  2017-10-16  8:29 ` ✗ Fi.CI.IGT: warning " Patchwork
  2 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2017-10-13 12:09 UTC (permalink / raw)
  To: Imre Deak; +Cc: intel-gfx

== 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_3228
b2c76c5c6dce 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
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* ✗ Fi.CI.IGT: warning for series starting with [v2,1/2] aux: Suspend signal helper for shell commands
  2017-10-13 11:30 [PATCH i-g-t v2 1/2] aux: Suspend signal helper for shell commands Imre Deak
  2017-10-13 11:30 ` [PATCH i-g-t v2 2/2] aux: Use IGT version of system() call to run rtcwake Imre Deak
  2017-10-13 12:09 ` ✗ Fi.CI.BAT: failure for series starting with [v2,1/2] aux: Suspend signal helper for shell commands Patchwork
@ 2017-10-16  8:29 ` Patchwork
  2017-10-16  9:15   ` Imre Deak
  2 siblings, 1 reply; 6+ messages in thread
From: Patchwork @ 2017-10-16  8:29 UTC (permalink / raw)
  To: Imre Deak; +Cc: intel-gfx

== 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#100368

fdo#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
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ✗ Fi.CI.IGT: warning for series starting with [v2,1/2] aux: Suspend signal helper for shell commands
  2017-10-16  8:29 ` ✗ Fi.CI.IGT: warning " Patchwork
@ 2017-10-16  9:15   ` Imre Deak
  2017-10-16 10:45     ` Imre Deak
  0 siblings, 1 reply; 6+ messages in thread
From: Imre Deak @ 2017-10-16  9:15 UTC (permalink / raw)
  To: intel-gfx, Chris Wilson, Petri Latvala

On Mon, Oct 16, 2017 at 08:29:39AM +0000, Patchwork wrote:
> == 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#100368
> 
> fdo#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

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
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ✗ Fi.CI.IGT: warning for series starting with [v2,1/2] aux: Suspend signal helper for shell commands
  2017-10-16  9:15   ` Imre Deak
@ 2017-10-16 10:45     ` Imre Deak
  0 siblings, 0 replies; 6+ messages in thread
From: Imre Deak @ 2017-10-16 10:45 UTC (permalink / raw)
  To: intel-gfx, Chris Wilson, Petri Latvala, Daniel Vetter

On Mon, Oct 16, 2017 at 12:15:27PM +0300, Imre Deak wrote:
> On Mon, Oct 16, 2017 at 08:29:39AM +0000, Patchwork wrote:
> > == 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.

> > 
> > 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#100368
> > 
> > fdo#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
> 
> 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
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-10-16 10:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-13 11:30 [PATCH i-g-t v2 1/2] aux: Suspend signal helper for shell commands Imre Deak
2017-10-13 11:30 ` [PATCH i-g-t v2 2/2] aux: Use IGT version of system() call to run rtcwake Imre Deak
2017-10-13 12:09 ` ✗ Fi.CI.BAT: failure for series starting with [v2,1/2] aux: Suspend signal helper for shell commands Patchwork
2017-10-16  8:29 ` ✗ Fi.CI.IGT: warning " Patchwork
2017-10-16  9:15   ` Imre Deak
2017-10-16 10:45     ` Imre Deak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.