Am 09.07.2018 um 12:14 schrieb Zhang, Jerry (Junwei): > On 07/09/2018 04:55 PM, Christian König wrote: >> Am 09.07.2018 um 09:48 schrieb Zhang, Jerry (Junwei): >>> On 07/09/2018 03:04 PM, Christian König wrote: >>>> Am 09.07.2018 um 07:13 schrieb Zhang, Jerry (Junwei): >>>>> On 07/06/2018 03:27 AM, Andrey Grodzovsky wrote: >>>>>> Extract and present the reposnsible process and thread when >>>>>> VM_FAULT happens. >>>>>> >>>>>> v2: Use getter and setter functions. >>>>>> >>>>>> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky at amd.com> >>>>>> --- >>>>>>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 4 ++++ >>>>>>  drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 10 +++++++--- >>>>>>  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 9 +++++++-- >>>>>>  3 files changed, 18 insertions(+), 5 deletions(-) >>>>>> >>>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c >>>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c >>>>>> index 7a625f3..609c8f5 100644 >>>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c >>>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c >>>>>> @@ -187,6 +187,10 @@ static int amdgpu_cs_parser_init(struct >>>>>> amdgpu_cs_parser *p, void *data) >>>>>>      if (p->uf_entry.robj) >>>>>>          p->job->uf_addr = uf_offset; >>>>>>      kfree(chunk_array); >>>>>> + >>>>>> +   /* Use this opportunity to fill in task info for the vm */ >>>>>> +   amdgpu_vm_set_task_info(vm); >>>>>> + >>>>> >>>>> Shall we set the task info when vm init? >>>> >>>> No, vm_init() is called from a completely different process which >>>> is later on user of the VM. >>> >>> Originally I thought UMD opened DRI node and create a VM by >>> vm_init(), then every command submission >>> would be passed in the same VM initialized by vm_init(). >>> >>> So that's different process? >> >> The display server, e.g. X or Wayland. >> >> See with DRI3 the process of opening a connection to the hardware is >> that the display server open the file descriptor and with that calls >> vm_init. >> >> And then this file descriptor is passed to the client processes >> through IPC. > > Thanks to reply. > yes, it's likely to open amdgpu node in ddx when driver probe and pass > it to other client. > > While that looks like just in the process of initialization that X > server loads ddx driver. No, that happens with each client. > But when I start 2 glxgears, that kms_open()->vm_init() will be called > twice, which looks related to App as well. > (anyway, I will check it more) > > Even so, it sounds vm_init() should be created firstly, then we use > that VM for process on every command submission. > So I thought to set the task info at the first time vm_init() and use > that info on VM fault process func. No, that would certainly be not correct. As I explained vm_init() is not necessarily called by the process which is then going to use the VM. Christian. > > Jerry