summaryrefslogtreecommitdiff
path: root/tests/i915/gem_exec_schedule.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-02-07 21:00:54 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2019-02-08 09:05:48 +0000
commitcec046d72944a2d559ce5bd83358f08f20454005 (patch)
tree22438238149106221e663c974dd75c4232f8b41a /tests/i915/gem_exec_schedule.c
parent09f506726d0e115ee7f4a1604ae71adcf9f12690 (diff)
i915/gem_exec_schedule: Rebuild signal handler in child
Make sure that the SIGARLM handler is captured so that we don't accidentally shoot ourselves in the foot instead of merely waking up the execbuf. The test is hitting child 0 died with signal 14, Alarm clock when we expect it to be hitting the inherited signal handler across the fork. Which is odd. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Diffstat (limited to 'tests/i915/gem_exec_schedule.c')
-rw-r--r--tests/i915/gem_exec_schedule.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/i915/gem_exec_schedule.c b/tests/i915/gem_exec_schedule.c
index 0462ce84..d11e5736 100644
--- a/tests/i915/gem_exec_schedule.c
+++ b/tests/i915/gem_exec_schedule.c
@@ -1087,6 +1087,7 @@ static void test_pi_ringfull(int fd, unsigned int engine)
unsigned int last, count;
struct itimerval itv;
IGT_CORK_HANDLE(c);
+ uint32_t vip;
bool *result;
result = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
@@ -1101,9 +1102,16 @@ static void test_pi_ringfull(int fd, unsigned int engine)
execbuf.buffers_ptr = to_user_pointer(&obj[1]);
execbuf.buffer_count = 1;
execbuf.flags = engine;
+
+ /* Warm up both (hi/lo) contexts */
execbuf.rsvd1 = gem_context_create(fd);
- gem_context_set_priority(fd, execbuf.rsvd1, MIN_PRIO);
+ gem_context_set_priority(fd, execbuf.rsvd1, MAX_PRIO);
+ gem_execbuf(fd, &execbuf);
+ gem_sync(fd, obj[1].handle);
+ vip = execbuf.rsvd1;
+ execbuf.rsvd1 = gem_context_create(fd);
+ gem_context_set_priority(fd, execbuf.rsvd1, MIN_PRIO);
gem_execbuf(fd, &execbuf);
gem_sync(fd, obj[1].handle);
@@ -1147,14 +1155,12 @@ static void test_pi_ringfull(int fd, unsigned int engine)
igt_fork(child, 1) {
result[0] = true;
- igt_debug("Creating HP context\n");
- execbuf.rsvd1 = gem_context_create(fd);
- gem_context_set_priority(fd, execbuf.rsvd1, MAX_PRIO);
-
+ igt_debug("Waking parent\n");
kill(getppid(), SIGALRM);
sched_yield();
result[1] = true;
+ sigaction(SIGALRM, &sa, NULL);
itv.it_value.tv_sec = 0;
itv.it_value.tv_usec = 10000;
setitimer(ITIMER_REAL, &itv, NULL);
@@ -1163,8 +1169,8 @@ static void test_pi_ringfull(int fd, unsigned int engine)
* able to add ourselves to *our* ring without interruption.
*/
igt_debug("HP child executing\n");
+ execbuf.rsvd1 = vip;
result[2] = __execbuf(fd, &execbuf) == 0;
- gem_context_destroy(fd, execbuf.rsvd1);
}
/* Relinquish CPU just to allow child to create a context */
@@ -1186,6 +1192,7 @@ static void test_pi_ringfull(int fd, unsigned int engine)
igt_waitchildren();
gem_context_destroy(fd, execbuf.rsvd1);
+ gem_context_destroy(fd, vip);
gem_close(fd, obj[1].handle);
gem_close(fd, obj[0].handle);
munmap(result, 4096);