AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lang Yu <Lang.Yu@amd.com>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>
Cc: Jack Xiao <Jack.Xiao@amd.com>,
	Christian Koenig <christian.koenig@amd.com>,
	amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu: avoid null dereference of fence when using cpu to update page tables
Date: Fri, 5 May 2023 20:42:24 +0800	[thread overview]
Message-ID: <ZFT5sEfCcOPOVLP9@lang-desktop> (raw)
In-Reply-To: <412dddbe-67a1-48c4-1eb5-9cb7d672d79e@gmail.com>

On 05/05/ , Christian König wrote:
> Am 05.05.23 um 11:10 schrieb Lang Yu:
> > Using cpu to update page tables is sychronous, no need to wait fence
> > and it is NULL in such a case.
> 
> Good catch, be we usually install the stub into fence pointers when they are
> unused. See dma_fence_get_stub().

Got it. Thanks for your suggestions.

Regards,
Lang

> Christian.
> 
> > 
> > Signed-off-by: Lang Yu <Lang.Yu@amd.com>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 7 +++++--
> >   1 file changed, 5 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
> > index f0f00466b59f..197981c4ac7d 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
> > @@ -1043,8 +1043,11 @@ int amdgpu_mes_add_ring(struct amdgpu_device *adev, int gang_id,
> >   	amdgpu_mes_ring_to_queue_props(adev, ring, &qprops);
> > -	dma_fence_wait(gang->process->vm->last_update, false);
> > -	dma_fence_wait(ctx_data->meta_data_va->last_pt_update, false);
> > +	if (gang->process->vm->last_update)
> > +		dma_fence_wait(gang->process->vm->last_update, false);
> > +	if (ctx_data->meta_data_va->last_pt_update)
> > +		dma_fence_wait(ctx_data->meta_data_va->last_pt_update, false);
> > +
> >   	amdgpu_mes_unlock(&adev->mes);
> >   	r = amdgpu_mes_add_hw_queue(adev, gang_id, &qprops, &queue_id);
> 

      reply	other threads:[~2023-05-05 12:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-05  9:10 [PATCH] drm/amdgpu: avoid null dereference of fence when using cpu to update page tables Lang Yu
2023-05-05 11:13 ` Christian König
2023-05-05 12:42   ` Lang Yu [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=ZFT5sEfCcOPOVLP9@lang-desktop \
    --to=lang.yu@amd.com \
    --cc=Jack.Xiao@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=ckoenig.leichtzumerken@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox