[PATCH 2/2] drm/xe: Add a WARN_ON for NULL job in xe_sync_entry_signal

Matthew Brost matthew.brost at intel.com
Mon Mar 18 15:18:05 UTC 2024


On Mon, Mar 18, 2024 at 03:27:24PM +0100, Nirmoy Das wrote:
> Hi Matt,
> 
> On 3/18/2024 3:21 PM, Matthew Brost wrote:
> > On Mon, Mar 18, 2024 at 02:50:00PM +0100, Nirmoy Das wrote:
> > > Add a warn for NULL job when sync->type is
> > > DRM_XE_SYNC_TYPE_USER_FENCE. This should be a programming
> > > error and should never happen so warn and let the kernel crash
> > > if that ever happens.
> > > 
> > > Cc: Matthew Auld<matthew.auld at intel.com>
> > > Cc: Matthew Brost<matthew.brost at intel.com>
> > > Signed-off-by: Nirmoy Das<nirmoy.das at intel.com>
> > > ---
> > >   drivers/gpu/drm/xe/xe_sync.c | 1 +
> > >   1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/drivers/gpu/drm/xe/xe_sync.c b/drivers/gpu/drm/xe/xe_sync.c
> > > index 02c9577fe418..2b45950aa0af 100644
> > > --- a/drivers/gpu/drm/xe/xe_sync.c
> > > +++ b/drivers/gpu/drm/xe/xe_sync.c
> > > @@ -255,6 +255,7 @@ void xe_sync_entry_signal(struct xe_sync_entry *sync, struct xe_sched_job *job,
> > >   			dma_fence_put(fence);
> > >   		}
> > >   	} else if (sync->type == DRM_XE_SYNC_TYPE_USER_FENCE) {
> > > +		XE_WARN_ON(job);
> > For a warn on you this inverted - a WARN_ON(true) will pop.
> Thanks,  that was stupid of me. I meant to do "WARN_ON(!job)"
> 
> > 
> > But I think we should actually use an xe_assert here which has this
> > opposite behavior - pops on xe_assert(xe, false).
> > 
> > So the I think it should be:
> > 
> > xe_assert(xe, job);
> 
> xe_assert needed a xe device struct which I can't find a better way to
> retrieve than to pass it on as new argument
> 

Ah, yes I suppose job_to_xe requires a valid job...

> I think that is bit too much change for it. I will resend with
> WARN_ON(!job).
>

That works.

Matt

> 
> Regards,
> 
> Nirmoy
> 
> > 
> > Matt
> > 
> > >   		job->user_fence.used = true;
> > >   		job->user_fence.addr = sync->addr;
> > >   		job->user_fence.value = sync->timeline_value;
> > > -- 
> > > 2.42.0
> > > 


More information about the Intel-xe mailing list