From: "Christian König" <christian.koenig@amd.com>
To: "Mu, Zihao" <Zihao.Mu@amd.com>,
"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Cc: "Deucher, Alexander" <Alexander.Deucher@amd.com>,
Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
Subject: Re: [RFC PATCH v2 6/6] drm/amdgpu: wait for page-table moves in CPU prepare
Date: Wed, 11 Nov 2026 14:14:56 +0100 [thread overview]
Message-ID: <bf90d631-c63e-4df0-92ad-213bd65ef0ba@amd.com> (raw)
In-Reply-To: <MW3PR12MB4572BEFF9134ABF824D374C79E712@MW3PR12MB4572.namprd12.prod.outlook.com>
On 11/11/26 12:56, Mu, Zihao wrote:
> From: Zihao Mu <zmu@amd.com>
>
> The CPU backend repeats reservation traversal for every PTE batch. An
> interrupted wait can also skip a batch whose result the walker ignores.
That irrelevant.
> Wait for the shared root reservation's KERNEL dependencies in prepare,
> including calls without an explicit sync. Allocation now commits and
> restarts the phase, so dependencies added while the eviction lock was
> dropped are covered before the resumed phase writes entries.
>
> Preserve the existing interruptible wait policy.
Clear NAK to that. As said before unmap operations triggered by MMU notifiers *must* complete and can't be interrupted.
We could add an interruptible flag to the update paramaters but that is most likely overkill.
> An interruption now
> fails prepare before that phase writes any entries, while prior phases
> have been committed and receive normal partial-range finalization.
> Keep explicit sync handling and the CPU write/flags/commit tail intact.
>
> The update callback now only writes entries and returns zero through
> the existing interface. This does not claim that all VM preparation or
> SDMA allocation operations have become non-failing.
>
> Signed-off-by: Zihao Mu <zmu@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c | 21 ++++++++++++---------
> 1 file changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c
> index d03b9bbe20c..89e76e18d9e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c
> @@ -52,10 +52,19 @@ static int amdgpu_vm_cpu_prepare(struct amdgpu_vm_update_params *p,
> struct amdgpu_sync *sync,
> u64 k_job_id)
> {
> - if (!sync)
> - return 0;
> + struct dma_resv *resv = p->vm->root.bo->tbo.base.resv;
> + long r;
> +
> + if (sync) {
> + r = amdgpu_sync_wait(sync, true);
> + if (r)
> + return r;
> + }
>
> - return amdgpu_sync_wait(sync, true);
> + /* Allocation restarts prepare before any further page-table writes. */
> + r = dma_resv_wait_timeout(resv, DMA_RESV_USAGE_KERNEL,
> + true, MAX_SCHEDULE_TIMEOUT);
> + return r < 0 ? r : 0;
That check is unnecessary, MAX_SCHEDULE_TIMEOUT blocks forever.
Regards,
Christian.
> }
>
> /**
> @@ -78,12 +87,6 @@ static int amdgpu_vm_cpu_update(struct amdgpu_vm_update_params *p,
> {
> unsigned int i;
> uint64_t value;
> - long r;
> -
> - r = dma_resv_wait_timeout(vmbo->bo.tbo.base.resv, DMA_RESV_USAGE_KERNEL,
> - true, MAX_SCHEDULE_TIMEOUT);
> - if (r < 0)
> - return r;
>
> pe += (unsigned long)amdgpu_bo_kptr(&vmbo->bo);
>
next prev parent reply other threads:[~2026-11-11 13:15 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 10:29 [RFC] drm/amdgpu: handling PTE backend update errors Mu, Zihao
2026-11-10 12:26 ` Christian König
2026-11-11 5:39 ` [RFC PATCH] drm/amdgpu: make CPU page-table update waits uninterruptible Mu, Zihao
2026-11-11 9:06 ` Christian König
2026-11-11 11:55 ` [RFC PATCH v2 0/6] drm/amdgpu: prepare updates across page-table allocation Mu, Zihao
2026-11-11 11:55 ` [RFC PATCH v2 1/6] drm/amdgpu: handle missing or empty SDMA VM update jobs Mu, Zihao
2026-11-11 11:55 ` [RFC PATCH v2 2/6] drm/amdgpu: track internal completion of SDMA VM updates Mu, Zihao
2026-11-11 11:55 ` [RFC PATCH v2 3/6] drm/amdgpu: finalize partial VM range updates on error Mu, Zihao
2026-11-11 12:44 ` Thadeu Lima de Souza Cascardo
2026-11-11 11:55 ` [RFC PATCH v2 4/6] drm/amdgpu: unwind failed page-table initialization Mu, Zihao
2026-11-11 13:10 ` Christian König
2026-11-11 11:55 ` [RFC PATCH v2 5/6] drm/amdgpu: restart VM updates around page-table allocation Mu, Zihao
2026-11-11 12:56 ` Thadeu Lima de Souza Cascardo
2026-11-11 11:56 ` [RFC PATCH v2 6/6] drm/amdgpu: wait for page-table moves in CPU prepare Mu, Zihao
2026-11-11 13:14 ` Christian König [this message]
2026-11-17 11:39 ` [RFC PATCH v3 0/5] drm/amdgpu: prepare updates across page-table allocation Mu, Zihao
2026-11-17 11:39 ` [RFC PATCH v3 1/5] drm/amdgpu: pass job id as part of amdgpu_vm_update_params Mu, Zihao
2026-11-17 14:56 ` Christian König
2026-11-17 11:39 ` [RFC PATCH v3 2/5] drm/amdgpu: track internal completion of SDMA VM updates Mu, Zihao
2026-11-18 8:21 ` Christian König
2026-11-17 11:39 ` [RFC PATCH v3 3/5] drm/amdgpu: finalize partial VM range updates on error Mu, Zihao
2026-11-18 8:34 ` Christian König
2026-11-17 11:40 ` [RFC PATCH v3 4/5] drm/amdgpu: restart VM updates around page-table allocation Mu, Zihao
2026-11-18 8:39 ` Christian König
2026-11-17 11:40 ` [RFC PATCH v3 5/5] drm/amdgpu: wait uninterruptibly for page-table moves in CPU prepare Mu, Zihao
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=bf90d631-c63e-4df0-92ad-213bd65ef0ba@amd.com \
--to=christian.koenig@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Zihao.Mu@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=cascardo@igalia.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 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.