Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/i915: Mark uneven memory banks on gen4 desktop as unknown swizzling
@ 2015-11-17 10:40 Chris Wilson
  2015-11-17 10:40 ` [PATCH 2/2] drm/i915: Pin unknown swizzle pages Chris Wilson
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Chris Wilson @ 2015-11-17 10:40 UTC (permalink / raw)
  To: intel-gfx; +Cc: Chris Wilson, Matti Hämäläinen, stable

We have varied reports of swizzling corruption on gen4 desktop, and
confirmation that it is triggered by uneven memory banks. The
implication is that the swizzling various between the paired channels
and the remainder of memory on the single channel. As the object then
has unpredictable swizzling (it will vary depending on exact page
allocation and may even change during the object's lifetime as the pages
are replaced), we have to report to userspace that the swizzling is
unknown.

Reported-by: Matti Hämäläinen <ccr@tnsp.org>
References: https://bugs.freedesktop.org/show_bug.cgi?id=90725
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matti Hämäläinen <ccr@tnsp.org>
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/i915/i915_gem_fence.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_fence.c b/drivers/gpu/drm/i915/i915_gem_fence.c
index 40a10b25956c..6ba68083aa95 100644
--- a/drivers/gpu/drm/i915/i915_gem_fence.c
+++ b/drivers/gpu/drm/i915/i915_gem_fence.c
@@ -677,8 +677,8 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev)
 		 * the minimum size of a rank.
 		 */
 		if (I915_READ16(C0DRB3) != I915_READ16(C1DRB3)) {
-			swizzle_x = I915_BIT_6_SWIZZLE_NONE;
-			swizzle_y = I915_BIT_6_SWIZZLE_NONE;
+			swizzle_x = I915_BIT_6_SWIZZLE_UNKNOWN;
+			swizzle_y = I915_BIT_6_SWIZZLE_UNKNOWN;
 		} else {
 			swizzle_x = I915_BIT_6_SWIZZLE_9_10;
 			swizzle_y = I915_BIT_6_SWIZZLE_9;
-- 
2.6.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] drm/i915: Pin unknown swizzle pages
  2015-11-17 10:40 [PATCH 1/2] drm/i915: Mark uneven memory banks on gen4 desktop as unknown swizzling Chris Wilson
@ 2015-11-17 10:40 ` Chris Wilson
  2015-11-17 10:51 ` [PATCH 1/2] drm/i915: Mark uneven memory banks on gen4 desktop as unknown swizzling Chris Wilson
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Chris Wilson @ 2015-11-17 10:40 UTC (permalink / raw)
  To: intel-gfx; +Cc: Chris Wilson, stable

Another oddity associated with gen4 desktop is that some machines
experience swizzling corruption across swapping. Typically this would
imply that those machines have bit17 swizzling (where the swizzle
depends upon the physical address of the page). Play it safe and apply
the bit17 quirk to keep unknown swizzle pages pinned.

References: https://bugs.freedesktop.org/show_bug.cgi?id=90725
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/i915/i915_gem_fence.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem_fence.c b/drivers/gpu/drm/i915/i915_gem_fence.c
index 6ba68083aa95..b5ae97c3d3b2 100644
--- a/drivers/gpu/drm/i915/i915_gem_fence.c
+++ b/drivers/gpu/drm/i915/i915_gem_fence.c
@@ -687,6 +687,10 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev)
 
 	dev_priv->mm.bit_6_swizzle_x = swizzle_x;
 	dev_priv->mm.bit_6_swizzle_y = swizzle_y;
+
+	if (swizzle_x == I915_BIT_6_SWIZZLE_UNKNOWN ||
+	    swizzle_y == I915_BIT_6_SWIZZLE_UNKNOWN)
+		dev_priv->quirks |= QUIRK_PIN_SWIZZLED_PAGES;
 }
 
 /*
-- 
2.6.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] drm/i915: Mark uneven memory banks on gen4 desktop as unknown swizzling
  2015-11-17 10:40 [PATCH 1/2] drm/i915: Mark uneven memory banks on gen4 desktop as unknown swizzling Chris Wilson
  2015-11-17 10:40 ` [PATCH 2/2] drm/i915: Pin unknown swizzle pages Chris Wilson
@ 2015-11-17 10:51 ` Chris Wilson
  2015-11-18 10:05 ` Chris Wilson
  2015-11-18 16:46 ` [Intel-gfx] " Daniel Vetter
  3 siblings, 0 replies; 5+ messages in thread
From: Chris Wilson @ 2015-11-17 10:51 UTC (permalink / raw)
  To: intel-gfx; +Cc: Matti Hämäläinen, stable

On Tue, Nov 17, 2015 at 10:40:51AM +0000, Chris Wilson wrote:
> We have varied reports of swizzling corruption on gen4 desktop, and
> confirmation that it is triggered by uneven memory banks. The
s/it/one at least/

> implication is that the swizzling various between the paired channels
s/various/varies/

> and the remainder of memory on the single channel. As the object then
> has unpredictable swizzling (it will vary depending on exact page
> allocation and may even change during the object's lifetime as the pages
> are replaced), we have to report to userspace that the swizzling is
> unknown.

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] drm/i915: Mark uneven memory banks on gen4 desktop as unknown swizzling
  2015-11-17 10:40 [PATCH 1/2] drm/i915: Mark uneven memory banks on gen4 desktop as unknown swizzling Chris Wilson
  2015-11-17 10:40 ` [PATCH 2/2] drm/i915: Pin unknown swizzle pages Chris Wilson
  2015-11-17 10:51 ` [PATCH 1/2] drm/i915: Mark uneven memory banks on gen4 desktop as unknown swizzling Chris Wilson
@ 2015-11-18 10:05 ` Chris Wilson
  2015-11-18 16:46 ` [Intel-gfx] " Daniel Vetter
  3 siblings, 0 replies; 5+ messages in thread
From: Chris Wilson @ 2015-11-18 10:05 UTC (permalink / raw)
  To: intel-gfx; +Cc: Matti Hämäläinen, stable

On Tue, Nov 17, 2015 at 10:40:51AM +0000, Chris Wilson wrote:
> We have varied reports of swizzling corruption on gen4 desktop, and
> confirmation that it is triggered by uneven memory banks. The
> implication is that the swizzling various between the paired channels
> and the remainder of memory on the single channel. As the object then
> has unpredictable swizzling (it will vary depending on exact page
> allocation and may even change during the object's lifetime as the pages
> are replaced), we have to report to userspace that the swizzling is
> unknown.
> 
> Reported-by: Matti H�m�l�inen <ccr@tnsp.org>
> References: https://bugs.freedesktop.org/show_bug.cgi?id=90725
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Matti H�m�l�inen <ccr@tnsp.org>
> Cc: stable@vger.kernel.org
Tested-by: Matti H�m�l�inen <ccr@tnsp.org>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Intel-gfx] [PATCH 1/2] drm/i915: Mark uneven memory banks on gen4 desktop as unknown swizzling
  2015-11-17 10:40 [PATCH 1/2] drm/i915: Mark uneven memory banks on gen4 desktop as unknown swizzling Chris Wilson
                   ` (2 preceding siblings ...)
  2015-11-18 10:05 ` Chris Wilson
@ 2015-11-18 16:46 ` Daniel Vetter
  3 siblings, 0 replies; 5+ messages in thread
From: Daniel Vetter @ 2015-11-18 16:46 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx, Matti Hämäläinen, stable

On Tue, Nov 17, 2015 at 10:40:51AM +0000, Chris Wilson wrote:
> We have varied reports of swizzling corruption on gen4 desktop, and
> confirmation that it is triggered by uneven memory banks. The
> implication is that the swizzling various between the paired channels
> and the remainder of memory on the single channel. As the object then
> has unpredictable swizzling (it will vary depending on exact page
> allocation and may even change during the object's lifetime as the pages
> are replaced), we have to report to userspace that the swizzling is
> unknown.
> 
> Reported-by: Matti H�m�l�inen <ccr@tnsp.org>
> References: https://bugs.freedesktop.org/show_bug.cgi?id=90725
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Matti H�m�l�inen <ccr@tnsp.org>
> Cc: stable@vger.kernel.org
> ---
>  drivers/gpu/drm/i915/i915_gem_fence.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_fence.c b/drivers/gpu/drm/i915/i915_gem_fence.c
> index 40a10b25956c..6ba68083aa95 100644
> --- a/drivers/gpu/drm/i915/i915_gem_fence.c
> +++ b/drivers/gpu/drm/i915/i915_gem_fence.c
> @@ -677,8 +677,8 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev)
>  		 * the minimum size of a rank.
>  		 */
>  		if (I915_READ16(C0DRB3) != I915_READ16(C1DRB3)) {
> -			swizzle_x = I915_BIT_6_SWIZZLE_NONE;
> -			swizzle_y = I915_BIT_6_SWIZZLE_NONE;
> +			swizzle_x = I915_BIT_6_SWIZZLE_UNKNOWN;
> +			swizzle_y = I915_BIT_6_SWIZZLE_UNKNOWN;

Existing userspace goes boom if we hand it _UNKNOWN as the swizzle type.
We need the same lie as with L-shaped on g4x and only set the quirk, so
that phys_swizzle_mode is _UNKOWN. See

commit 5eb3e5a5e11d14f9deb2a4b83555443b69ab9940
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Jun 28 09:19:26 2015 +0100

    drm/i915: Declare the swizzling unknown for L-shaped configurations

So if you keep the swizzle put add the

	dev_priv->quirks |= QUIRK_PIN_SWIZZLED_PAGES;

here instead (and drop patch 2) this looks good and gets my r-b. But
please include a reference to the above commit so we don't forget all
this.
-Daniel

>  		} else {
>  			swizzle_x = I915_BIT_6_SWIZZLE_9_10;
>  			swizzle_y = I915_BIT_6_SWIZZLE_9;
> -- 
> 2.6.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-11-18 16:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-17 10:40 [PATCH 1/2] drm/i915: Mark uneven memory banks on gen4 desktop as unknown swizzling Chris Wilson
2015-11-17 10:40 ` [PATCH 2/2] drm/i915: Pin unknown swizzle pages Chris Wilson
2015-11-17 10:51 ` [PATCH 1/2] drm/i915: Mark uneven memory banks on gen4 desktop as unknown swizzling Chris Wilson
2015-11-18 10:05 ` Chris Wilson
2015-11-18 16:46 ` [Intel-gfx] " Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox