Skip to contentSkip to conversation

drm/amdgpu: Fix a false positive when pin non-VRAM memory

PATCH In review xinhui pan 4 participants 4 messages Jan 30, 2021 – Feb 2, 2021

Subsystems (2)
lore
Share & tools
lore

xinhui pan

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Fix a false positive when pin non-VRAM memory

Flag TTM_PL_FLAG_CONTIGUOUS is only valid for VRAM domain. So fix the false positive by checking memory type too.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -1
index 137f275f90ee..56854a3ee19c 100644
@@ -919,7 +919,8 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
 		if (!(domain & amdgpu_mem_type_to_domain(mem_type)))
 			return -EINVAL;
 
-		if ((bo->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS) &&
+		if ((mem_type == TTM_PL_VRAM) &&
+		    (bo->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS) &&
 		    !(mem_flags & TTM_PL_FLAG_CONTIGUOUS))
 			return -EINVAL;
 
Signature · 6 lines
2.25.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by on v1 1/1
#1 lore raw

Am 30.01.21 um 02:00 schrieb xinhui pan:

Quoted 6 lines

Flag TTM_PL_FLAG_CONTIGUOUS is only valid for VRAM domain. So fix the false positive by checking memory type too.

Quoted 9 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -0
index 137f275f90ee..56854a3ee19c 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain, · line 926

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -1
@@ -919,7 +919,8 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
  		if (!(domain & amdgpu_mem_type_to_domain(mem_type)))
  			return -EINVAL;
 
-		if ((bo->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS) &&
+		if ((mem_type == TTM_PL_VRAM) &&
+		    (bo->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS) &&
  		    !(mem_flags & TTM_PL_FLAG_CONTIGUOUS))
  			return -EINVAL;
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#2 lore raw
In reply to xinhui pan
Quoted 7 lines · xinhui pan

Flag TTM_PL_FLAG_CONTIGUOUS is only valid for VRAM domain. So fix the false positive by checking memory type too.

@Kuehling, Felix I presume this fixes the regression you noted last week?

Alex

Quoted 21 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -2
index 137f275f90ee..56854a3ee19c 100644
@@ -919,7 +919,8 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
                if (!(domain & amdgpu_mem_type_to_domain(mem_type)))
                        return -EINVAL;
 
-               if ((bo->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS) &&
+               if ((mem_type == TTM_PL_VRAM) &&
+                   (bo->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS) &&
                    !(mem_flags & TTM_PL_FLAG_CONTIGUOUS))
                        return -EINVAL;
 
--

2.25.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw

Am 2021-02-02 um 11:17 a.m. schrieb Alex Deucher:

Quoted 8 lines · xinhui pan
Quoted 6 lines

Flag TTM_PL_FLAG_CONTIGUOUS is only valid for VRAM domain. So fix the false positive by checking memory type too.

@Kuehling, Felix I presume this fixes the regression you noted last week?

Yes. This is the fix I mentioned.

Thanks,
  Felix

Quoted 22 lines

Alex

Quoted 18 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -1
index 137f275f90ee..56854a3ee19c 100644
@@ -919,7 +919,8 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
                if (!(domain & amdgpu_mem_type_to_domain(mem_type)))
                        return -EINVAL;
 
-               if ((bo->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS) &&
+               if ((mem_type == TTM_PL_VRAM) &&
+                   (bo->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS) &&
                    !(mem_flags & TTM_PL_FLAG_CONTIGUOUS))
                        return -EINVAL;
 
Quoted 7 lines
Quoted 7 lines

--
2.25.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx