On 9/25/2025 5:45 AM, Kuehling, Felix wrote:
> On 2025-09-23 03:26, Zhu Lingshan wrote:
>> This commit records the id of the owner
>> kfd_process into a kfd process_info when
>> create it.
>>
>> Signed-off-by: Zhu Lingshan <[email protected]>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 2 ++
>> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 4 ++++
>> 2 files changed, 6 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
>> index aa88bad7416b..d867984a68da 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
>> @@ -146,6 +146,8 @@ struct amdkfd_process_info {
>> /* MMU-notifier related fields */
>> struct mutex notifier_lock;
>> uint32_t evicted_bos;
>> + /* kfd process id */
>> + u16 process_id;
>
> The name "process_id" is a bit misleading. I would prefer something
> like "context_id" or "secondary_id" to make it cleare that this
> identifies secondary contexts and has nothing to do with the PID.
> Maybe use the same name in struct kfd_process as well for clarity.
I will change it to context_id, Thanks!
>
> Regards,
> Felix
>
>
>> struct delayed_work restore_userptr_work;
>> struct pid *pid;
>> bool block_mmu_notifications;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
>> index b16cce7c22c3..723d34921c12 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
>> @@ -1382,8 +1382,10 @@ static int init_kfd_vm(struct amdgpu_vm *vm,
>> void **process_info,
>> struct dma_fence **ef)
>> {
>> struct amdkfd_process_info *info = NULL;
>> + struct kfd_process *process = NULL;
>> int ret;
>> + process = container_of(process_info, struct kfd_process,
>> kgd_process_info);
>> if (!*process_info) {
>> info = kzalloc(sizeof(*info), GFP_KERNEL);
>> if (!info)
>> @@ -1410,6 +1412,8 @@ static int init_kfd_vm(struct amdgpu_vm *vm,
>> void **process_info,
>> INIT_DELAYED_WORK(&info->restore_userptr_work,
>> amdgpu_amdkfd_restore_userptr_worker);
>> + info->process_id = process->id;
>> +
>> *process_info = info;
>> }
>>