[Intel-gfx] [PATCH] drm/i915: fix DP AUX errors due to false timeouts when using wait_event_timeout

Chris Wilson chris at chris-wilson.co.uk
Thu May 2 11:17:10 CEST 2013


On Thu, May 02, 2013 at 12:00:03PM +0300, Imre Deak wrote:
> Due to possible scheduling latencies wait_event_timeout doesn't
> guarantee a non-zero return value, even if the condition becomes true
> before the specified timeout expires. Thus we can incorrectly signal a
> timeout and abort a DP AUX transaction.
> 
> If wait_event_timeout returns 0, it's guaranteed that at least the
> specified timeout (minus one jiffies, see below) had passed, so we can
> fix this by checking the condition explicitly in this case.
> 
> Also the timeout that wait_event_timeout() is guaranteed to wait if the
> condition doesn't become true is one less jiffies than what is passed to
> it as a parameter. This is because the absolute expiration time in
> schedule_timeout() may be calculated at a moment close to the next
> scheduling tick, when jiffies is incremented. So make sure we pass always
> a jiffies value of 2 or greater. Here this makes a difference only for
> HZ=100.
> 
> This fixes DP AUX errors I saw during booting on an ILK.
> 
> This should ideally be fixed in wait_event_timeout(), but that can take
> a while. Until that's done use this fix as a band-aid.

As we have 3 such vulnerable callsite in our driver alone, perhaps we
should push for your general fix.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list