Skip to contentSkip to conversation

drm/amdgpu: Fix comparison in amdgpu_res_cpu_visible

PATCH In review Michel Dänzer 3 participants 3 messages May 8, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Fix comparison in amdgpu_res_cpu_visible

From: Michel Dänzer <[email protected]>

It incorrectly claimed a resource isn't CPU visible if it's located at the very end of CPU visible VRAM.

Fixes a6ff969fe9 ("drm/amdgpu: fix visible VRAM handling during faults")
Reported-and-Tested-by Jeremy Day <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
index 109fe557a02b..29c197c00018 100644
@@ -427,7 +427,7 @@ bool amdgpu_res_cpu_visible(struct amdgpu_device *adev,
 
 	amdgpu_res_first(res, 0, res->size, &cursor);
 	while (cursor.remaining) {
-		if ((cursor.start + cursor.size) >= adev->gmc.visible_vram_size)
+		if ((cursor.start + cursor.size) > adev->gmc.visible_vram_size)
 			return false;
 		amdgpu_res_next(&cursor, cursor.size);
 	}
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Michel Dänzer

From: Michel Dänzer <[email protected]>

It incorrectly claimed a resource isn't CPU visible if it's located at the very end of CPU visible VRAM.

Fixes a6ff969fe9 ("drm/amdgpu: fix visible VRAM handling during faults")
Reported-and-Tested-by Jeremy Day <[email protected]>

and applied. Thanks!

Alex

Quoted 20 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -2
index 109fe557a02b..29c197c00018 100644
@@ -427,7 +427,7 @@ bool amdgpu_res_cpu_visible(struct amdgpu_device *adev,
 
        amdgpu_res_first(res, 0, res->size, &cursor);
        while (cursor.remaining) {
-               if ((cursor.start + cursor.size) >= adev->gmc.visible_vram_size)
+               if ((cursor.start + cursor.size) > adev->gmc.visible_vram_size)
                        return false;
                amdgpu_res_next(&cursor, cursor.size);
        }
--

2.43.0

maintainer Reviewed-by
#2 lore raw

Am 08.05.24 um 15:45 schrieb Alex Deucher:

Quoted 10 lines · Michel Dänzer
Quoted 8 lines

From: Michel Dänzer <[email protected]>

It incorrectly claimed a resource isn't CPU visible if it's located at the very end of CPU visible VRAM.

Fixes a6ff969fe9 ("drm/amdgpu: fix visible VRAM handling during faults")
Reported-and-Tested-by Jeremy Day <[email protected]>

Christian.

Quoted 24 lines

and applied. Thanks!

Alex

Quoted 20 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -2
index 109fe557a02b..29c197c00018 100644
@@ -427,7 +427,7 @@ bool amdgpu_res_cpu_visible(struct amdgpu_device *adev,
 
         amdgpu_res_first(res, 0, res->size, &cursor);
         while (cursor.remaining) {
-               if ((cursor.start + cursor.size) >= adev->gmc.visible_vram_size)
+               if ((cursor.start + cursor.size) > adev->gmc.visible_vram_size)
                         return false;
                 amdgpu_res_next(&cursor, cursor.size);
         }
--

2.43.0