diff mbox series

[v2] drm/amdgpu_vm: fix boolean expressions

Message ID 20190103200146.GA26442@embeddedor (mailing list archive)
State New, archived
Headers show
Series [v2] drm/amdgpu_vm: fix boolean expressions | expand

Commit Message

Gustavo A. R. Silva Jan. 3, 2019, 8:01 p.m. UTC
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")
Cc: stable@vger.kernel.org
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
Changes in v2:
 - Update Fixes tag.

 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Sasha Levin Jan. 4, 2019, 2:50 p.m. UTC | #1
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
Ezequiel Garcia Jan. 4, 2019, 4:40 p.m. UTC | #2
Hey Gustavo,

On Thu, 3 Jan 2019 at 17:25, Gustavo A. R. Silva <gustavo@embeddedor.com> wrote:
>
> 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")
> Cc: stable@vger.kernel.org
> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
> 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

>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index e73d152659a2..4cc0d1079935 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -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
>
Alex Deucher Jan. 4, 2019, 4:52 p.m. UTC | #3
On Thu, Jan 3, 2019 at 3:21 PM Gustavo A. R. Silva
<gustavo@embeddedor.com> wrote:
>
> 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")
> Cc: stable@vger.kernel.org
> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Applied.  thanks!

Alex

> ---
> Changes in v2:
>  - Update Fixes tag.
>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index e73d152659a2..4cc0d1079935 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -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
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Gustavo A. R. Silva Jan. 4, 2019, 4:58 p.m. UTC | #4
Hi Ezequiel,

On 1/4/19 10:40 AM, Ezequiel Garcia wrote:
> Hey Gustavo,
> 
> On Thu, 3 Jan 2019 at 17:25, Gustavo A. R. Silva <gustavo@embeddedor.com> wrote:
>>
>> 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")
>> Cc: stable@vger.kernel.org
>> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>> ---
>> 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?
> 

Yeah. In this case the tag can be removed.

Happy new year.

Thanks
--
Gustavo
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index e73d152659a2..4cc0d1079935 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -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) {