[PATCH v2] drm/amdgpu: skip force complete fences when ring is uninitialized
Christian König
christian.koenig at amd.com
Wed May 31 13:06:49 UTC 2023
Am 31.05.23 um 11:34 schrieb Bob Zhou:
> 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.
Mhm, taking a higher level look at this why isn't the ring initialized
when the VCPU BO is allocated?
Adding Leo as well since that looks more like a design issue to me.
Regards,
Christian.
>
> Fixes: 043f2271e2d0 ("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 at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> index b7441654e6fa..70e7e9585d3c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> @@ -506,7 +506,8 @@ int amdgpu_uvd_resume(struct amdgpu_device *adev)
> }
> memset_io(ptr, 0, size);
> /* to restore uvd fence seq */
> - amdgpu_fence_driver_force_completion(&adev->uvd.inst[i].ring);
> + if (adev->uvd.inst[i].ring.fence_drv.irq_src)
> + amdgpu_fence_driver_force_completion(&adev->uvd.inst[i].ring);
> }
> }
> return 0;
More information about the amd-gfx
mailing list