From mboxrd@z Thu Jan 1 00:00:00 1970 From: Imre Deak Subject: Re: [PATCH] drm/i915: fix DP AUX errors due to false timeouts when using wait_event_timeout Date: Thu, 02 May 2013 12:33:21 +0300 Message-ID: <1367487201.3969.3.camel@ideak-mobl> References: <1367485203-4533-1-git-send-email-imre.deak@intel.com> <20130502091710.GC13946@cantiga.alporthouse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by gabe.freedesktop.org (Postfix) with ESMTP id 208D4E6380 for ; Thu, 2 May 2013 02:33:24 -0700 (PDT) In-Reply-To: <20130502091710.GC13946@cantiga.alporthouse.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Chris Wilson Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Thu, 2013-05-02 at 10:17 +0100, Chris Wilson wrote: > 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. Yes, I've sent a patch for wait_event_timeout() to start the discussion, I'm not sure how long it will take.. --Imre