On 07/16/2018 05:54 PM, Michel Dänzer wrote: > On 2018-07-16 11:23 AM, Junwei Zhang wrote: >> To check rq pointer before adding entity into it. >> That avoids NULL pointer access in some case. >> >> v2: move the check to caller >> >> Suggested-by: Christian König <christian.koenig at amd.com> >> Signed-off-by: Junwei Zhang <Jerry.Zhang at amd.com> >> --- >> drivers/gpu/drm/scheduler/gpu_scheduler.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c b/drivers/gpu/drm/scheduler/gpu_scheduler.c >> index 16bf446..dac71e3 100644 >> --- a/drivers/gpu/drm/scheduler/gpu_scheduler.c >> +++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c >> @@ -547,6 +547,11 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job, >> if (first) { >> /* Add the entity to the run queue */ >> spin_lock(&entity->rq_lock); >> + if (!entity->rq) { >> + DRM_ERROR("Trying to push to a killed entity\n"); > > This could result in spamming dmesg with this error message. I suggest Thanks for your comments. Actually it will cause App or GPU hang, as the job is unexpected to push to a non-existing entity run queue. Now we're trying to predict that before kernel panic or BUG_ON. Regards, Jerry > > if (WARN_ON_ONCE(!entity->rq)) { > > instead, no DRM_ERROR. That will produce a single warning with a backtrace. > >