diff mbox

[igt,2/2] lib/core: Don't leak dummyloads between subtests

Message ID 20171212122105.26487-2-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Dec. 12, 2017, 12:21 p.m. UTC
If a test fails or skips early, it may not clean up after itself. In
lieu of having a framework for test deconstructors, hook
igt_terminate_spin_batches() into exit_subtest() itself so that we don't
allow a recursive batch from an earlier test to leak into the next and
cause an unexpected GPU hang.

Similarly, we also want to terminate the dummyload as the first step in
our atexit handlers (currently it is at the start of the last step) as
some atexit handlers may be unwittingly exposed to dummyloads and so
cause another wait on GPU hang.

We trust that the core already distinguishes correctly between the
principal test process and its children.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 lib/igt_core.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Tvrtko Ursulin Dec. 12, 2017, 3:57 p.m. UTC | #1
On 12/12/2017 12:21, Chris Wilson wrote:
> If a test fails or skips early, it may not clean up after itself. In
> lieu of having a framework for test deconstructors, hook
> igt_terminate_spin_batches() into exit_subtest() itself so that we don't
> allow a recursive batch from an earlier test to leak into the next and
> cause an unexpected GPU hang.
> 
> Similarly, we also want to terminate the dummyload as the first step in
> our atexit handlers (currently it is at the start of the last step) as
> some atexit handlers may be unwittingly exposed to dummyloads and so
> cause another wait on GPU hang.
> 
> We trust that the core already distinguishes correctly between the
> principal test process and its children.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   lib/igt_core.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 777687b5f..558a538d3 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -63,6 +63,7 @@
>   #include "intel_chipset.h"
>   #include "intel_io.h"
>   #include "igt_debugfs.h"
> +#include "igt_dummyload.h"
>   #include "version.h"
>   #include "config.h"
>   
> @@ -994,6 +995,8 @@ static void exit_subtest(const char *result)
>   		 (!__igt_plain_output) ? "\x1b[0m" : "");
>   	fflush(stdout);
>   
> +	igt_terminate_spin_batches();
> +
>   	in_subtest = NULL;
>   	siglongjmp(igt_subtest_jmpbuf, 1);
>   }
> @@ -1817,6 +1820,8 @@ static void call_exit_handlers(int sig)
>   {
>   	int i;
>   
> +	igt_terminate_spin_batches();
> +
>   	if (!exit_handler_count) {
>   		return;
>   	}
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko
diff mbox

Patch

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 777687b5f..558a538d3 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -63,6 +63,7 @@ 
 #include "intel_chipset.h"
 #include "intel_io.h"
 #include "igt_debugfs.h"
+#include "igt_dummyload.h"
 #include "version.h"
 #include "config.h"
 
@@ -994,6 +995,8 @@  static void exit_subtest(const char *result)
 		 (!__igt_plain_output) ? "\x1b[0m" : "");
 	fflush(stdout);
 
+	igt_terminate_spin_batches();
+
 	in_subtest = NULL;
 	siglongjmp(igt_subtest_jmpbuf, 1);
 }
@@ -1817,6 +1820,8 @@  static void call_exit_handlers(int sig)
 {
 	int i;
 
+	igt_terminate_spin_batches();
+
 	if (!exit_handler_count) {
 		return;
 	}