All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: fix vm_cpu_update hit NULL pointer
@ 2019-03-22  5:30 Monk Liu
       [not found] ` <1553232632-27710-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Monk Liu @ 2019-03-22  5:30 UTC (permalink / raw)
  To: amd-gfx-CC+yJ3UmIYqDUpFQwHEjaQ; +Cc: Monk Liu

should use amdgpu_bo_map, otherwise you'll hit NULL
pointer bug if with amdgpu_bo_kptr

Signed-off-by: Monk Liu <Monk.Liu@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);
 
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/amdgpu: fix vm_cpu_update hit NULL pointer
       [not found] ` <1553232632-27710-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
@ 2019-03-22 15:42   ` Christian König
       [not found]     ` <583e1755-3c2a-8677-dda0-2f10ed8fc09a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Christian König @ 2019-03-22 15:42 UTC (permalink / raw)
  To: Monk Liu, amd-gfx-CC+yJ3UmIYqDUpFQwHEjaQ

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@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);
>   

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] drm/amdgpu: fix vm_cpu_update hit NULL pointer
       [not found]     ` <583e1755-3c2a-8677-dda0-2f10ed8fc09a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2019-03-24  3:42       ` Liu, Monk
       [not found]         ` <BYAPR12MB33014544E9805DC79F9E3EA1845D0-ZGDeBxoHBPmRc1D8ZEEGsgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Liu, Monk @ 2019-03-24  3:42 UTC (permalink / raw)
  To: Koenig, Christian, amd-gfx-CC+yJ3UmIYqDUpFQwHEjaQ

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@gmail.com> 
Sent: Friday, March 22, 2019 11:43 PM
To: Liu, Monk <Monk.Liu@amd.com>; amd-gfx@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@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);
>   

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/amdgpu: fix vm_cpu_update hit NULL pointer
       [not found]         ` <BYAPR12MB33014544E9805DC79F9E3EA1845D0-ZGDeBxoHBPmRc1D8ZEEGsgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
@ 2019-03-25 12:14           ` Christian König
  0 siblings, 0 replies; 4+ messages in thread
From: Christian König @ 2019-03-25 12:14 UTC (permalink / raw)
  To: Liu, Monk, Koenig, Christian, amd-gfx-CC+yJ3UmIYqDUpFQwHEjaQ

Hi Monk,

well it would certainly work, but for the error handling it's just not 
the best idea to do the mapping so late.

E.g. we should do the kmap for CPU based updates as well as the GTT map 
for SDMA based updates much more earlier to avoid rolling back all work 
again when we are interrupted by a signal for example.

Give me a moment to write a patch for this, it's basically the same 
thing as your patch just called from an earlier point.

Regards,
Christian.

Am 24.03.19 um 04:42 schrieb Liu, Monk:
> 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@gmail.com>
> Sent: Friday, March 22, 2019 11:43 PM
> To: Liu, Monk <Monk.Liu@amd.com>; amd-gfx@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@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);
>>    
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-25 12:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-22  5:30 [PATCH] drm/amdgpu: fix vm_cpu_update hit NULL pointer Monk Liu
     [not found] ` <1553232632-27710-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2019-03-22 15:42   ` Christian König
     [not found]     ` <583e1755-3c2a-8677-dda0-2f10ed8fc09a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-03-24  3:42       ` Liu, Monk
     [not found]         ` <BYAPR12MB33014544E9805DC79F9E3EA1845D0-ZGDeBxoHBPmRc1D8ZEEGsgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-03-25 12:14           ` Christian König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.