All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: fix i915 running as dom0 under Xen
@ 2017-02-02  9:47 ` Juergen Gross
  0 siblings, 0 replies; 15+ messages in thread
From: Juergen Gross @ 2017-02-02  9:47 UTC (permalink / raw)
  To: linux-kernel, xen-devel, dri-devel, intel-gfx
  Cc: airlied, jani.nikula, daniel.vetter, konrad.wilk, Juergen Gross

Commit 920cf4194954ec ("drm/i915: Introduce an internal allocator for
disposable private objects") introduced a regression for the kernel
running as Xen dom0: when switching to graphics mode a GPU HANG
occurred.

Reason seems to be a missing adaption similar to that done in
commit 7453c549f5f648 ("swiotlb: Export swiotlb_max_segment to users")
to i915_gem_object_get_pages_internal().

So limit the maximum page order to be used according to the maximum
swiotlb segment size instead to the complete swiotlb size.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
Please consider for 4.10 as otherwise 4.10 will be unusable as Xen dom0
with i915 graphics.
---
 drivers/gpu/drm/i915/i915_gem_internal.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_internal.c b/drivers/gpu/drm/i915/i915_gem_internal.c
index 4b3ff3e..d09c749 100644
--- a/drivers/gpu/drm/i915/i915_gem_internal.c
+++ b/drivers/gpu/drm/i915/i915_gem_internal.c
@@ -66,8 +66,16 @@ i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj)
 
 	max_order = MAX_ORDER;
 #ifdef CONFIG_SWIOTLB
-	if (swiotlb_nr_tbl()) /* minimum max swiotlb size is IO_TLB_SEGSIZE */
-		max_order = min(max_order, ilog2(IO_TLB_SEGPAGES));
+	if (swiotlb_nr_tbl()) {
+		unsigned int max_segment;
+
+		max_segment = swiotlb_max_segment();
+		if (max_segment) {
+			max_segment = max_t(unsigned int, max_segment,
+					    PAGE_SIZE) >> PAGE_SHIFT;
+			max_order = min(max_order, ilog2(max_segment));
+		}
+	}
 #endif
 
 	gfp = GFP_KERNEL | __GFP_HIGHMEM | __GFP_RECLAIMABLE;
-- 
2.10.2

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

* [PATCH] drm/i915: fix i915 running as dom0 under Xen
@ 2017-02-02  9:47 ` Juergen Gross
  0 siblings, 0 replies; 15+ messages in thread
From: Juergen Gross @ 2017-02-02  9:47 UTC (permalink / raw)
  To: linux-kernel, xen-devel, dri-devel, intel-gfx
  Cc: airlied, daniel.vetter, Juergen Gross, konrad.wilk

Commit 920cf4194954ec ("drm/i915: Introduce an internal allocator for
disposable private objects") introduced a regression for the kernel
running as Xen dom0: when switching to graphics mode a GPU HANG
occurred.

Reason seems to be a missing adaption similar to that done in
commit 7453c549f5f648 ("swiotlb: Export swiotlb_max_segment to users")
to i915_gem_object_get_pages_internal().

So limit the maximum page order to be used according to the maximum
swiotlb segment size instead to the complete swiotlb size.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
Please consider for 4.10 as otherwise 4.10 will be unusable as Xen dom0
with i915 graphics.
---
 drivers/gpu/drm/i915/i915_gem_internal.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_internal.c b/drivers/gpu/drm/i915/i915_gem_internal.c
index 4b3ff3e..d09c749 100644
--- a/drivers/gpu/drm/i915/i915_gem_internal.c
+++ b/drivers/gpu/drm/i915/i915_gem_internal.c
@@ -66,8 +66,16 @@ i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj)
 
 	max_order = MAX_ORDER;
 #ifdef CONFIG_SWIOTLB
-	if (swiotlb_nr_tbl()) /* minimum max swiotlb size is IO_TLB_SEGSIZE */
-		max_order = min(max_order, ilog2(IO_TLB_SEGPAGES));
+	if (swiotlb_nr_tbl()) {
+		unsigned int max_segment;
+
+		max_segment = swiotlb_max_segment();
+		if (max_segment) {
+			max_segment = max_t(unsigned int, max_segment,
+					    PAGE_SIZE) >> PAGE_SHIFT;
+			max_order = min(max_order, ilog2(max_segment));
+		}
+	}
 #endif
 
 	gfp = GFP_KERNEL | __GFP_HIGHMEM | __GFP_RECLAIMABLE;
-- 
2.10.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [Intel-gfx] [PATCH] drm/i915: fix i915 running as dom0 under Xen
  2017-02-02  9:47 ` Juergen Gross
@ 2017-02-02 10:48   ` Daniel Vetter
  -1 siblings, 0 replies; 15+ messages in thread
From: Daniel Vetter @ 2017-02-02 10:48 UTC (permalink / raw)
  To: Juergen Gross, Chris Wilson, Jani Nikula, Tvrtko Ursulin
  Cc: linux-kernel, xen-devel, dri-devel, intel-gfx, airlied,
	daniel.vetter, konrad.wilk

On Thu, Feb 02, 2017 at 10:47:11AM +0100, Juergen Gross wrote:
> Commit 920cf4194954ec ("drm/i915: Introduce an internal allocator for
> disposable private objects") introduced a regression for the kernel
> running as Xen dom0: when switching to graphics mode a GPU HANG
> occurred.
> 
> Reason seems to be a missing adaption similar to that done in
> commit 7453c549f5f648 ("swiotlb: Export swiotlb_max_segment to users")
> to i915_gem_object_get_pages_internal().
> 
> So limit the maximum page order to be used according to the maximum
> swiotlb segment size instead to the complete swiotlb size.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>
Fixes: 920cf4194954 ("drm/i915: Introduce an internal allocator for disposable private objects")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.10-rc1+

We have a nice script for these :-)
-Daniel

> ---
> Please consider for 4.10 as otherwise 4.10 will be unusable as Xen dom0
> with i915 graphics.
> ---
>  drivers/gpu/drm/i915/i915_gem_internal.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_internal.c b/drivers/gpu/drm/i915/i915_gem_internal.c
> index 4b3ff3e..d09c749 100644
> --- a/drivers/gpu/drm/i915/i915_gem_internal.c
> +++ b/drivers/gpu/drm/i915/i915_gem_internal.c
> @@ -66,8 +66,16 @@ i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj)
>  
>  	max_order = MAX_ORDER;
>  #ifdef CONFIG_SWIOTLB
> -	if (swiotlb_nr_tbl()) /* minimum max swiotlb size is IO_TLB_SEGSIZE */
> -		max_order = min(max_order, ilog2(IO_TLB_SEGPAGES));
> +	if (swiotlb_nr_tbl()) {
> +		unsigned int max_segment;
> +
> +		max_segment = swiotlb_max_segment();
> +		if (max_segment) {
> +			max_segment = max_t(unsigned int, max_segment,
> +					    PAGE_SIZE) >> PAGE_SHIFT;
> +			max_order = min(max_order, ilog2(max_segment));
> +		}
> +	}
>  #endif
>  
>  	gfp = GFP_KERNEL | __GFP_HIGHMEM | __GFP_RECLAIMABLE;
> -- 
> 2.10.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

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

* Re: [Intel-gfx] [PATCH] drm/i915: fix i915 running as dom0 under Xen
@ 2017-02-02 10:48   ` Daniel Vetter
  0 siblings, 0 replies; 15+ messages in thread
From: Daniel Vetter @ 2017-02-02 10:48 UTC (permalink / raw)
  To: Juergen Gross, Chris Wilson, Jani Nikula, Tvrtko Ursulin
  Cc: konrad.wilk, intel-gfx, linux-kernel, dri-devel, daniel.vetter,
	xen-devel

On Thu, Feb 02, 2017 at 10:47:11AM +0100, Juergen Gross wrote:
> Commit 920cf4194954ec ("drm/i915: Introduce an internal allocator for
> disposable private objects") introduced a regression for the kernel
> running as Xen dom0: when switching to graphics mode a GPU HANG
> occurred.
> 
> Reason seems to be a missing adaption similar to that done in
> commit 7453c549f5f648 ("swiotlb: Export swiotlb_max_segment to users")
> to i915_gem_object_get_pages_internal().
> 
> So limit the maximum page order to be used according to the maximum
> swiotlb segment size instead to the complete swiotlb size.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>
Fixes: 920cf4194954 ("drm/i915: Introduce an internal allocator for disposable private objects")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.10-rc1+

We have a nice script for these :-)
-Daniel

> ---
> Please consider for 4.10 as otherwise 4.10 will be unusable as Xen dom0
> with i915 graphics.
> ---
>  drivers/gpu/drm/i915/i915_gem_internal.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_internal.c b/drivers/gpu/drm/i915/i915_gem_internal.c
> index 4b3ff3e..d09c749 100644
> --- a/drivers/gpu/drm/i915/i915_gem_internal.c
> +++ b/drivers/gpu/drm/i915/i915_gem_internal.c
> @@ -66,8 +66,16 @@ i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj)
>  
>  	max_order = MAX_ORDER;
>  #ifdef CONFIG_SWIOTLB
> -	if (swiotlb_nr_tbl()) /* minimum max swiotlb size is IO_TLB_SEGSIZE */
> -		max_order = min(max_order, ilog2(IO_TLB_SEGPAGES));
> +	if (swiotlb_nr_tbl()) {
> +		unsigned int max_segment;
> +
> +		max_segment = swiotlb_max_segment();
> +		if (max_segment) {
> +			max_segment = max_t(unsigned int, max_segment,
> +					    PAGE_SIZE) >> PAGE_SHIFT;
> +			max_order = min(max_order, ilog2(max_segment));
> +		}
> +	}
>  #endif
>  
>  	gfp = GFP_KERNEL | __GFP_HIGHMEM | __GFP_RECLAIMABLE;
> -- 
> 2.10.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [Intel-gfx] [PATCH] drm/i915: fix i915 running as dom0 under Xen
  2017-02-02  9:47 ` Juergen Gross
  (?)
@ 2017-02-02 10:48 ` Daniel Vetter
  -1 siblings, 0 replies; 15+ messages in thread
From: Daniel Vetter @ 2017-02-02 10:48 UTC (permalink / raw)
  To: Juergen Gross, Chris Wilson, Jani Nikula, Tvrtko Ursulin
  Cc: airlied, intel-gfx, linux-kernel, dri-devel, daniel.vetter, xen-devel

On Thu, Feb 02, 2017 at 10:47:11AM +0100, Juergen Gross wrote:
> Commit 920cf4194954ec ("drm/i915: Introduce an internal allocator for
> disposable private objects") introduced a regression for the kernel
> running as Xen dom0: when switching to graphics mode a GPU HANG
> occurred.
> 
> Reason seems to be a missing adaption similar to that done in
> commit 7453c549f5f648 ("swiotlb: Export swiotlb_max_segment to users")
> to i915_gem_object_get_pages_internal().
> 
> So limit the maximum page order to be used according to the maximum
> swiotlb segment size instead to the complete swiotlb size.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>
Fixes: 920cf4194954 ("drm/i915: Introduce an internal allocator for disposable private objects")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.10-rc1+

We have a nice script for these :-)
-Daniel

> ---
> Please consider for 4.10 as otherwise 4.10 will be unusable as Xen dom0
> with i915 graphics.
> ---
>  drivers/gpu/drm/i915/i915_gem_internal.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_internal.c b/drivers/gpu/drm/i915/i915_gem_internal.c
> index 4b3ff3e..d09c749 100644
> --- a/drivers/gpu/drm/i915/i915_gem_internal.c
> +++ b/drivers/gpu/drm/i915/i915_gem_internal.c
> @@ -66,8 +66,16 @@ i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj)
>  
>  	max_order = MAX_ORDER;
>  #ifdef CONFIG_SWIOTLB
> -	if (swiotlb_nr_tbl()) /* minimum max swiotlb size is IO_TLB_SEGSIZE */
> -		max_order = min(max_order, ilog2(IO_TLB_SEGPAGES));
> +	if (swiotlb_nr_tbl()) {
> +		unsigned int max_segment;
> +
> +		max_segment = swiotlb_max_segment();
> +		if (max_segment) {
> +			max_segment = max_t(unsigned int, max_segment,
> +					    PAGE_SIZE) >> PAGE_SHIFT;
> +			max_order = min(max_order, ilog2(max_segment));
> +		}
> +	}
>  #endif
>  
>  	gfp = GFP_KERNEL | __GFP_HIGHMEM | __GFP_RECLAIMABLE;
> -- 
> 2.10.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [Intel-gfx] [PATCH] drm/i915: fix i915 running as dom0 under Xen
  2017-02-02 10:48   ` Daniel Vetter
@ 2017-02-02 10:55     ` Chris Wilson
  -1 siblings, 0 replies; 15+ messages in thread
From: Chris Wilson @ 2017-02-02 10:55 UTC (permalink / raw)
  To: Juergen Gross, Jani Nikula, Tvrtko Ursulin, linux-kernel,
	xen-devel, dri-devel, intel-gfx, airlied, daniel.vetter,
	konrad.wilk

On Thu, Feb 02, 2017 at 11:48:21AM +0100, Daniel Vetter wrote:
> On Thu, Feb 02, 2017 at 10:47:11AM +0100, Juergen Gross wrote:
> > Commit 920cf4194954ec ("drm/i915: Introduce an internal allocator for
> > disposable private objects") introduced a regression for the kernel
> > running as Xen dom0: when switching to graphics mode a GPU HANG
> > occurred.
> > 
> > Reason seems to be a missing adaption similar to that done in
> > commit 7453c549f5f648 ("swiotlb: Export swiotlb_max_segment to users")
> > to i915_gem_object_get_pages_internal().
> > 
> > So limit the maximum page order to be used according to the maximum
> > swiotlb segment size instead to the complete swiotlb size.
> > 
> > Signed-off-by: Juergen Gross <jgross@suse.com>
> Fixes: 920cf4194954 ("drm/i915: Introduce an internal allocator for disposable private objects")
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.10-rc1+
> 
> We have a nice script for these :-)

Pffifle. 7453c549f5f648 allowed Xen to change it and silently conflicted
with those that already used the previous limits, which didn't land in
our tree until v4.10-rc3.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

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

* Re: [PATCH] drm/i915: fix i915 running as dom0 under Xen
@ 2017-02-02 10:55     ` Chris Wilson
  0 siblings, 0 replies; 15+ messages in thread
From: Chris Wilson @ 2017-02-02 10:55 UTC (permalink / raw)
  To: Juergen Gross, Jani Nikula, Tvrtko Ursulin, linux-kernel,
	xen-devel, dri-devel, intel-gfx, airlied, daniel.vetter,
	konrad.wilk

On Thu, Feb 02, 2017 at 11:48:21AM +0100, Daniel Vetter wrote:
> On Thu, Feb 02, 2017 at 10:47:11AM +0100, Juergen Gross wrote:
> > Commit 920cf4194954ec ("drm/i915: Introduce an internal allocator for
> > disposable private objects") introduced a regression for the kernel
> > running as Xen dom0: when switching to graphics mode a GPU HANG
> > occurred.
> > 
> > Reason seems to be a missing adaption similar to that done in
> > commit 7453c549f5f648 ("swiotlb: Export swiotlb_max_segment to users")
> > to i915_gem_object_get_pages_internal().
> > 
> > So limit the maximum page order to be used according to the maximum
> > swiotlb segment size instead to the complete swiotlb size.
> > 
> > Signed-off-by: Juergen Gross <jgross@suse.com>
> Fixes: 920cf4194954 ("drm/i915: Introduce an internal allocator for disposable private objects")
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.10-rc1+
> 
> We have a nice script for these :-)

Pffifle. 7453c549f5f648 allowed Xen to change it and silently conflicted
with those that already used the previous limits, which didn't land in
our tree until v4.10-rc3.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [Intel-gfx] [PATCH] drm/i915: fix i915 running as dom0 under Xen
  2017-02-02 10:48   ` Daniel Vetter
  (?)
@ 2017-02-02 10:55   ` Chris Wilson
  -1 siblings, 0 replies; 15+ messages in thread
From: Chris Wilson @ 2017-02-02 10:55 UTC (permalink / raw)
  To: Juergen Gross, Jani Nikula, Tvrtko Ursulin, linux-kernel,
	xen-devel, dri-devel, intel-gfx, airlied, daniel.vetter,
	konrad.wilk

On Thu, Feb 02, 2017 at 11:48:21AM +0100, Daniel Vetter wrote:
> On Thu, Feb 02, 2017 at 10:47:11AM +0100, Juergen Gross wrote:
> > Commit 920cf4194954ec ("drm/i915: Introduce an internal allocator for
> > disposable private objects") introduced a regression for the kernel
> > running as Xen dom0: when switching to graphics mode a GPU HANG
> > occurred.
> > 
> > Reason seems to be a missing adaption similar to that done in
> > commit 7453c549f5f648 ("swiotlb: Export swiotlb_max_segment to users")
> > to i915_gem_object_get_pages_internal().
> > 
> > So limit the maximum page order to be used according to the maximum
> > swiotlb segment size instead to the complete swiotlb size.
> > 
> > Signed-off-by: Juergen Gross <jgross@suse.com>
> Fixes: 920cf4194954 ("drm/i915: Introduce an internal allocator for disposable private objects")
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.10-rc1+
> 
> We have a nice script for these :-)

Pffifle. 7453c549f5f648 allowed Xen to change it and silently conflicted
with those that already used the previous limits, which didn't land in
our tree until v4.10-rc3.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [Intel-gfx] [PATCH] drm/i915: fix i915 running as dom0 under Xen
  2017-02-02  9:47 ` Juergen Gross
@ 2017-02-02 12:11   ` Tvrtko Ursulin
  -1 siblings, 0 replies; 15+ messages in thread
From: Tvrtko Ursulin @ 2017-02-02 12:11 UTC (permalink / raw)
  To: Juergen Gross, linux-kernel, xen-devel, dri-devel, intel-gfx
  Cc: airlied, daniel.vetter, konrad.wilk


On 02/02/2017 09:47, Juergen Gross wrote:
> Commit 920cf4194954ec ("drm/i915: Introduce an internal allocator for
> disposable private objects") introduced a regression for the kernel
> running as Xen dom0: when switching to graphics mode a GPU HANG
> occurred.
>
> Reason seems to be a missing adaption similar to that done in
> commit 7453c549f5f648 ("swiotlb: Export swiotlb_max_segment to users")
> to i915_gem_object_get_pages_internal().
>
> So limit the maximum page order to be used according to the maximum
> swiotlb segment size instead to the complete swiotlb size.
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
> Please consider for 4.10 as otherwise 4.10 will be unusable as Xen dom0
> with i915 graphics.
> ---
>  drivers/gpu/drm/i915/i915_gem_internal.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_internal.c b/drivers/gpu/drm/i915/i915_gem_internal.c
> index 4b3ff3e..d09c749 100644
> --- a/drivers/gpu/drm/i915/i915_gem_internal.c
> +++ b/drivers/gpu/drm/i915/i915_gem_internal.c
> @@ -66,8 +66,16 @@ i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj)
>
>  	max_order = MAX_ORDER;
>  #ifdef CONFIG_SWIOTLB
> -	if (swiotlb_nr_tbl()) /* minimum max swiotlb size is IO_TLB_SEGSIZE */
> -		max_order = min(max_order, ilog2(IO_TLB_SEGPAGES));
> +	if (swiotlb_nr_tbl()) {
> +		unsigned int max_segment;
> +
> +		max_segment = swiotlb_max_segment();
> +		if (max_segment) {
> +			max_segment = max_t(unsigned int, max_segment,
> +					    PAGE_SIZE) >> PAGE_SHIFT;
> +			max_order = min(max_order, ilog2(max_segment));
> +		}
> +	}
>  #endif
>
>  	gfp = GFP_KERNEL | __GFP_HIGHMEM | __GFP_RECLAIMABLE;
>

Looks OK to me. We could bikeshed it to only use swiotlb_max_segment() 
which I think was the intention when that API was added but can leave 
that for the future.

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko

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

* Re: [PATCH] drm/i915: fix i915 running as dom0 under Xen
@ 2017-02-02 12:11   ` Tvrtko Ursulin
  0 siblings, 0 replies; 15+ messages in thread
From: Tvrtko Ursulin @ 2017-02-02 12:11 UTC (permalink / raw)
  To: Juergen Gross, linux-kernel, xen-devel, dri-devel, intel-gfx
  Cc: airlied, daniel.vetter, konrad.wilk


On 02/02/2017 09:47, Juergen Gross wrote:
> Commit 920cf4194954ec ("drm/i915: Introduce an internal allocator for
> disposable private objects") introduced a regression for the kernel
> running as Xen dom0: when switching to graphics mode a GPU HANG
> occurred.
>
> Reason seems to be a missing adaption similar to that done in
> commit 7453c549f5f648 ("swiotlb: Export swiotlb_max_segment to users")
> to i915_gem_object_get_pages_internal().
>
> So limit the maximum page order to be used according to the maximum
> swiotlb segment size instead to the complete swiotlb size.
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
> Please consider for 4.10 as otherwise 4.10 will be unusable as Xen dom0
> with i915 graphics.
> ---
>  drivers/gpu/drm/i915/i915_gem_internal.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_internal.c b/drivers/gpu/drm/i915/i915_gem_internal.c
> index 4b3ff3e..d09c749 100644
> --- a/drivers/gpu/drm/i915/i915_gem_internal.c
> +++ b/drivers/gpu/drm/i915/i915_gem_internal.c
> @@ -66,8 +66,16 @@ i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj)
>
>  	max_order = MAX_ORDER;
>  #ifdef CONFIG_SWIOTLB
> -	if (swiotlb_nr_tbl()) /* minimum max swiotlb size is IO_TLB_SEGSIZE */
> -		max_order = min(max_order, ilog2(IO_TLB_SEGPAGES));
> +	if (swiotlb_nr_tbl()) {
> +		unsigned int max_segment;
> +
> +		max_segment = swiotlb_max_segment();
> +		if (max_segment) {
> +			max_segment = max_t(unsigned int, max_segment,
> +					    PAGE_SIZE) >> PAGE_SHIFT;
> +			max_order = min(max_order, ilog2(max_segment));
> +		}
> +	}
>  #endif
>
>  	gfp = GFP_KERNEL | __GFP_HIGHMEM | __GFP_RECLAIMABLE;
>

Looks OK to me. We could bikeshed it to only use swiotlb_max_segment() 
which I think was the intention when that API was added but can leave 
that for the future.

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [Intel-gfx] [PATCH] drm/i915: fix i915 running as dom0 under Xen
  2017-02-02  9:47 ` Juergen Gross
                   ` (2 preceding siblings ...)
  (?)
@ 2017-02-02 12:11 ` Tvrtko Ursulin
  -1 siblings, 0 replies; 15+ messages in thread
From: Tvrtko Ursulin @ 2017-02-02 12:11 UTC (permalink / raw)
  To: Juergen Gross, linux-kernel, xen-devel, dri-devel, intel-gfx
  Cc: airlied, daniel.vetter


On 02/02/2017 09:47, Juergen Gross wrote:
> Commit 920cf4194954ec ("drm/i915: Introduce an internal allocator for
> disposable private objects") introduced a regression for the kernel
> running as Xen dom0: when switching to graphics mode a GPU HANG
> occurred.
>
> Reason seems to be a missing adaption similar to that done in
> commit 7453c549f5f648 ("swiotlb: Export swiotlb_max_segment to users")
> to i915_gem_object_get_pages_internal().
>
> So limit the maximum page order to be used according to the maximum
> swiotlb segment size instead to the complete swiotlb size.
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
> Please consider for 4.10 as otherwise 4.10 will be unusable as Xen dom0
> with i915 graphics.
> ---
>  drivers/gpu/drm/i915/i915_gem_internal.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_internal.c b/drivers/gpu/drm/i915/i915_gem_internal.c
> index 4b3ff3e..d09c749 100644
> --- a/drivers/gpu/drm/i915/i915_gem_internal.c
> +++ b/drivers/gpu/drm/i915/i915_gem_internal.c
> @@ -66,8 +66,16 @@ i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj)
>
>  	max_order = MAX_ORDER;
>  #ifdef CONFIG_SWIOTLB
> -	if (swiotlb_nr_tbl()) /* minimum max swiotlb size is IO_TLB_SEGSIZE */
> -		max_order = min(max_order, ilog2(IO_TLB_SEGPAGES));
> +	if (swiotlb_nr_tbl()) {
> +		unsigned int max_segment;
> +
> +		max_segment = swiotlb_max_segment();
> +		if (max_segment) {
> +			max_segment = max_t(unsigned int, max_segment,
> +					    PAGE_SIZE) >> PAGE_SHIFT;
> +			max_order = min(max_order, ilog2(max_segment));
> +		}
> +	}
>  #endif
>
>  	gfp = GFP_KERNEL | __GFP_HIGHMEM | __GFP_RECLAIMABLE;
>

Looks OK to me. We could bikeshed it to only use swiotlb_max_segment() 
which I think was the intention when that API was added but can leave 
that for the future.

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* ✗ Fi.CI.BAT: failure for drm/i915: fix i915 running as dom0 under Xen
  2017-02-02  9:47 ` Juergen Gross
                   ` (4 preceding siblings ...)
  (?)
@ 2017-02-02 12:24 ` Patchwork
  -1 siblings, 0 replies; 15+ messages in thread
From: Patchwork @ 2017-02-02 12:24 UTC (permalink / raw)
  To: Juergen Gross; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: fix i915 running as dom0 under Xen
URL   : https://patchwork.freedesktop.org/series/18979/
State : failure

== Summary ==

Series 18979v1 drm/i915: fix i915 running as dom0 under Xen
https://patchwork.freedesktop.org/api/1.0/series/18979/revisions/1/mbox/

Test gem_exec_flush:
        Subgroup basic-wb-ro-default:
                pass       -> INCOMPLETE (fi-byt-j1900)
Test kms_pipe_crc_basic:
        Subgroup nonblocking-crc-pipe-c-frame-sequence:
                fail       -> PASS       (fi-skl-6770hq)

fi-bdw-5557u     total:247  pass:233  dwarn:0   dfail:0   fail:0   skip:14 
fi-bsw-n3050     total:247  pass:208  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205     total:247  pass:225  dwarn:0   dfail:0   fail:0   skip:22 
fi-bxt-t5700     total:78   pass:65   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900     total:56   pass:46   dwarn:0   dfail:0   fail:0   skip:9  
fi-byt-n2820     total:247  pass:216  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770      total:247  pass:228  dwarn:0   dfail:0   fail:0   skip:19 
fi-hsw-4770r     total:247  pass:228  dwarn:0   dfail:0   fail:0   skip:19 
fi-ivb-3520m     total:247  pass:226  dwarn:0   dfail:0   fail:0   skip:21 
fi-ivb-3770      total:247  pass:226  dwarn:0   dfail:0   fail:0   skip:21 
fi-kbl-7500u     total:247  pass:224  dwarn:0   dfail:0   fail:2   skip:21 
fi-skl-6260u     total:247  pass:234  dwarn:0   dfail:0   fail:0   skip:13 
fi-skl-6700hq    total:247  pass:227  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k     total:247  pass:222  dwarn:4   dfail:0   fail:0   skip:21 
fi-skl-6770hq    total:247  pass:234  dwarn:0   dfail:0   fail:0   skip:13 
fi-snb-2520m     total:247  pass:216  dwarn:0   dfail:0   fail:0   skip:31 
fi-snb-2600      total:247  pass:215  dwarn:0   dfail:0   fail:0   skip:32 

ce4c6eb9b0d270df56813af310cd918298ac7ba2 drm-tip: 2017y-02m-02d-10h-12m-30s UTC integration manifest
a372572 drm/i915: fix i915 running as dom0 under Xen

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3673/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [Intel-gfx] [PATCH] drm/i915: fix i915 running as dom0 under Xen
  2017-02-02 12:11   ` Tvrtko Ursulin
@ 2017-02-02 12:27     ` Chris Wilson
  -1 siblings, 0 replies; 15+ messages in thread
From: Chris Wilson @ 2017-02-02 12:27 UTC (permalink / raw)
  To: Tvrtko Ursulin
  Cc: Juergen Gross, linux-kernel, xen-devel, dri-devel, intel-gfx,
	daniel.vetter, konrad.wilk

On Thu, Feb 02, 2017 at 12:11:29PM +0000, Tvrtko Ursulin wrote:
> 
> On 02/02/2017 09:47, Juergen Gross wrote:
> >Commit 920cf4194954ec ("drm/i915: Introduce an internal allocator for
> >disposable private objects") introduced a regression for the kernel
> >running as Xen dom0: when switching to graphics mode a GPU HANG
> >occurred.
> >
> >Reason seems to be a missing adaption similar to that done in
> >commit 7453c549f5f648 ("swiotlb: Export swiotlb_max_segment to users")
> >to i915_gem_object_get_pages_internal().
> >
> >So limit the maximum page order to be used according to the maximum
> >swiotlb segment size instead to the complete swiotlb size.
> >
> >Signed-off-by: Juergen Gross <jgross@suse.com>
> >---
> >Please consider for 4.10 as otherwise 4.10 will be unusable as Xen dom0
> >with i915 graphics.
> >---
> > drivers/gpu/drm/i915/i915_gem_internal.c | 12 ++++++++++--
> > 1 file changed, 10 insertions(+), 2 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/i915/i915_gem_internal.c b/drivers/gpu/drm/i915/i915_gem_internal.c
> >index 4b3ff3e..d09c749 100644
> >--- a/drivers/gpu/drm/i915/i915_gem_internal.c
> >+++ b/drivers/gpu/drm/i915/i915_gem_internal.c
> >@@ -66,8 +66,16 @@ i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj)
> >
> > 	max_order = MAX_ORDER;
> > #ifdef CONFIG_SWIOTLB
> >-	if (swiotlb_nr_tbl()) /* minimum max swiotlb size is IO_TLB_SEGSIZE */
> >-		max_order = min(max_order, ilog2(IO_TLB_SEGPAGES));
> >+	if (swiotlb_nr_tbl()) {
> >+		unsigned int max_segment;
> >+
> >+		max_segment = swiotlb_max_segment();
> >+		if (max_segment) {
> >+			max_segment = max_t(unsigned int, max_segment,
> >+					    PAGE_SIZE) >> PAGE_SHIFT;
> >+			max_order = min(max_order, ilog2(max_segment));
> >+		}
> >+	}
> > #endif
> >
> > 	gfp = GFP_KERNEL | __GFP_HIGHMEM | __GFP_RECLAIMABLE;
> >
> 
> Looks OK to me. We could bikeshed it to only use
> swiotlb_max_segment() which I think was the intention when that API
> was added but can leave that for the future.
> 
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Pushed, I imagine this has been added to the list of sg cleanups you
have :)
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

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

* Re: [PATCH] drm/i915: fix i915 running as dom0 under Xen
@ 2017-02-02 12:27     ` Chris Wilson
  0 siblings, 0 replies; 15+ messages in thread
From: Chris Wilson @ 2017-02-02 12:27 UTC (permalink / raw)
  To: Tvrtko Ursulin
  Cc: Juergen Gross, konrad.wilk, intel-gfx, linux-kernel, dri-devel,
	daniel.vetter, xen-devel

On Thu, Feb 02, 2017 at 12:11:29PM +0000, Tvrtko Ursulin wrote:
> 
> On 02/02/2017 09:47, Juergen Gross wrote:
> >Commit 920cf4194954ec ("drm/i915: Introduce an internal allocator for
> >disposable private objects") introduced a regression for the kernel
> >running as Xen dom0: when switching to graphics mode a GPU HANG
> >occurred.
> >
> >Reason seems to be a missing adaption similar to that done in
> >commit 7453c549f5f648 ("swiotlb: Export swiotlb_max_segment to users")
> >to i915_gem_object_get_pages_internal().
> >
> >So limit the maximum page order to be used according to the maximum
> >swiotlb segment size instead to the complete swiotlb size.
> >
> >Signed-off-by: Juergen Gross <jgross@suse.com>
> >---
> >Please consider for 4.10 as otherwise 4.10 will be unusable as Xen dom0
> >with i915 graphics.
> >---
> > drivers/gpu/drm/i915/i915_gem_internal.c | 12 ++++++++++--
> > 1 file changed, 10 insertions(+), 2 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/i915/i915_gem_internal.c b/drivers/gpu/drm/i915/i915_gem_internal.c
> >index 4b3ff3e..d09c749 100644
> >--- a/drivers/gpu/drm/i915/i915_gem_internal.c
> >+++ b/drivers/gpu/drm/i915/i915_gem_internal.c
> >@@ -66,8 +66,16 @@ i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj)
> >
> > 	max_order = MAX_ORDER;
> > #ifdef CONFIG_SWIOTLB
> >-	if (swiotlb_nr_tbl()) /* minimum max swiotlb size is IO_TLB_SEGSIZE */
> >-		max_order = min(max_order, ilog2(IO_TLB_SEGPAGES));
> >+	if (swiotlb_nr_tbl()) {
> >+		unsigned int max_segment;
> >+
> >+		max_segment = swiotlb_max_segment();
> >+		if (max_segment) {
> >+			max_segment = max_t(unsigned int, max_segment,
> >+					    PAGE_SIZE) >> PAGE_SHIFT;
> >+			max_order = min(max_order, ilog2(max_segment));
> >+		}
> >+	}
> > #endif
> >
> > 	gfp = GFP_KERNEL | __GFP_HIGHMEM | __GFP_RECLAIMABLE;
> >
> 
> Looks OK to me. We could bikeshed it to only use
> swiotlb_max_segment() which I think was the intention when that API
> was added but can leave that for the future.
> 
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Pushed, I imagine this has been added to the list of sg cleanups you
have :)
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [Intel-gfx] [PATCH] drm/i915: fix i915 running as dom0 under Xen
  2017-02-02 12:11   ` Tvrtko Ursulin
  (?)
  (?)
@ 2017-02-02 12:27   ` Chris Wilson
  -1 siblings, 0 replies; 15+ messages in thread
From: Chris Wilson @ 2017-02-02 12:27 UTC (permalink / raw)
  To: Tvrtko Ursulin
  Cc: Juergen Gross, intel-gfx, linux-kernel, dri-devel, daniel.vetter,
	xen-devel

On Thu, Feb 02, 2017 at 12:11:29PM +0000, Tvrtko Ursulin wrote:
> 
> On 02/02/2017 09:47, Juergen Gross wrote:
> >Commit 920cf4194954ec ("drm/i915: Introduce an internal allocator for
> >disposable private objects") introduced a regression for the kernel
> >running as Xen dom0: when switching to graphics mode a GPU HANG
> >occurred.
> >
> >Reason seems to be a missing adaption similar to that done in
> >commit 7453c549f5f648 ("swiotlb: Export swiotlb_max_segment to users")
> >to i915_gem_object_get_pages_internal().
> >
> >So limit the maximum page order to be used according to the maximum
> >swiotlb segment size instead to the complete swiotlb size.
> >
> >Signed-off-by: Juergen Gross <jgross@suse.com>
> >---
> >Please consider for 4.10 as otherwise 4.10 will be unusable as Xen dom0
> >with i915 graphics.
> >---
> > drivers/gpu/drm/i915/i915_gem_internal.c | 12 ++++++++++--
> > 1 file changed, 10 insertions(+), 2 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/i915/i915_gem_internal.c b/drivers/gpu/drm/i915/i915_gem_internal.c
> >index 4b3ff3e..d09c749 100644
> >--- a/drivers/gpu/drm/i915/i915_gem_internal.c
> >+++ b/drivers/gpu/drm/i915/i915_gem_internal.c
> >@@ -66,8 +66,16 @@ i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj)
> >
> > 	max_order = MAX_ORDER;
> > #ifdef CONFIG_SWIOTLB
> >-	if (swiotlb_nr_tbl()) /* minimum max swiotlb size is IO_TLB_SEGSIZE */
> >-		max_order = min(max_order, ilog2(IO_TLB_SEGPAGES));
> >+	if (swiotlb_nr_tbl()) {
> >+		unsigned int max_segment;
> >+
> >+		max_segment = swiotlb_max_segment();
> >+		if (max_segment) {
> >+			max_segment = max_t(unsigned int, max_segment,
> >+					    PAGE_SIZE) >> PAGE_SHIFT;
> >+			max_order = min(max_order, ilog2(max_segment));
> >+		}
> >+	}
> > #endif
> >
> > 	gfp = GFP_KERNEL | __GFP_HIGHMEM | __GFP_RECLAIMABLE;
> >
> 
> Looks OK to me. We could bikeshed it to only use
> swiotlb_max_segment() which I think was the intention when that API
> was added but can leave that for the future.
> 
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Pushed, I imagine this has been added to the list of sg cleanups you
have :)
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

end of thread, other threads:[~2017-02-02 12:27 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-02  9:47 [PATCH] drm/i915: fix i915 running as dom0 under Xen Juergen Gross
2017-02-02  9:47 ` Juergen Gross
2017-02-02 10:48 ` [Intel-gfx] " Daniel Vetter
2017-02-02 10:48 ` Daniel Vetter
2017-02-02 10:48   ` Daniel Vetter
2017-02-02 10:55   ` Chris Wilson
2017-02-02 10:55   ` Chris Wilson
2017-02-02 10:55     ` Chris Wilson
2017-02-02 12:11 ` [Intel-gfx] " Tvrtko Ursulin
2017-02-02 12:11 ` Tvrtko Ursulin
2017-02-02 12:11   ` Tvrtko Ursulin
2017-02-02 12:27   ` [Intel-gfx] " Chris Wilson
2017-02-02 12:27     ` Chris Wilson
2017-02-02 12:27   ` [Intel-gfx] " Chris Wilson
2017-02-02 12:24 ` ✗ Fi.CI.BAT: failure for " Patchwork

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.