From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
intel-gfx@lists.freedesktop.org,
Ben Widawsky <benjamin.widawsky@intel.com>,
Timo Aaltonen <tjaalton@ubuntu.com>
Subject: Re: [PATCH] drm/i915: Broadwell expands ACTHD to 64bit
Date: Fri, 21 Mar 2014 12:19:28 +0000 [thread overview]
Message-ID: <532C2E50.7030009@linux.intel.com> (raw)
In-Reply-To: <20140321120054.GF5419@nuc-i3427.alporthouse.com>
On 03/21/2014 12:00 PM, Chris Wilson wrote:
> On Fri, Mar 21, 2014 at 10:50:05AM +0000, Tvrtko Ursulin wrote:
>> No, think you misunderstood me. I said "slightly more defensive"
>> just in the sense that in case of weird hardware failures you have a
>> potentially infinite loop now, where you don't really need a loop -
>> probabilities strongly suggest you cannot get two upper dword wraps
>> between the reads. So it is enough to read the upper dword twice,
>> without the loop. Same effect, slightly more defensive in reality.
>
> Yup, misunderstood what you wanted. If in doubt, C is much more
> concise ;-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> index 45d8011..8c82316 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> @@ -425,12 +425,14 @@ u64 intel_ring_get_active_head(struct intel_ring_buffer *ring)
> if (INTEL_INFO(ring->dev)->gen >= 8) {
> u32 upper, lower, tmp;
>
> + upper = I915_READ(RING_ACTHD_UDW(ring->mmio_base));
> + lower = I915_READ(RING_ACTHD(ring->mmio_base));
> tmp = I915_READ(RING_ACTHD_UDW(ring->mmio_base));
> - do {
> + if (upper != tmp) {
> upper = tmp;
> lower = I915_READ(RING_ACTHD(ring->mmio_base));
> - tmp = I915_READ(RING_ACTHD_UDW(ring->mmio_base));
> - } while (upper != tmp);
> + WARN_ON(I915_READ(RING_ACTHD_UDW(ring->mmio_base) != upper);
> + }
>
> acthd = (u64)upper << 32 | lower;
> } else if (INTEL_INFO(ring->dev)->gen >= 4)
Yes, I was just uneasy with the loop. Also Ben's suggestion in case of
wrap was I think:
WARN_ON(I915_READ(RING_ACTHD(ring->mmio_base) >= lower);
Or in other words, if we have observed the upper wrap, check that the
lower matches with that observation. But I feel bad now that we are
over-engineering this. Perhaps these WARNs are just silly.
Tvrtko
next prev parent reply other threads:[~2014-03-21 12:19 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-19 21:54 [PATCH] drm/i915: bdw expands ACTHD to 64bit Chris Wilson
2014-03-19 23:06 ` Ben Widawsky
2014-03-20 7:54 ` Chris Wilson
2014-03-20 15:17 ` Daniel Vetter
2014-03-20 16:28 ` Chris Wilson
2014-03-20 16:34 ` Daniel Vetter
2014-03-20 16:56 ` Tvrtko Ursulin
2014-03-20 21:41 ` Chris Wilson
2014-03-20 21:48 ` [PATCH] drm/i915: Broadwell " Chris Wilson
2014-03-21 10:03 ` Tvrtko Ursulin
2014-03-21 10:14 ` Chris Wilson
2014-03-21 10:50 ` Tvrtko Ursulin
2014-03-21 12:00 ` Chris Wilson
2014-03-21 12:05 ` [PATCH] drm/i915: Split 64bit hexadecimal addresses to make them easier to read Chris Wilson
2014-03-21 12:19 ` Tvrtko Ursulin [this message]
2014-03-21 12:41 ` [PATCH] drm/i915: Broadwell expands ACTHD to 64bit Chris Wilson
2014-03-25 2:41 ` Ben Widawsky
2014-03-25 2:43 ` Ben Widawsky
2014-03-25 7:31 ` Chris Wilson
2014-03-27 0:09 ` Ben Widawsky
2014-03-27 7:32 ` Daniel Vetter
2014-03-27 7:45 ` Chris Wilson
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=532C2E50.7030009@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=benjamin.widawsky@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
--cc=tjaalton@ubuntu.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.