[PATCH] drm/amdgpu: fix vm_cpu_update hit NULL pointer

Liu, Monk Monk.Liu at amd.com
Sun Mar 24 03:42:25 UTC 2019


Hi Christian

Why it is the wrong time ?  the pte/pd bo already reserved, some details maybe?

Thanks
/Monk
-----Original Message-----
From: Christian König <ckoenig.leichtzumerken at gmail.com> 
Sent: Friday, March 22, 2019 11:43 PM
To: Liu, Monk <Monk.Liu at amd.com>; amd-gfx at freedesktop.org
Subject: Re: [PATCH] drm/amdgpu: fix vm_cpu_update hit NULL pointer

Am 22.03.19 um 06:30 schrieb Monk Liu:
> should use amdgpu_bo_map, otherwise you'll hit NULL pointer bug if 
> with amdgpu_bo_kptr

Yeah that is a known problem. NAK to this one cause that would map the BO at the wrong time.

But in general I have a proper fix for this in the pipeline.

Christian.

>
> Signed-off-by: Monk Liu <Monk.Liu at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c
> index 9d53982..1fb6295a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c
> @@ -76,8 +76,10 @@ static int amdgpu_vm_cpu_update(struct amdgpu_vm_update_params *p,
>   {
>   	unsigned int i;
>   	uint64_t value;
> +	void *ptr;
>   
> -	pe += (unsigned long)amdgpu_bo_kptr(bo);
> +	amdgpu_bo_kmap(bo, &ptr);
> +	pe += (unsigned long)ptr;
>   
>   	trace_amdgpu_vm_set_ptes(pe, addr, count, incr, flags);
>   



More information about the amd-gfx mailing list