Skip to contentSkip to conversation

drm/amdgpu: implement workaround for sdma dcc corruption

PATCH Superseded Pierre-Eric Pelloux-Prayer 3 participants 3 messages Sep 24

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: implement workaround for sdma dcc corruption

For unknown reasons, on gfx12 using multiple entities can causes random corruption of BOs with DCC.
This workaround seems to prevent the issue until the root cause is understood and fixed.

Fixes 3a6f6eeb3db5 ("drm/amdgpu: give ttm entities access to all the sdma scheds")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +5 -0
index 3d620ec2937f..a826e091ea58 100644
@@ -2392,6 +2392,11 @@ void amdgpu_ttm_enable_buffer_funcs(struct amdgpu_device *adev)
 
 	num_clear_entities = MIN(adev->mman.num_buffer_funcs_scheds, TTM_NUM_MOVE_FENCES);
 	num_move_entities = MIN(adev->mman.num_buffer_funcs_scheds, TTM_NUM_MOVE_FENCES);
+        /* TODO: workaround for DCC corruption when moving BOs from multiple queues at
+         * the same time: use a single queue until the root cause is identified and fixed.
+         */
+	if (IP_VERSION_MAJ(amdgpu_ip_version(adev, SDMA0_HWIP, 0)) == 7)
+		num_move_entities = 1;
 
 	adev->mman.clear_entities = kcalloc(num_clear_entities,
 						sizeof(struct amdgpu_ttm_buffer_entity),
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Pierre-Eric Pelloux-Prayer

For unknown reasons, on gfx12 using multiple entities can causes random corruption of BOs with DCC.
This workaround seems to prevent the issue until the root cause is understood and fixed.

Fixes 3a6f6eeb3db5 ("drm/amdgpu: give ttm entities access to all the sdma scheds")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -0
index 3d620ec2937f..a826e091ea58 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c void amdgpu_ttm_enable_buffer_funcs(struct amdgpu_device *adev) · line 2398

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +4 -0
@@ -2392,6 +2392,11 @@ void amdgpu_ttm_enable_buffer_funcs(struct amdgpu_device *adev)
 
        num_clear_entities = MIN(adev->mman.num_buffer_funcs_scheds, TTM_NUM_MOVE_FENCES);
        num_move_entities = MIN(adev->mman.num_buffer_funcs_scheds, TTM_NUM_MOVE_FENCES);
+        /* TODO: workaround for DCC corruption when moving BOs from multiple queues at
+         * the same time: use a single queue until the root cause is identified and fixed.
+         */
+       if (IP_VERSION_MAJ(amdgpu_ip_version(adev, SDMA0_HWIP, 0)) == 7)

Probably just limit this to 7.0.0 and 7.0.1. sdma 7.1 doesn't have DCC. WIth that fixed:

Alex

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
+               num_move_entities = 1;
 
        adev->mman.clear_entities = kcalloc(num_clear_entities,
                                                sizeof(struct amdgpu_ttm_buffer_entity),
--

2.43.0

maintainer
#2 lore raw
In reply to Pierre-Eric Pelloux-Prayer
Quoted 17 lines · Pierre-Eric Pelloux-Prayer

For unknown reasons, on gfx12 using multiple entities can causes random corruption of BOs with DCC.
This workaround seems to prevent the issue until the root cause is understood and fixed.

Fixes 3a6f6eeb3db5 ("drm/amdgpu: give ttm entities access to all the sdma scheds")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -0
index 3d620ec2937f..a826e091ea58 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c void amdgpu_ttm_enable_buffer_funcs(struct amdgpu_device *adev) · line 2398

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +4 -0
@@ -2392,6 +2392,11 @@ void amdgpu_ttm_enable_buffer_funcs(struct amdgpu_device *adev)
 
 	num_clear_entities = MIN(adev->mman.num_buffer_funcs_scheds, TTM_NUM_MOVE_FENCES);
 	num_move_entities = MIN(adev->mman.num_buffer_funcs_scheds, TTM_NUM_MOVE_FENCES);
+        /* TODO: workaround for DCC corruption when moving BOs from multiple queues at
+         * the same time: use a single queue until the root cause is identified and fixed.
+         */
+	if (IP_VERSION_MAJ(amdgpu_ip_version(adev, SDMA0_HWIP, 0)) == 7)

Thinking it through it would be nice if we could check for that DCC HW generation instead of the SDMA version.

But we need a fix ASAP so the patch is Reviewed-by: Christian König <[email protected]>.

Regards,
Christian.

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -0
+		num_move_entities = 1;
 
 	adev->mman.clear_entities = kcalloc(num_clear_entities,
 						sizeof(struct amdgpu_ttm_buffer_entity),