Hi!

> Reported-by: Jens Axboe <ax...@kernel.dk>
> Link: https://lkml.org/lkml/2015/11/12/621
> Cc: Jens Axboe <ax...@kernel.dk>
> Cc; "Rogozhkin, Dmitry V" <dmitry.v.rogozh...@intel.com>
> Cc: Daniel Vetter <daniel.vet...@ffwll.ch>
> Cc: Tvrtko Ursulin <tvrtko.ursu...@linux.intel.com>
> Cc: Eero Tamminen <eero.t.tammi...@intel.com>
> Cc: "Rantala, Valtteri" <valtteri.rant...@intel.com>
> Cc: sta...@kernel.vger.org
> ---
>  drivers/gpu/drm/i915/i915_gem.c | 28 +++++++++++++++++++++++++---
>  1 file changed, 25 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 740530c571d1..2a88158bd1f7 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1146,14 +1146,36 @@ static bool missed_irq(struct drm_i915_private 
> *dev_priv,
>       return test_bit(ring->id, &dev_priv->gpu_error.missed_irq_rings);
>  }
>  
> +static u64 local_clock_us(unsigned *cpu)
> +{
> +     u64 t;
> +
> +     *cpu = get_cpu();
> +     t = local_clock() >> 10;
> +     put_cpu();
> +
> +     return t;
> +}
> +
> +static bool busywait_stop(u64 timeout, unsigned cpu)
> +{
> +     unsigned this_cpu;
> +
> +     if (time_after64(local_clock_us(&this_cpu), timeout))
> +             return true;
> +
> +     return this_cpu != cpu;
> +}

Perhaps you want to ask the timekeeping people for the right
primitive? I guess you are not the only one needing this..
                                                                        Pavel
                                                                        
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to