Re: [PATCH] drm/amdgpu: Add show_fdinfo() interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 2021-04-06 um 7:13 a.m. schrieb Christian König:
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
>>> @@ -1042,13 +1042,15 @@ int
>>> amdgpu_amdkfd_gpuvm_create_process_vm(struct kgd_dev *kgd, u32 pasid,
>>>                         struct dma_fence **ef)
>>>   {
>>>       struct amdgpu_device *adev = get_amdgpu_device(kgd);
>>> +    struct amdgpu_fpriv *fpriv;
>>>       struct amdgpu_vm *new_vm;
>>>       int ret;
>>>   -    new_vm = kzalloc(sizeof(*new_vm), GFP_KERNEL);
>>> -    if (!new_vm)
>>> +    fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL);
>>> +    if (!fpriv)
>>>           return -ENOMEM;
>>>   +    new_vm = &fpriv->vm;
>>>       /* Initialize AMDGPU part of the VM */
>>>       ret = amdgpu_vm_init(adev, new_vm, AMDGPU_VM_CONTEXT_COMPUTE,
>>> pasid);
>>>       if (ret) {
>>> @@ -1063,12 +1065,14 @@ int
>>> amdgpu_amdkfd_gpuvm_create_process_vm(struct kgd_dev *kgd, u32 pasid,
>>>         *vm = (void *) new_vm;
>>>   +    amdgpu_fdinfo_init(adev, fpriv, pasid);
>>> +
>>>       return 0;
>>>     init_kfd_vm_fail:
>>>       amdgpu_vm_fini(adev, new_vm);
>>>   amdgpu_vm_init_fail:
>>> -    kfree(new_vm);
>>> +    kfree(fpriv);
>>>       return ret;
>>>   }
>>>   @@ -1142,6 +1146,8 @@ void
>>> amdgpu_amdkfd_gpuvm_destroy_process_vm(struct kgd_dev *kgd, void *vm)
>>>   {
>>>       struct amdgpu_device *adev = get_amdgpu_device(kgd);
>>>       struct amdgpu_vm *avm = (struct amdgpu_vm *)vm;
>>> +    struct amdgpu_fpriv *fpriv =
>>> +        container_of(avm, struct amdgpu_fpriv, vm);
>>>         if (WARN_ON(!kgd || !vm))
>>>           return;
>>> @@ -1149,8 +1155,9 @@ void
>>> amdgpu_amdkfd_gpuvm_destroy_process_vm(struct kgd_dev *kgd, void *vm)
>>>       pr_debug("Destroying process vm %p\n", vm);
>>>         /* Release the VM context */
>>> +    amdgpu_fdinfo_fini(adev, fpriv);
>>>       amdgpu_vm_fini(adev, avm);
>>> -    kfree(vm);
>>> +    kfree(fpriv);
>
> Felix needs to take a look here, but that is most likely a no-go. On
> the other hand if you drop the amdgpu_proc structure that should
> become unnecessary.

This is legacy code to support really old versions of ROCm user mode
that didn't call kfd_ioctl_acquire_vm to grab the VM from a DRM device
file descriptor. This predates upstreaming of dGPU support in KFD. We
can probably get rid of amdgpu_amdkfd_gpuvm_(create/destroy)_process_vm
and the associated code paths in KFD now.

On any ROCm less than 3 years old we should be going through
amdgpu_amdkfd_gpuvm_(acquire/release)_process_vm.

Regards,
  Felix


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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux