All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhang, Jerry (Junwei)" <Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
To: "Michel Dänzer" <michel-otUistvHUpPR7s880joybQ@public.gmane.org>
Cc: christian.koenig-5C7GfCeVMHo@public.gmane.org,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH] drm/scheduler: add NULL pointer check for run queue (v2)
Date: Tue, 17 Jul 2018 11:11:28 +0800	[thread overview]
Message-ID: <5B4D5E60.1090602@amd.com> (raw)
In-Reply-To: <e62a1051-00c9-99b2-dd83-d8f47e9038f4-otUistvHUpPR7s880joybQ@public.gmane.org>

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@amd.com>
>> Signed-off-by: Junwei Zhang <Jerry.Zhang@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.
>
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

      parent reply	other threads:[~2018-07-17  3:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-16  9:23 [PATCH] drm/scheduler: add NULL pointer check for run queue (v2) Junwei Zhang
     [not found] ` <1531733034-22183-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
2018-07-16  9:27   ` Christian König
2018-07-16  9:54   ` Michel Dänzer
     [not found]     ` <e62a1051-00c9-99b2-dd83-d8f47e9038f4-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-07-17  3:11       ` Zhang, Jerry (Junwei) [this message]

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=5B4D5E60.1090602@amd.com \
    --to=jerry.zhang-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=michel-otUistvHUpPR7s880joybQ@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.