From: "Christian König" <christian.koenig@amd.com>
To: Felix Kuehling <Felix.Kuehling@amd.com>, amd-gfx@lists.freedesktop.org
Cc: philip.yang@amd.com
Subject: Re: [RFC PATCH 1/3] drm/amdgpu: Add vm->notifier_lock
Date: Mon, 2 Jan 2023 17:01:37 +0100 [thread overview]
Message-ID: <f6cc283b-e4d0-4be8-2ac6-d6b35a5f67e2@amd.com> (raw)
In-Reply-To: <20221220232704.3394112-1-Felix.Kuehling@amd.com>
Am 21.12.22 um 00:27 schrieb Felix Kuehling:
> This points to a mutex to serialize with MMU notifiers during page table
> updates. For graphics contexts, the notifier lock is per adev. For compute
> contexts the lock is per process.
I don't think mixing the VM code into this is a good idea. Instead we
should expose the lock function to code outside of the VM subsystem.
Regards,
Christian.
>
> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 3 +++
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 1 +
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 3 +++
> 3 files changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> index b15091d8310d..7aaa844a8284 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> @@ -1325,9 +1325,12 @@ static int init_kfd_vm(struct amdgpu_vm *vm, void **process_info,
>
> *process_info = info;
> *ef = dma_fence_get(&info->eviction_fence->base);
> + } else {
> + info = *process_info;
> }
>
> vm->process_info = *process_info;
> + vm->notifier_lock = &info->notifier_lock;
>
> /* Validate page directory and attach eviction fence */
> ret = amdgpu_bo_reserve(vm->root.bo, true);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index dc379dc22c77..a04f7aef4ca9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -2075,6 +2075,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)
>
> mutex_init(&vm->eviction_lock);
> vm->evicting = false;
> + vm->notifier_lock = &adev->notifier_lock;
>
> r = amdgpu_vm_pt_create(adev, vm, adev->vm_manager.root_level,
> false, &root);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> index 094bb4807303..07af80df812b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> @@ -251,6 +251,9 @@ struct amdgpu_vm {
> bool evicting;
> unsigned int saved_flags;
>
> + /* Pointer to notifier lock used when updating PTEs */
> + struct mutex *notifier_lock;
> +
> /* Lock to protect vm_bo add/del/move on all lists of vm */
> spinlock_t status_lock;
>
prev parent reply other threads:[~2023-01-02 16:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-20 23:27 [RFC PATCH 1/3] drm/amdgpu: Add vm->notifier_lock Felix Kuehling
2022-12-20 23:27 ` [RFC PATCH 2/3] drm/amdgpu: Add range param to amdgpu_vm_update_range Felix Kuehling
2023-01-03 8:27 ` Christian König
2022-12-20 23:27 ` [RFC PATCH 3/3] drm/amdkfd: Use per-process notifier_lock for SVM Felix Kuehling
2023-01-02 16:01 ` 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=f6cc283b-e4d0-4be8-2ac6-d6b35a5f67e2@amd.com \
--to=christian.koenig@amd.com \
--cc=Felix.Kuehling@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=philip.yang@amd.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox