Skip to contentSkip to conversation

drm/amdgpu_vm: fix boolean expressions

PATCH Applied Gustavo A. R. Silva 4 participants 5 messages Jan 3, 2019 – Jan 4, 2019

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

PATCH v2 1/1 drm/amdgpu_vm: fix boolean expressions

Fix boolean expressions by using logical AND operator '&&' instead of bitwise operator '&'.

This issue was detected with the help of Coccinelle.

Fixes 9a4b7d4c769e ("drm/amdgpu: Add vm context module param")

---
Changes in v2:
- Update Fixes tag.

 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -2
index e73d152659a2..4cc0d1079935 100644
@@ -3006,7 +3006,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 	}
 	DRM_DEBUG_DRIVER("VM update mode is %s\n",
 			 vm->use_cpu_for_update ? "CPU" : "SDMA");
-	WARN_ONCE((vm->use_cpu_for_update & !amdgpu_gmc_vram_full_visible(&adev->gmc)),
+	WARN_ONCE((vm->use_cpu_for_update && !amdgpu_gmc_vram_full_visible(&adev->gmc)),
 		  "CPU update of VM recommended only for large BAR system\n");
 	vm->last_update = NULL;
 
@@ -3136,7 +3136,7 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, uns
 	vm->pte_support_ats = pte_support_ats;
 	DRM_DEBUG_DRIVER("VM update mode is %s\n",
 			 vm->use_cpu_for_update ? "CPU" : "SDMA");
-	WARN_ONCE((vm->use_cpu_for_update & !amdgpu_gmc_vram_full_visible(&adev->gmc)),
+	WARN_ONCE((vm->use_cpu_for_update && !amdgpu_gmc_vram_full_visible(&adev->gmc)),
 		  "CPU update of VM recommended only for large BAR system\n");
 
 	if (vm->pasid) {
Signature · 6 lines
2.20.1

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

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag, fixing commit: 9a4b7d4c769e drm/amdgpu: Add vm context module param.

The bot has tested the following trees: v4.20.0, v4.19.13, v4.14.91,

v4.20.0: Build OK!
v4.19.13: Build OK!
v4.14.91: Failed to apply! Possible dependencies:
1b0c0f9dc5ca ("drm/amdgpu: move userptr BOs to CPU domain during CS v2") 1ed3d2567c80 ("drm/amdgpu: keep the MMU lock until the update ends v4") 3fe89771cb0a ("drm/amdgpu: stop reserving the BO in the MMU callback v3") 4562236b3bc0 ("drm/amd/dc: Add dc display driver (v2)")
60de1c1740f3 ("drm/amdgpu: use a rw_semaphore for MMU notifiers") 770d13b19fdf ("drm/amdgpu: move struct amdgpu_mc into amdgpu_gmc.h") 9a18999640fa ("drm/amdgpu: move MMU notifier related defines to amdgpu_mn.h") 9cca0b8e5df0 ("drm/amdgpu: move amdgpu_cs_sysvm_access_required into find_mapping") a216ab09955d ("drm/amdgpu: fix userptr put_page handling") b72cf4fca2bb ("drm/amdgpu: move taking mmap_sem into get_user_pages v2") c8c5e569c5b0 ("drm/amdgpu: Consolidate visible vs. real vram check v2.") ca666a3c298f ("drm/amdgpu: stop using BO status for user pages")

How should we proceed with this patch?

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

#2 lore raw
In reply to Gustavo A. R. Silva

Hey Gustavo,

Quoted 6 lines · Gustavo A. R. Silva

Fix boolean expressions by using logical AND operator '&&' instead of bitwise operator '&'.

This issue was detected with the help of Coccinelle.

Quoted 8 lines
Fixes 9a4b7d4c769e ("drm/amdgpu: Add vm context module param")

---
Changes in v2:
- Update Fixes tag.

This just fixes a user warning that would be wrongly reported, but doesn't fix any other issue.

Why stable?

Thanks,
Eze

Quoted 28 lines
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -3
index e73d152659a2..4cc0d1079935 100644
@@ -3006,7 +3006,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
        }
        DRM_DEBUG_DRIVER("VM update mode is %s\n",
                         vm->use_cpu_for_update ? "CPU" : "SDMA");
-       WARN_ONCE((vm->use_cpu_for_update & !amdgpu_gmc_vram_full_visible(&adev->gmc)),
+       WARN_ONCE((vm->use_cpu_for_update && !amdgpu_gmc_vram_full_visible(&adev->gmc)),
                  "CPU update of VM recommended only for large BAR system\n");
        vm->last_update = NULL;
 
@@ -3136,7 +3136,7 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, uns
        vm->pte_support_ats = pte_support_ats;
        DRM_DEBUG_DRIVER("VM update mode is %s\n",
                         vm->use_cpu_for_update ? "CPU" : "SDMA");
-       WARN_ONCE((vm->use_cpu_for_update & !amdgpu_gmc_vram_full_visible(&adev->gmc)),
+       WARN_ONCE((vm->use_cpu_for_update && !amdgpu_gmc_vram_full_visible(&adev->gmc)),
                  "CPU update of VM recommended only for large BAR system\n");
 
        if (vm->pasid) {
--

2.20.1

Signature · 6 lines
Ezequiel García, VanguardiaSur
www.vanguardiasur.com.ar
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#3 lore raw

Hi Ezequiel,

Quoted 18 lines · Ezequiel Garcia

Hey Gustavo,

Quoted 6 lines · Gustavo A. R. Silva

Fix boolean expressions by using logical AND operator '&&' instead of bitwise operator '&'.

This issue was detected with the help of Coccinelle.

Quoted 8 lines
Fixes 9a4b7d4c769e ("drm/amdgpu: Add vm context module param")

---
Changes in v2:
- Update Fixes tag.

Quoted 5 lines

This just fixes a user warning that would be wrongly reported, but doesn't fix any other issue.

Why stable?

Yeah. In this case the tag can be removed.

Happy new year.

Thanks
--
Gustavo

Applied
#4 lore raw
In reply to Gustavo A. R. Silva
Quoted 10 lines · Gustavo A. R. Silva

Fix boolean expressions by using logical AND operator '&&' instead of bitwise operator '&'.

This issue was detected with the help of Coccinelle.

Fixes 9a4b7d4c769e ("drm/amdgpu: Add vm context module param")

Applied. thanks!

Alex

Quoted 32 lines

---
Changes in v2:
- Update Fixes tag.

 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -3
index e73d152659a2..4cc0d1079935 100644
@@ -3006,7 +3006,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
        }
        DRM_DEBUG_DRIVER("VM update mode is %s\n",
                         vm->use_cpu_for_update ? "CPU" : "SDMA");
-       WARN_ONCE((vm->use_cpu_for_update & !amdgpu_gmc_vram_full_visible(&adev->gmc)),
+       WARN_ONCE((vm->use_cpu_for_update && !amdgpu_gmc_vram_full_visible(&adev->gmc)),
                  "CPU update of VM recommended only for large BAR system\n");
        vm->last_update = NULL;
 
@@ -3136,7 +3136,7 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, uns
        vm->pte_support_ats = pte_support_ats;
        DRM_DEBUG_DRIVER("VM update mode is %s\n",
                         vm->use_cpu_for_update ? "CPU" : "SDMA");
-       WARN_ONCE((vm->use_cpu_for_update & !amdgpu_gmc_vram_full_visible(&adev->gmc)),
+       WARN_ONCE((vm->use_cpu_for_update && !amdgpu_gmc_vram_full_visible(&adev->gmc)),
                  "CPU update of VM recommended only for large BAR system\n");
 
        if (vm->pasid) {
--

2.20.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