Re: [PATCH 24/51] drm/i915: Add i915_sched_engine destroy vfunc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 20, 2021 at 12:55:08PM -0700, John Harrison wrote:
> On 7/16/2021 13:16, Matthew Brost wrote:
> > This help the backends clean up when the schedule engine object gets
> help -> helps. Although, I would say it's more like 'this is required to
> allow backend specific cleanup'. It doesn't just make life a bit easier, it
> allows us to not leak stuff and/or dereference null pointers!
> 
> Either way...
> Reviewed-by: John Harrison <John.C.Harrison@xxxxxxxxx>

I'll reword it.

Matt

> 
> > destroyed.
> > 
> > Signed-off-by: Matthew Brost <matthew.brost@xxxxxxxxx>
> > ---
> >   drivers/gpu/drm/i915/i915_scheduler.c       | 3 ++-
> >   drivers/gpu/drm/i915/i915_scheduler.h       | 4 +---
> >   drivers/gpu/drm/i915/i915_scheduler_types.h | 5 +++++
> >   3 files changed, 8 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_scheduler.c b/drivers/gpu/drm/i915/i915_scheduler.c
> > index 3a58a9130309..4fceda96deed 100644
> > --- a/drivers/gpu/drm/i915/i915_scheduler.c
> > +++ b/drivers/gpu/drm/i915/i915_scheduler.c
> > @@ -431,7 +431,7 @@ void i915_request_show_with_schedule(struct drm_printer *m,
> >   	rcu_read_unlock();
> >   }
> > -void i915_sched_engine_free(struct kref *kref)
> > +static void default_destroy(struct kref *kref)
> >   {
> >   	struct i915_sched_engine *sched_engine =
> >   		container_of(kref, typeof(*sched_engine), ref);
> > @@ -453,6 +453,7 @@ i915_sched_engine_create(unsigned int subclass)
> >   	sched_engine->queue = RB_ROOT_CACHED;
> >   	sched_engine->queue_priority_hint = INT_MIN;
> > +	sched_engine->destroy = default_destroy;
> >   	INIT_LIST_HEAD(&sched_engine->requests);
> >   	INIT_LIST_HEAD(&sched_engine->hold);
> > diff --git a/drivers/gpu/drm/i915/i915_scheduler.h b/drivers/gpu/drm/i915/i915_scheduler.h
> > index 650ab8e0db9f..3c9504e9f409 100644
> > --- a/drivers/gpu/drm/i915/i915_scheduler.h
> > +++ b/drivers/gpu/drm/i915/i915_scheduler.h
> > @@ -51,8 +51,6 @@ static inline void i915_priolist_free(struct i915_priolist *p)
> >   struct i915_sched_engine *
> >   i915_sched_engine_create(unsigned int subclass);
> > -void i915_sched_engine_free(struct kref *kref);
> > -
> >   static inline struct i915_sched_engine *
> >   i915_sched_engine_get(struct i915_sched_engine *sched_engine)
> >   {
> > @@ -63,7 +61,7 @@ i915_sched_engine_get(struct i915_sched_engine *sched_engine)
> >   static inline void
> >   i915_sched_engine_put(struct i915_sched_engine *sched_engine)
> >   {
> > -	kref_put(&sched_engine->ref, i915_sched_engine_free);
> > +	kref_put(&sched_engine->ref, sched_engine->destroy);
> >   }
> >   static inline bool
> > diff --git a/drivers/gpu/drm/i915/i915_scheduler_types.h b/drivers/gpu/drm/i915/i915_scheduler_types.h
> > index 5935c3152bdc..00384e2c5273 100644
> > --- a/drivers/gpu/drm/i915/i915_scheduler_types.h
> > +++ b/drivers/gpu/drm/i915/i915_scheduler_types.h
> > @@ -163,6 +163,11 @@ struct i915_sched_engine {
> >   	 */
> >   	void *private_data;
> > +	/**
> > +	 * @destroy: destroy schedule engine / cleanup in backend
> > +	 */
> > +	void	(*destroy)(struct kref *kref);
> > +
> >   	/**
> >   	 * @kick_backend: kick backend after a request's priority has changed
> >   	 */
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux