Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 02/20] drm/i915/gt: Hook up intel_context_fini()
Date: Mon, 22 Jul 2019 13:22:09 +0100	[thread overview]
Message-ID: <d0deadda-3c29-033a-e3d7-27f7f3cabd26@linux.intel.com> (raw)
In-Reply-To: <20190718070024.21781-2-chris@chris-wilson.co.uk>


On 18/07/2019 08:00, Chris Wilson wrote:
> Prior to freeing the struct, call the fini function to cleanup the
> common members. Currently this only calls the debug functions to mark
> the structs as destroyed, but may be extended to real work in future.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>   drivers/gpu/drm/i915/gt/intel_context.c    | 6 ++++++
>   drivers/gpu/drm/i915/gt/intel_context.h    | 1 +
>   drivers/gpu/drm/i915/gt/intel_lrc.c        | 2 ++
>   drivers/gpu/drm/i915/gt/intel_ringbuffer.c | 1 +
>   drivers/gpu/drm/i915/gt/mock_engine.c      | 1 +
>   5 files changed, 11 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_context.c b/drivers/gpu/drm/i915/gt/intel_context.c
> index b667e2b35804..9292b6ca5e9c 100644
> --- a/drivers/gpu/drm/i915/gt/intel_context.c
> +++ b/drivers/gpu/drm/i915/gt/intel_context.c
> @@ -204,6 +204,12 @@ intel_context_init(struct intel_context *ce,
>   			 __intel_context_active, __intel_context_retire);
>   }
>   
> +void intel_context_fini(struct intel_context *ce)
> +{
> +	mutex_destroy(&ce->pin_mutex);
> +	i915_active_fini(&ce->active);
> +}
> +
>   static void i915_global_context_shrink(void)
>   {
>   	kmem_cache_shrink(global.slab_ce);
> diff --git a/drivers/gpu/drm/i915/gt/intel_context.h b/drivers/gpu/drm/i915/gt/intel_context.h
> index b41c610c2ce6..23c7e4c0ce7c 100644
> --- a/drivers/gpu/drm/i915/gt/intel_context.h
> +++ b/drivers/gpu/drm/i915/gt/intel_context.h
> @@ -16,6 +16,7 @@
>   void intel_context_init(struct intel_context *ce,
>   			struct i915_gem_context *ctx,
>   			struct intel_engine_cs *engine);
> +void intel_context_fini(struct intel_context *ce);
>   
>   struct intel_context *
>   intel_context_create(struct i915_gem_context *ctx,
> diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
> index d076d9148b6d..f95a042a92c6 100644
> --- a/drivers/gpu/drm/i915/gt/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
> @@ -1553,6 +1553,7 @@ static void execlists_context_destroy(struct kref *kref)
>   	if (ce->state)
>   		__execlists_context_fini(ce);
>   
> +	intel_context_fini(ce);
>   	intel_context_free(ce);
>   }
>   
> @@ -3186,6 +3187,7 @@ static void virtual_context_destroy(struct kref *kref)
>   
>   	if (ve->context.state)
>   		__execlists_context_fini(&ve->context);
> +	intel_context_fini(&ve->context);
>   
>   	kfree(ve->bonds);
>   	kfree(ve);
> diff --git a/drivers/gpu/drm/i915/gt/intel_ringbuffer.c b/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
> index 901ce1a94664..b056f25c66f2 100644
> --- a/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
> +++ b/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
> @@ -1388,6 +1388,7 @@ static void ring_context_destroy(struct kref *ref)
>   	if (ce->state)
>   		__ring_context_fini(ce);
>   
> +	intel_context_fini(ce);
>   	intel_context_free(ce);
>   }
>   
> diff --git a/drivers/gpu/drm/i915/gt/mock_engine.c b/drivers/gpu/drm/i915/gt/mock_engine.c
> index 490ebd121f4c..10cb312462e5 100644
> --- a/drivers/gpu/drm/i915/gt/mock_engine.c
> +++ b/drivers/gpu/drm/i915/gt/mock_engine.c
> @@ -142,6 +142,7 @@ static void mock_context_destroy(struct kref *ref)
>   	if (ce->ring)
>   		mock_ring_free(ce->ring);
>   
> +	intel_context_fini(ce);
>   	intel_context_free(ce);
>   }
>   
> 

The patch which builds upon this looks like a good direction.

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

  reply	other threads:[~2019-07-22 12:22 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190718070024.21781-1-chris@chris-wilson.co.uk>
2019-07-18  7:00 ` [PATCH 02/20] drm/i915/gt: Hook up intel_context_fini() Chris Wilson
2019-07-22 12:22   ` Tvrtko Ursulin [this message]
2019-07-18  7:00 ` [PATCH 04/20] drm/i915/execlists: Cancel breadcrumb on preempting the virtual engine Chris Wilson
2019-07-18  7:00 ` [PATCH 05/20] drm/i915: Hide unshrinkable context objects from the shrinker Chris Wilson
2019-07-18  7:00 ` [PATCH 06/20] drm/i915: Remove obsolete engine cleanup Chris Wilson
2019-07-22 12:46   ` Tvrtko Ursulin
2019-07-22 16:29     ` Chris Wilson
2019-07-18  7:00 ` [PATCH 07/20] drm/i915/gt: Move the [class][inst] lookup for engines onto the GT Chris Wilson
2019-07-18  7:00 ` [PATCH 09/20] drm/i915: Use intel_engine_lookup_user for probing HAS_BSD etc Chris Wilson
2019-07-22 12:49   ` Tvrtko Ursulin
2019-07-22 16:34     ` Chris Wilson
2019-07-18  7:00 ` [PATCH 11/20] drm/i915: Rely on spinlock protection for GPU error capture Chris Wilson
2019-07-22 13:40   ` Tvrtko Ursulin
2019-07-18  7:00 ` [PATCH 13/20] drm/i915: Teach execbuffer to take the engine wakeref not GT Chris Wilson
2019-07-22 16:03   ` Tvrtko Ursulin
2019-07-18  7:00 ` [PATCH 14/20] drm/i915/gt: Track timeline activeness in enter/exit Chris Wilson
2019-07-22 16:14   ` Tvrtko Ursulin
2019-07-22 16:42     ` Chris Wilson
2019-07-18  7:00 ` [PATCH 15/20] drm/i915/gt: Convert timeline tracking to spinlock Chris Wilson
2019-07-18  7:00 ` [PATCH 17/20] drm/i915/gt: Add to timeline requires the timeline mutex Chris Wilson
2019-07-18  7:00 ` [PATCH 18/20] drm/i915: Protect request retirement with timeline->mutex Chris Wilson
2019-07-18  7:00 ` [PATCH 20/20] drm/i915/gt: Mark context->active_count as protected by timeline->mutex Chris Wilson
2019-07-18  7:16 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/20] drm/i915: Move aliasing_ppgtt underneath its i915_ggtt Patchwork
2019-07-18  7:25 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-07-18  7:48 ` ✓ Fi.CI.BAT: success " Patchwork
2019-07-18 10:05 ` ✓ Fi.CI.IGT: " Patchwork
     [not found] ` <20190718070024.21781-3-chris@chris-wilson.co.uk>
2019-07-22 12:33   ` [PATCH 03/20] drm/i915/gt: Provde a local intel_context.vm Tvrtko Ursulin
2019-07-22 16:28     ` Chris Wilson
2019-07-23 13:44       ` Tvrtko Ursulin
     [not found] ` <20190718070024.21781-10-chris@chris-wilson.co.uk>
2019-07-22 12:53   ` [PATCH 10/20] drm/i915: Isolate i915_getparam_ioctl() Tvrtko Ursulin
2019-07-22 16:04   ` Tvrtko Ursulin
2019-07-22 16:16     ` 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=d0deadda-3c29-033a-e3d7-27f7f3cabd26@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox