drm/amdgpu: check ring being ready before using
Subsystems (2)
PATCH 1/1 drm/amdgpu: check ring being ready before using
From: Ding Pixel <[email protected]>
Return success when the ring is properly initialized, otherwise return failure.
Tonga SRIOV VF doesn't have UVD and VCE engines, the initialization of these IPs is bypassed. The system crashes if application submit IB to their rings which are not ready to use. It could be a common issue if IP having ring buffer is disabled for some reason on specific ASIC, so it should check the ring being ready to use.
Bug: amdgpu_test crashes system on Tonga VF.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +6 -0
@@ -83,6 +83,12 @@ int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type, }break ; } + +if (!(*out_ring && (*out_ring)->ready)) { +DRM_ERROR ("invalid ip type: %d\n" , ip_type); +return -EINVAL ; + } +return 0 ; }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Am 18.01.2017 um 11:37 schrieb Pixel Ding:
Quoted 5 lines
From: Ding Pixel <[email protected]>
Return success when the ring is properly initialized, otherwise return failure.
Quoted 7 lines
Tonga SRIOV VF doesn't have UVD and VCE engines, the initialization of these IPs is bypassed. The system crashes if application submit IB to their rings which are not ready to use. It could be a common issue if IP having ring buffer is disabled for some reason on specific ASIC, so it should check the ring being ready to use.
Bug:
amdgpu_testcrashes system on Tonga VF.
Good catch, we probably have problem using the second VCE ring as well.
Quoted 11 lines
Signed-off-by Ding Pixel <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type, · line 87
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2
-0@@ -83,6 +83,12 @@ int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type, }break ; } + +if (!(*out_ring && (*out_ring)->ready)) {
Don't check ring->ready here, that member is used during GPU reset to test if we have successfully restarted the ring.
Instead check if ring->adev is set, that is used in ring_init() to check if a ring is initialized or not.
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type, · line 88
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1
-0+DRM_ERROR ("invalid ip type: %d\n" , ip_type);
Please adjust the error message to something like "ring %d not initialized on IP %d\".
Regards,
Christian.
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type, · line 94
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +3
-0+return -EINVAL ; + } +return 0 ; }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian,
Thank you for the quick comments. The revision is coming soon.
—
Sincerely Yours,
Pixel
Quoted 47 lines · Christian König
Am 18.01.2017 um 11:37 schrieb Pixel Ding:
Quoted 5 lines
From: Ding Pixel <[email protected]>
Return success when the ring is properly initialized, otherwise return failure.
Quoted 7 lines
Tonga SRIOV VF doesn't have UVD and VCE engines, the initialization of these IPs is bypassed. The system crashes if application submit IB to their rings which are not ready to use. It could be a common issue if IP having ring buffer is disabled for some reason on specific ASIC, so it should check the ring being ready to use.
Bug:
amdgpu_testcrashes system on Tonga VF.Good catch, we probably have problem using the second VCE ring as well.
Quoted 11 lines
Signed-off-by Ding Pixel <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type, · line 87
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2
-0@@ -83,6 +83,12 @@ int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type, }break ; } + +if (!(*out_ring && (*out_ring)->ready)) {Don't check
ring->readyhere, that member is used during GPU reset to test if we have successfully restarted the ring.Instead check if
ring->adevis set, that is used inring_init()to check if a ring is initialized or not.drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type, · line 88
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1
-0+DRM_ERROR ("invalid ip type: %d\n" , ip_type);Please adjust the error message to something like "ring %d not initialized on IP %d\".
Regards,
Christian.
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type, · line 94
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +3
-0+return -EINVAL ; + } +return 0 ; }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx