[PATCH] drm/amdgpu: fix list not initialized

Zhang, Jerry (Junwei) Jerry.Zhang at amd.com
Thu Apr 19 01:48:08 UTC 2018


On 04/18/2018 06:37 PM, Chunming Zhou wrote:
> Otherwise, cpu stuck for 22s with kernel panic.
>
> Change-Id: I5b87cde662a4658c9ab253ba88d009c9628a44ca
> Signed-off-by: Chunming Zhou <david1.zhou at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index f0fbc331aa30..7131ad13c5b5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -1563,10 +1563,9 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
>   		 * the evicted list so that it gets validated again on the
>   		 * next command submission.
>   		 */
> +		list_del_init(&bo_va->base.vm_status);
>   		if (!(bo->preferred_domains & amdgpu_mem_type_to_domain(mem_type)))
>   			list_add_tail(&bo_va->base.vm_status, &vm->evicted);
> -		else
> -			list_del_init(&bo_va->base.vm_status);
>   	} else {
>   		list_del_init(&bo_va->base.vm_status);
>   	}
We may simplify the logic as below.
How do you think?

         list_del_init(&bo_va->base.vm_status);
         unsigned mem_type = bo->tbo.mem.mem_type;
         /* If the BO is not in its preferred location add it back to
          * the evicted list so that it gets validated again on the
          * next command submission.
          */
         if ((bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) &&
                 (!(bo->preferred_domains & amdgpu_mem_type_to_domain(mem_type))))
                         list_add_tail(&bo_va->base.vm_status, &vm->evicted);

Jerry

>


More information about the amd-gfx mailing list