Re: [Intel-gfx] [PATCH 09/17] drm/i915: Push the ring creation flags to the backend

2019-09-06 Thread Chris Wilson
Quoting Tvrtko Ursulin (2019-09-02 14:59:16)
> 
> On 05/08/2019 18:08, Andi Shyti wrote:
> > Hi Chris,
> > 
> > On Tue, Jul 30, 2019 at 02:30:27PM +0100, Chris Wilson wrote:
> >> Push the ring creation flags from the outer GEM context to the inner
> >> intel_cotnext to avoid an unsightly back-reference from inside the
> >> backend.
> >>
> >> Signed-off-by: Chris Wilson 
> > 
> > looks nice!
> > 
> > Reviewed-by: Andi Shyti 
> 
> I wish my complaints on this patch weren't just ignored.

You wanted a union for a one-off value, and I disagreed as imo it
overformalised the parameter passing and made it look like persistent
state.
-Chris
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH 09/17] drm/i915: Push the ring creation flags to the backend

2019-09-02 Thread Tvrtko Ursulin


On 30/07/2019 14:30, Chris Wilson wrote:

Push the ring creation flags from the outer GEM context to the inner
intel_cotnext to avoid an unsightly back-reference from inside the


typo


backend.


No mention of the pointer overload trick.



Signed-off-by: Chris Wilson 
---
  drivers/gpu/drm/i915/gem/i915_gem_context.c   | 21 +++--
  .../gpu/drm/i915/gem/i915_gem_context_types.h |  3 ---
  drivers/gpu/drm/i915/gt/intel_context.c   |  1 +
  drivers/gpu/drm/i915/gt/intel_context.h   |  5 
  drivers/gpu/drm/i915/gt/intel_engine_cs.c |  2 ++
  drivers/gpu/drm/i915/gt/intel_lrc.c   |  5 ++--
  drivers/gpu/drm/i915/gt/intel_ringbuffer.c|  2 +-
  drivers/gpu/drm/i915/gt/mock_engine.c |  9 ++--
  drivers/gpu/drm/i915/i915_debugfs.c   | 23 ---
  9 files changed, 47 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c 
b/drivers/gpu/drm/i915/gem/i915_gem_context.c
index 1b3dc7258ef2..2e8cedce059f 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
@@ -434,8 +434,6 @@ __create_context(struct drm_i915_private *i915)
i915_gem_context_set_bannable(ctx);
i915_gem_context_set_recoverable(ctx);
  
-	ctx->ring_size = 4 * PAGE_SIZE;

-
for (i = 0; i < ARRAY_SIZE(ctx->hang_timestamp); i++)
ctx->hang_timestamp[i] = jiffies - CONTEXT_FAST_HANG_JIFFIES;
  
@@ -565,8 +563,15 @@ i915_gem_context_create_gvt(struct drm_device *dev)

i915_gem_context_set_closed(ctx); /* not user accessible */
i915_gem_context_clear_bannable(ctx);
i915_gem_context_set_force_single_submission(ctx);
-   if (!USES_GUC_SUBMISSION(to_i915(dev)))
-   ctx->ring_size = 512 * PAGE_SIZE; /* Max ring buffer size */
+   if (!USES_GUC_SUBMISSION(to_i915(dev))) {
+   const unsigned long ring_size = 512 * SZ_4K; /* max */
+   struct i915_gem_engines_iter it;
+   struct intel_context *ce;
+
+   for_each_gem_engine(ce, i915_gem_context_lock_engines(ctx), it)
+   ce->ring = __intel_context_ring_size(ring_size);
+   i915_gem_context_unlock_engines(ctx);
+   }
  
  	GEM_BUG_ON(i915_gem_context_is_kernel(ctx));

  out:
@@ -605,7 +610,6 @@ i915_gem_context_create_kernel(struct drm_i915_private 
*i915, int prio)
  
  	i915_gem_context_clear_bannable(ctx);

ctx->sched.priority = I915_USER_PRIORITY(prio);
-   ctx->ring_size = PAGE_SIZE;
  
  	GEM_BUG_ON(!i915_gem_context_is_kernel(ctx));
  
@@ -1589,6 +1593,7 @@ set_engines(struct i915_gem_context *ctx,

for (n = 0; n < num_engines; n++) {
struct i915_engine_class_instance ci;
struct intel_engine_cs *engine;
+   struct intel_context *ce;
  
  		if (copy_from_user(, >engines[n], sizeof(ci))) {

__free_engines(set.engines, n);
@@ -1611,11 +1616,13 @@ set_engines(struct i915_gem_context *ctx,
return -ENOENT;
}
  
-		set.engines->engines[n] = intel_context_create(ctx, engine);

-   if (!set.engines->engines[n]) {
+   ce = intel_context_create(ctx, engine);
+   if (!ce) {
__free_engines(set.engines, n);
return -ENOMEM;
}
+
+   set.engines->engines[n] = ce;
}
set.engines->num_engines = num_engines;
  
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context_types.h b/drivers/gpu/drm/i915/gem/i915_gem_context_types.h

index a02d98494078..260d59cc3de8 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_context_types.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_context_types.h
@@ -169,9 +169,6 @@ struct i915_gem_context {
  
  	struct i915_sched_attr sched;
  
-	/** ring_size: size for allocating the per-engine ring buffer */

-   u32 ring_size;
-
/** guilty_count: How many times this context has caused a GPU hang. */
atomic_t guilty_count;
/**
diff --git a/drivers/gpu/drm/i915/gt/intel_context.c 
b/drivers/gpu/drm/i915/gt/intel_context.c
index 34c8e37a73b8..db9236570ff5 100644
--- a/drivers/gpu/drm/i915/gt/intel_context.c
+++ b/drivers/gpu/drm/i915/gt/intel_context.c
@@ -214,6 +214,7 @@ intel_context_init(struct intel_context *ce,
ce->engine = engine;
ce->ops = engine->cops;
ce->sseu = engine->sseu;
+   ce->ring = __intel_context_ring_size(SZ_16K);
  
  	INIT_LIST_HEAD(>signal_link);

INIT_LIST_HEAD(>signals);
diff --git a/drivers/gpu/drm/i915/gt/intel_context.h 
b/drivers/gpu/drm/i915/gt/intel_context.h
index 07f9924de48f..13f28dd316bc 100644
--- a/drivers/gpu/drm/i915/gt/intel_context.h
+++ b/drivers/gpu/drm/i915/gt/intel_context.h
@@ -136,4 +136,9 @@ int intel_context_prepare_remote_request(struct 
intel_context *ce,
  
  struct i915_request *intel_context_create_request(struct intel_context 

Re: [Intel-gfx] [PATCH 09/17] drm/i915: Push the ring creation flags to the backend

2019-09-02 Thread Tvrtko Ursulin


On 05/08/2019 18:08, Andi Shyti wrote:

Hi Chris,

On Tue, Jul 30, 2019 at 02:30:27PM +0100, Chris Wilson wrote:

Push the ring creation flags from the outer GEM context to the inner
intel_cotnext to avoid an unsightly back-reference from inside the
backend.

Signed-off-by: Chris Wilson 


looks nice!

Reviewed-by: Andi Shyti 


I wish my complaints on this patch weren't just ignored.

Regards,

Tvrtko

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

Re: [Intel-gfx] [PATCH 09/17] drm/i915: Push the ring creation flags to the backend

2019-08-05 Thread Andi Shyti
Hi Chris,

On Tue, Jul 30, 2019 at 02:30:27PM +0100, Chris Wilson wrote:
> Push the ring creation flags from the outer GEM context to the inner
> intel_cotnext to avoid an unsightly back-reference from inside the
> backend.
> 
> Signed-off-by: Chris Wilson 

looks nice!

Reviewed-by: Andi Shyti 

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