Re: [igt-dev] [PATCH i-g-t] i915/gem_exec_schedule: Rebuild signal handler in child

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Chris Wilson (2019-02-07 23:03:08)
> 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.
> 
> Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>

Warming up the context ahead of time is reasonable for super low SKUs.

But the SIGALRM handler should be inherted, so that's a red herring.

With the commit message and title adjusted for warming up the context:

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>

Regards, Joonas

> ---
>  tests/i915/gem_exec_schedule.c | 19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/i915/gem_exec_schedule.c b/tests/i915/gem_exec_schedule.c
> index 0462ce84f..d11e57363 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);
> -- 
> 2.20.1
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux