Re: [PATCH v4] drm/i915/selftests: Wait for the dma-fence timeout

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

 



Quoting Tvrtko Ursulin (2018-01-17 14:25:17)
> 
> On 17/01/2018 13:57, Chris Wilson wrote:
> > When testing that the timeout fired, we need to be sure we have waited
> > just long enough for the timeout to have occurred and for the softirq
> > (on another cpu) to have completed. Sleeping for an arbitrary amount is
> > prone to error, so wait for the timeout instead and complain if it was
> > too late.
> > 
> > v2: Use wait_event_timeout to provide an upper bound
> > v3: Fix inverted check for wait_event_timeout timing out
> > v4: Restore the check that the fences aren't signalled too early, by
> > inspecting them before the expected timeout.
> > 
> > References: https://bugs.freedesktop.org/show_bug.cgi?id=104670
> > Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
> > ---
> >   drivers/gpu/drm/i915/selftests/i915_sw_fence.c | 18 ++++++++----------
> >   1 file changed, 8 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/selftests/i915_sw_fence.c b/drivers/gpu/drm/i915/selftests/i915_sw_fence.c
> > index 4fb51deb81a1..570e325af93e 100644
> > --- a/drivers/gpu/drm/i915/selftests/i915_sw_fence.c
> > +++ b/drivers/gpu/drm/i915/selftests/i915_sw_fence.c
> > @@ -693,7 +693,8 @@ static int test_dma_fence(void *arg)
> >       sleep = jiffies_to_usecs(delay) / 3;
> >       usleep_range(sleep, 2 * sleep);
> >       if (time_after(jiffies, end)) {
> > -             pr_debug("Slept too long, delay=%lu, skipping!\n", delay);
> > +             pr_debug("Slept too long, delay=%lu, (target=%lu, now=%lu) skipping\n",
> > +                      delay, end, jiffies);
> >               goto skip;
> >       }
> >   
> > @@ -702,18 +703,15 @@ static int test_dma_fence(void *arg)
> >               goto err;
> >       }
> >   
> > -     do {
> > -             sleep = jiffies_to_usecs(end - jiffies + 1);
> > -             usleep_range(sleep, 2 * sleep);
> > -     } while (!time_after(jiffies, end));
> > -
> > -     if (i915_sw_fence_done(not)) {
> > -             pr_err("No timeout fence signaled!\n");
> > +     if (!wait_event_timeout(timeout->wait,
> > +                             i915_sw_fence_done(timeout),
> > +                             2 * (end - jiffies) + 1)) {
> > +             pr_err("Timeout fence unsignaled!\n");
> >               goto err;
> >       }
> >   
> > -     if (!i915_sw_fence_done(timeout)) {
> > -             pr_err("Timeout fence unsignaled!\n");
> > +     if (i915_sw_fence_done(not)) {
> > +             pr_err("No timeout fence signaled!\n");
> >               goto err;
> >       }
> >   
> > 
> 
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>

Ta and pushed,
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux