All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: "Liu, Monk" <Monk.Liu-5C7GfCeVMHo@public.gmane.org>,
	"Koenig,
	Christian" <Christian.Koenig-5C7GfCeVMHo@public.gmane.org>,
	"amd-gfx-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org"
	<amd-gfx-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org>
Subject: Re: [PATCH] drm/amdgpu: fix vm_cpu_update hit NULL pointer
Date: Mon, 25 Mar 2019 13:14:41 +0100	[thread overview]
Message-ID: <04287ee2-dc1c-6d60-f785-a26a55712648@gmail.com> (raw)
In-Reply-To: <BYAPR12MB33014544E9805DC79F9E3EA1845D0-ZGDeBxoHBPmRc1D8ZEEGsgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>

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

      parent reply	other threads:[~2019-03-25 12:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=04287ee2-dc1c-6d60-f785-a26a55712648@gmail.com \
    --to=ckoenig.leichtzumerken-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=Christian.Koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=Monk.Liu-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.