drm/amdgpu: Wipe all VRAM on free when RAS is enabled
Subsystems (2)
PATCH 1/1 drm/amdgpu: Wipe all VRAM on free when RAS is enabled
On GPUs with RAS, poison can propagate between processes if VRAM is not cleared when it is freed or allocated. The reason is, that not all write accesses clear RAS poison. 32-byte writes by the SDMA engine do clear RAS poison. Clearing memory in the background when it is freed should avoid major performance impact. KFD has been doing this already for a long time.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +3 -0
@@ -575,6 +575,9 @@ int amdgpu_bo_create(struct amdgpu_device *adev,if (!amdgpu_bo_support_uswc (bo->flags)) bo->flags &= ~AMDGPU_GEM_CREATE_CPU_GTT_USWC ; +if (adev->ras_enabled) + bo->flags |=AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE ; + bo->tbo.bdev = &adev->mman.bdev;if (bp->domain & (AMDGPU_GEM_DOMAIN_GWS |AMDGPU_GEM_DOMAIN_OA |AMDGPU_GEM_DOMAIN_GDS ))
Signature · 1 line
2.32.0
Christian König
maintainerAm 25.01.22 um 16:58 schrieb Felix Kuehling:
Quoted 7 lines
On GPUs with RAS, poison can propagate between processes if VRAM is not cleared when it is freed or allocated. The reason is, that not all write accesses clear RAS poison. 32-byte writes by the SDMA engine do clear RAS poison. Clearing memory in the background when it is freed should avoid major performance impact. KFD has been doing this already for a long time.
Signed-off-by Felix Kuehling <[email protected]>
That looks even better than what I had in mind. Reviewed-by: Christian König <[email protected]>.
Quoted 18 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +3
-0@@ -575,6 +575,9 @@ int amdgpu_bo_create(struct amdgpu_device *adev,if (!amdgpu_bo_support_uswc (bo->flags)) bo->flags &= ~AMDGPU_GEM_CREATE_CPU_GTT_USWC ; +if (adev->ras_enabled) + bo->flags |=AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE ; + bo->tbo.bdev = &adev->mman.bdev;if (bp->domain & (AMDGPU_GEM_DOMAIN_GWS |AMDGPU_GEM_DOMAIN_OA |AMDGPU_GEM_DOMAIN_GDS ))