[PATCH v3 11/13] drm/sched: Waiting for pending jobs to complete in scheduler kill

Matthew Brost matthew.brost at intel.com
Tue Sep 12 14:54:14 UTC 2023


On Tue, Sep 12, 2023 at 12:28:28PM +0200, Boris Brezillon wrote:
> On Mon, 11 Sep 2023 19:16:13 -0700
> Matthew Brost <matthew.brost at intel.com> wrote:
> 
> > +void drm_sched_add_pending_job(struct drm_sched_job *job, bool tail)
> > +{
> > +	struct drm_gpu_scheduler *sched = job->sched;
> > +	struct drm_sched_entity *entity = job->entity;
> 
> drm_sched_entity_pop_job() sets job->entity to NULL [1], and I end with
> a NULL deref in this function. I guess you have another patch in your
> tree dropping this job->entity = NULL in drm_sched_entity_pop_job(),
> but given this comment [1], it's probably not the right thing to do.
> 

Didn't fully test this one, regardless I will drop this patch in the
next rev.

Matt

> > +
> > +	lockdep_assert_held(&sched->job_list_lock);
> > +
> > +	if (tail)
> > +		list_add_tail(&job->list, &sched->pending_list);
> > +	else
> > +		list_add(&job->list, &sched->pending_list);
> > +	if (!entity->pending_job_count++)
> > +		reinit_completion(&entity->jobs_done);
> > +}
> > +EXPORT_SYMBOL(drm_sched_add_pending_job);
> 
> [1]https://elixir.bootlin.com/linux/v6.6-rc1/source/drivers/gpu/drm/scheduler/sched_entity.c#L497


More information about the dri-devel mailing list