* [PATCH] drm/amdgpu: avoid null dereference of fence when using cpu to update page tables
@ 2023-05-05 9:10 Lang Yu
2023-05-05 11:13 ` Christian König
0 siblings, 1 reply; 3+ messages in thread
From: Lang Yu @ 2023-05-05 9:10 UTC (permalink / raw)
To: amd-gfx; +Cc: Jack Xiao, Lang Yu, Christian Koenig
Using cpu to update page tables is sychronous, no need to wait fence
and it is NULL in such a case.
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);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/amdgpu: avoid null dereference of fence when using cpu to update page tables
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
0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2023-05-05 11:13 UTC (permalink / raw)
To: Lang Yu, amd-gfx; +Cc: Jack Xiao, Christian Koenig
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().
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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/amdgpu: avoid null dereference of fence when using cpu to update page tables
2023-05-05 11:13 ` Christian König
@ 2023-05-05 12:42 ` Lang Yu
0 siblings, 0 replies; 3+ messages in thread
From: Lang Yu @ 2023-05-05 12:42 UTC (permalink / raw)
To: Christian König; +Cc: Jack Xiao, Christian Koenig, amd-gfx
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);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-05 12:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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.