All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/i915: Extract aliasing ppgtt setup
@ 2017-02-09 10:02 Chris Wilson
  2017-02-09 10:02 ` [PATCH 2/2] drm/i915: Force an aliasing_ppgtt test for context execution Chris Wilson
  2017-02-09 11:13 ` [PATCH 1/2] drm/i915: Extract aliasing ppgtt setup Joonas Lahtinen
  0 siblings, 2 replies; 6+ messages in thread
From: Chris Wilson @ 2017-02-09 10:02 UTC (permalink / raw)
  To: intel-gfx

In order to force testing of the aliasing ppgtt, extract its
initialisation function.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 68 ++++++++++++++++++++++---------------
 drivers/gpu/drm/i915/i915_gem_gtt.h |  2 ++
 2 files changed, 42 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 0247b26265dd..c42abadad5c2 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -2737,6 +2737,44 @@ static void i915_gtt_color_adjust(const struct drm_mm_node *node,
 		*end -= I915_GTT_PAGE_SIZE;
 }
 
+int i915_gem_init_aliasing_ppgtt(struct drm_i915_private *i915)
+{
+	struct i915_ggtt *ggtt = &i915->ggtt;
+	struct i915_hw_ppgtt *ppgtt;
+	int err;
+
+	ppgtt = kzalloc(sizeof(*ppgtt), GFP_KERNEL);
+	if (!ppgtt)
+		return -ENOMEM;
+
+	err = __hw_ppgtt_init(ppgtt, i915);
+	if (err)
+		goto err_ppgtt;
+
+	if (ppgtt->base.allocate_va_range) {
+		err = ppgtt->base.allocate_va_range(&ppgtt->base, 0,
+						    ppgtt->base.total);
+		if (err)
+			goto err_ppgtt_cleanup;
+	}
+
+	ppgtt->base.clear_range(&ppgtt->base,
+				ppgtt->base.start,
+				ppgtt->base.total);
+
+	i915->mm.aliasing_ppgtt = ppgtt;
+	WARN_ON(ggtt->base.bind_vma != ggtt_bind_vma);
+	ggtt->base.bind_vma = aliasing_gtt_bind_vma;
+
+	return 0;
+
+err_ppgtt_cleanup:
+	ppgtt->base.cleanup(&ppgtt->base);
+err_ppgtt:
+	kfree(ppgtt);
+	return err;
+}
+
 int i915_gem_init_ggtt(struct drm_i915_private *dev_priv)
 {
 	/* Let GEM Manage all of the aperture.
@@ -2750,7 +2788,6 @@ int i915_gem_init_ggtt(struct drm_i915_private *dev_priv)
 	 */
 	struct i915_ggtt *ggtt = &dev_priv->ggtt;
 	unsigned long hole_start, hole_end;
-	struct i915_hw_ppgtt *ppgtt;
 	struct drm_mm_node *entry;
 	int ret;
 
@@ -2779,38 +2816,13 @@ int i915_gem_init_ggtt(struct drm_i915_private *dev_priv)
 			       ggtt->base.total - PAGE_SIZE, PAGE_SIZE);
 
 	if (USES_PPGTT(dev_priv) && !USES_FULL_PPGTT(dev_priv)) {
-		ppgtt = kzalloc(sizeof(*ppgtt), GFP_KERNEL);
-		if (!ppgtt) {
-			ret = -ENOMEM;
-			goto err;
-		}
-
-		ret = __hw_ppgtt_init(ppgtt, dev_priv);
+		ret = i915_gem_init_aliasing_ppgtt(dev_priv);
 		if (ret)
-			goto err_ppgtt;
-
-		if (ppgtt->base.allocate_va_range) {
-			ret = ppgtt->base.allocate_va_range(&ppgtt->base, 0,
-							    ppgtt->base.total);
-			if (ret)
-				goto err_ppgtt_cleanup;
-		}
-
-		ppgtt->base.clear_range(&ppgtt->base,
-					ppgtt->base.start,
-					ppgtt->base.total);
-
-		dev_priv->mm.aliasing_ppgtt = ppgtt;
-		WARN_ON(ggtt->base.bind_vma != ggtt_bind_vma);
-		ggtt->base.bind_vma = aliasing_gtt_bind_vma;
+			goto err;
 	}
 
 	return 0;
 
-err_ppgtt_cleanup:
-	ppgtt->base.cleanup(&ppgtt->base);
-err_ppgtt:
-	kfree(ppgtt);
 err:
 	drm_mm_remove_node(&ggtt->error_capture);
 	return ret;
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
index 3c5ef5358cef..89db908173fb 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.h
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
@@ -525,6 +525,8 @@ i915_vm_to_ggtt(struct i915_address_space *vm)
 	return container_of(vm, struct i915_ggtt, base);
 }
 
+int i915_gem_init_aliasing_ppgtt(struct drm_i915_private *i915);
+
 int i915_ggtt_probe_hw(struct drm_i915_private *dev_priv);
 int i915_ggtt_init_hw(struct drm_i915_private *dev_priv);
 int i915_ggtt_enable_hw(struct drm_i915_private *dev_priv);
-- 
2.11.0

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

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

* [PATCH 2/2] drm/i915: Force an aliasing_ppgtt test for context execution
  2017-02-09 10:02 [PATCH 1/2] drm/i915: Extract aliasing ppgtt setup Chris Wilson
@ 2017-02-09 10:02 ` Chris Wilson
  2017-02-09 11:26   ` Chris Wilson
                     ` (2 more replies)
  2017-02-09 11:13 ` [PATCH 1/2] drm/i915: Extract aliasing ppgtt setup Joonas Lahtinen
  1 sibling, 3 replies; 6+ messages in thread
From: Chris Wilson @ 2017-02-09 10:02 UTC (permalink / raw)
  To: intel-gfx

Ensure that we minimally exercise the aliasing_ppgtt, even on a
full-ppgtt, by allocating one and similarly creating a context to use
it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/selftests/i915_gem_context.c | 27 ++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
index 00257949e195..6d3eca8c0c09 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
@@ -325,6 +325,7 @@ static int igt_ctx_exec(void *arg)
 	IGT_TIMEOUT(end_time);
 	LIST_HEAD(objects);
 	unsigned int count, dw;
+	bool first = true;
 	int err;
 
 	/* Create a few different contexts (with different mm) and write
@@ -344,9 +345,16 @@ static int igt_ctx_exec(void *arg)
 	while (!time_after(jiffies, end_time)) {
 		struct intel_engine_cs *engine;
 		struct i915_gem_context *ctx;
+		struct drm_i915_file_private *fpriv;
 		unsigned int id;
 
-		ctx = i915_gem_create_context(i915, file->driver_priv);
+		fpriv = file->driver_priv;
+		if (first) {
+			fpriv = NULL;
+			first = false;
+		}
+
+		ctx = i915_gem_create_context(i915, fpriv);
 		if (IS_ERR(ctx)) {
 			err = PTR_ERR(ctx);
 			goto out_unlock;
@@ -392,11 +400,24 @@ static int igt_ctx_exec(void *arg)
 	return err;
 }
 
-int i915_gem_context_live_selftests(struct drm_i915_private *i915)
+int i915_gem_context_live_selftests(struct drm_i915_private *dev_priv)
 {
 	static const struct i915_subtest tests[] = {
 		SUBTEST(igt_ctx_exec),
 	};
+	int err;
 
-	return i915_subtests(tests, i915);
+	/* Install a fake aliasing gtt for exercise */
+	if (USES_FULL_PPGTT(dev_priv)) {
+		err = i915_gem_init_aliasing_ppgtt(dev_priv);
+		if (err)
+			return err;
+	}
+
+	err = i915_subtests(tests, dev_priv);
+
+	if (USES_FULL_PPGTT(dev_priv))
+		i915_ppgtt_put(fetch_and_zero(&dev_priv->mm.aliasing_ppgtt));
+
+	return err;
 }
-- 
2.11.0

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

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

* Re: [PATCH 1/2] drm/i915: Extract aliasing ppgtt setup
  2017-02-09 10:02 [PATCH 1/2] drm/i915: Extract aliasing ppgtt setup Chris Wilson
  2017-02-09 10:02 ` [PATCH 2/2] drm/i915: Force an aliasing_ppgtt test for context execution Chris Wilson
@ 2017-02-09 11:13 ` Joonas Lahtinen
  1 sibling, 0 replies; 6+ messages in thread
From: Joonas Lahtinen @ 2017-02-09 11:13 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On to, 2017-02-09 at 10:02 +0000, Chris Wilson wrote:
> In order to force testing of the aliasing ppgtt, extract its
> initialisation function.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 2/2] drm/i915: Force an aliasing_ppgtt test for context execution
  2017-02-09 10:02 ` [PATCH 2/2] drm/i915: Force an aliasing_ppgtt test for context execution Chris Wilson
@ 2017-02-09 11:26   ` Chris Wilson
  2017-02-09 11:29   ` Chris Wilson
  2017-02-09 11:38   ` Joonas Lahtinen
  2 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2017-02-09 11:26 UTC (permalink / raw)
  To: intel-gfx

On Thu, Feb 09, 2017 at 10:02:49AM +0000, Chris Wilson wrote:
> Ensure that we minimally exercise the aliasing_ppgtt, even on a
> full-ppgtt, by allocating one and similarly creating a context to use
> it.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/selftests/i915_gem_context.c | 27 ++++++++++++++++++++---
>  1 file changed, 24 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
> index 00257949e195..6d3eca8c0c09 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
> @@ -325,6 +325,7 @@ static int igt_ctx_exec(void *arg)
>  	IGT_TIMEOUT(end_time);
>  	LIST_HEAD(objects);
>  	unsigned int count, dw;
> +	bool first = true;
>  	int err;
>  
>  	/* Create a few different contexts (with different mm) and write
> @@ -344,9 +345,16 @@ static int igt_ctx_exec(void *arg)
>  	while (!time_after(jiffies, end_time)) {
>  		struct intel_engine_cs *engine;
>  		struct i915_gem_context *ctx;
> +		struct drm_i915_file_private *fpriv;
>  		unsigned int id;
>  
> -		ctx = i915_gem_create_context(i915, file->driver_priv);
> +		fpriv = file->driver_priv;
> +		if (first) {
> +			fpriv = NULL;
> +			first = false;
> +		}

Alternative names for first: use_shared_gtt ?
(We may not end up using aliasing but the global gtt, however those
platforms already use global for all.)
-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] 6+ messages in thread

* Re: [PATCH 2/2] drm/i915: Force an aliasing_ppgtt test for context execution
  2017-02-09 10:02 ` [PATCH 2/2] drm/i915: Force an aliasing_ppgtt test for context execution Chris Wilson
  2017-02-09 11:26   ` Chris Wilson
@ 2017-02-09 11:29   ` Chris Wilson
  2017-02-09 11:38   ` Joonas Lahtinen
  2 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2017-02-09 11:29 UTC (permalink / raw)
  To: intel-gfx

On Thu, Feb 09, 2017 at 10:02:49AM +0000, Chris Wilson wrote:
> Ensure that we minimally exercise the aliasing_ppgtt, even on a
> full-ppgtt, by allocating one and similarly creating a context to use
> it.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/selftests/i915_gem_context.c | 27 ++++++++++++++++++++---
>  1 file changed, 24 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
> index 00257949e195..6d3eca8c0c09 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
> @@ -325,6 +325,7 @@ static int igt_ctx_exec(void *arg)
>  	IGT_TIMEOUT(end_time);
>  	LIST_HEAD(objects);
>  	unsigned int count, dw;
> +	bool first = true;
>  	int err;
>  
>  	/* Create a few different contexts (with different mm) and write
> @@ -344,9 +345,16 @@ static int igt_ctx_exec(void *arg)
>  	while (!time_after(jiffies, end_time)) {
>  		struct intel_engine_cs *engine;
>  		struct i915_gem_context *ctx;
> +		struct drm_i915_file_private *fpriv;
>  		unsigned int id;
>  
> -		ctx = i915_gem_create_context(i915, file->driver_priv);
> +		fpriv = file->driver_priv;
> +		if (first) {
> +			fpriv = NULL;
> +			first = false;
> +		}
> +
> +		ctx = i915_gem_create_context(i915, fpriv);

Hmm, I need a couple more tricks here :|
-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] 6+ messages in thread

* Re: [PATCH 2/2] drm/i915: Force an aliasing_ppgtt test for context execution
  2017-02-09 10:02 ` [PATCH 2/2] drm/i915: Force an aliasing_ppgtt test for context execution Chris Wilson
  2017-02-09 11:26   ` Chris Wilson
  2017-02-09 11:29   ` Chris Wilson
@ 2017-02-09 11:38   ` Joonas Lahtinen
  2 siblings, 0 replies; 6+ messages in thread
From: Joonas Lahtinen @ 2017-02-09 11:38 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On to, 2017-02-09 at 10:02 +0000, Chris Wilson wrote:
> Ensure that we minimally exercise the aliasing_ppgtt, even on a
> full-ppgtt, by allocating one and similarly creating a context to use
> it.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Sent a patch for __destroy_hw_context while reviewing.

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2017-02-09 11:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-09 10:02 [PATCH 1/2] drm/i915: Extract aliasing ppgtt setup Chris Wilson
2017-02-09 10:02 ` [PATCH 2/2] drm/i915: Force an aliasing_ppgtt test for context execution Chris Wilson
2017-02-09 11:26   ` Chris Wilson
2017-02-09 11:29   ` Chris Wilson
2017-02-09 11:38   ` Joonas Lahtinen
2017-02-09 11:13 ` [PATCH 1/2] drm/i915: Extract aliasing ppgtt setup Joonas Lahtinen

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.