RE: [PATCH] drm/amdgpu: skip force complete fences when ring is uninitialized

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[Public]

Reviewed-by: Guchun Chen <guchun.chen@xxxxxxx>

Regards,
Guchun

> -----Original Message-----
> From: Bob Zhou <bob.zhou@xxxxxxx>
> Sent: Wednesday, May 31, 2023 12:48 PM
> To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx; Min, Frank <Frank.Min@xxxxxxx>;
> Koenig, Christian <Christian.Koenig@xxxxxxx>
> Cc: Chen, Guchun <Guchun.Chen@xxxxxxx>; Zhou, Bob
> <Bob.Zhou@xxxxxxx>
> Subject: [PATCH] drm/amdgpu: skip force complete fences when ring is
> uninitialized
>
> uvd ring in uvd_v7_0_sw_init only initializes ring in bare metal case, so when
> executing amdgpu_uvd_resume to restore fence seq in SRIOV, a null pointer
> dereference will occur. This patch correct this.
>
> Fixes: 043f2271e2d0a ("drm/amdgpu: mark force completed fences with -
> ECANCELED")
>
> BUG: kernel NULL pointer dereference, address: 0000000000000000
> Oops: 0000 [#1] PREEMPT SMP PTI
> RIP: 0010:amdgpu_fence_driver_set_error+0x3f/0xc0 [amdgpu] Call Trace:
>  <TASK>
>  amdgpu_fence_driver_force_completion+0x18/0x50 [amdgpu]
>  amdgpu_uvd_resume+0x1b2/0x380 [amdgpu]
>  ? amdgpu_ring_init+0x73c/0x820 [amdgpu]
>  uvd_v7_0_sw_init+0x358/0x450 [amdgpu]
>  amdgpu_device_init.cold+0x198c/0x1fdf [amdgpu]  ?
> pci_bus_read_config_byte+0x40/0x80
>  ? pci_read_config_byte+0x27/0x50
>  amdgpu_driver_load_kms+0x1a/0x160 [amdgpu]
>  amdgpu_pci_probe+0x186/0x3c0 [amdgpu]
>
> Signed-off-by: Bob Zhou <bob.zhou@xxxxxxx>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> index c694b41f6461..d2c5484309a6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> @@ -723,6 +723,8 @@ void amdgpu_fence_driver_set_error(struct
> amdgpu_ring *ring, int error)
>   */
>  void amdgpu_fence_driver_force_completion(struct amdgpu_ring *ring)  {
> +     if (ring->fence_drv.irq_src)
> +             return;
>       amdgpu_fence_driver_set_error(ring, -ECANCELED);
>       amdgpu_fence_write(ring, ring->fence_drv.sync_seq);
>       amdgpu_fence_process(ring);
> --
> 2.34.1





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux