From: Chris Wilson <chris@chris-wilson.co.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jeff Chua <jeff.chua.linux@gmail.com>,
Len Brown <len.brown@intel.com>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
Jesse Barnes <jbarnes@virtuousgeek.org>,
Dave Airlie <airlied@linux.ie>,
linux-kernel@vger.kernel.org,
DRI mailing list <dri-devel@lists.freedesktop.org>
Subject: Re: more intel drm issues (was Re: [git pull] drm intel only fixes)
Date: Thu, 20 Jan 2011 17:38:06 +0000 [thread overview]
Message-ID: <0d30dc$kqf9gp@orsmga001.jf.intel.com> (raw)
In-Reply-To: <AANLkTi=AEhztUp30A0o5YxHCqqLg38+f5s+mXfbZTX8Y@mail.gmail.com>
On Thu, 20 Jan 2011 08:07:02 -0800, Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Thu, Jan 20, 2011 at 2:25 AM, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> >
> > Right, the autoreported HEAD may have been already reset to 0 and so hit
> > the wraparound bug which caused it to exit early without actually
> > quiescing the ringbuffer.
>
> Yeah, that would explain the issue.
>
> > Another possibility is that I added a 3s timeout waiting for a request if
> > IRQs were suspended:
>
> No, if IRQ's are actually suspended here, then that codepath is
> totally buggy and would blow up (msleep() doesn't work, and jiffies
> wouldn't advance on UP). So that's not it.
>
> > Both of those I think are symptoms of another problem, that perhaps during
> > suspend we are shutting down parts of the chip before idling?
>
> That could be, but looking at the code, one thing strikes me: the
> _normal_ case (of just waiting for "enough space" in the ring buffer)
> doesn't need to use the exact case, but the "wait for ring buffer to
> be totally empty" does.
>
> Which means that the use of the "fast-but-inaccurate" 'head' sounds
> wrong for the "wait for idle" case.
>
> So can you explain the difference between
>
> intel_read_status_page(ring, 4);
>
> vs
>
> I915_READ_HEAD(ring);
For I915_READ_HEAD, we need to wake up the GT power well, perform an
uncached read from the register, and then power down. This takes on the
order of a 100 microseconds (less if the GT is already powered up, etc).
Instead a read from the status page is from cached memory. The caveat here
is that value is only updated by the gfx engine when its HEAD crosses
every 64k boundary. So quite rarely.
> because from looking at the code, I get the notion that
> "intel_read_status_page()" may not be exact. But what happens if that
> inexact value matches our cached ring->actual_head, so we never even
> try to read the exact case? Does it _stay_ inexact for arbitrarily
> long times? If so, we might wait for the ring to empty forever (well,
> until the timeout - the behavior I see), even though the ring really
> _is_ empty. No?
Ah. Your analysis is spot on and this will cause a hang whilst polling if
we enter the loop with the last known head the same as the reported value.
> Also, isn't that "head < ring->actual_head" buggy? What about the
> overflow case? Not that we care, because afaik, 'actual_head' is not
> actually used anywhere, so it should be called 'pointless_head'?
This is the one case that I think is handled correctly, ignoring all the
other bugs.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
next prev parent reply other threads:[~2011-01-20 17:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-20 2:39 more intel drm issues (was Re: [git pull] drm intel only fixes) Linus Torvalds
2011-01-20 4:55 ` Jeff Chua
2011-01-20 6:22 ` Linus Torvalds
2011-01-20 10:17 ` Jeff Chua
2011-01-20 10:25 ` Chris Wilson
2011-01-20 16:07 ` Linus Torvalds
2011-01-20 17:38 ` Chris Wilson [this message]
2011-01-20 17:51 ` Linus Torvalds
2011-01-20 20:44 ` Linus Torvalds
2011-01-20 17:41 ` [PATCH] drm/i915/ringbuffer: Fix use of stale HEAD position whilst polling for space Chris Wilson
2011-01-21 8:35 ` Jiri Slaby
2011-01-21 10:11 ` [PATCH] drm/i915: Fix use of invalid array size for ring->sync_seqno Chris Wilson
2011-01-22 22:24 ` Jiri Slaby
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='0d30dc$kqf9gp@orsmga001.jf.intel.com' \
--to=chris@chris-wilson.co.uk \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=jbarnes@virtuousgeek.org \
--cc=jeff.chua.linux@gmail.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@sisk.pl \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox