On 11/11/26 06:39, Mu, Zihao wrote:
> From: zihaomu <[email protected]>
>
> The CPU update callback waits for KERNEL fences before writing a batch
> of page-table entries. A pending signal can interrupt that wait and
> return -ERESTARTSYS without writing the entries. The PTE walker ignores
> the callback's result and advances past that batch.
>
> Page-table updates must complete instead of abandoning writes because
> of a signal. Make the dependency wait uninterruptible and remove the
> interruption error path from the CPU update callback. The dependencies
> are still waited on before any entry is written.
>
> Keep the shared update callback type, the preparation phase, and the
> SDMA backend unchanged. The CPU callback still returns zero through the
> existing interface.
>
> Link: https://lore.kernel.org/r/[email protected]
> Signed-off-by: zihaomu <[email protected]>
The Signed-off-by line should be your full legal name, e.g. similar to a
signature. At least of hand zihaomu doesn't looks correct.
> ---
> Hi Christian,
>
>> Yeah we need to remove those error codes. PTE updates generally can't fail.
>
> Thanks for clarifying. I have replaced the propagation proposal with
> this focused first step for the CPU update callback. It waits for the
> KERNEL dependencies without allowing a signal to abandon the PTE writes.
>
> This is based on drm-amdgpu-next at a6836fcbb5b2. The previous walker
> error-propagation diff and its cleanup prerequisites are not included.
>
> This is not a complete conversion of all VM operations to a no-fail
> interface. The CPU preparation wait remains interruptible before the
> update phase. The shared callback type and SDMA backend are unchanged;
> SDMA dependency registration and replacement-job allocations can still
> fail. I have not hidden those failures behind a void callback or added
> an unbounded allocation retry loop.
>
> For the remaining SDMA work, is there a reserved-resource or map/unmap
> split series I should build on? Job, scheduler-fence and IB allocations
> need a forward-progress design before the remaining errors can be
> removed safely.
>
> Validation of this patch:
> - 28 modeled dependency scenarios and 384 parameter combinations, using
> the native CPU update and reservation traversal function bodies with
> simulated fence/storage primitives. Both the original omitted-write
> behavior and a deliberately broken swallow-the-error control were
> detected. ASan/UBSan reported no errors.
> - amdgpu_vm_cpu.o compiled with GCC 13.3.0 and CONFIG_DRM_AMDGPU=m in a
> fresh private build directory. Strict checkpatch: 0 errors/warnings/checks.
>
> The PTE write/flags/commit code is unchanged. This has not been linked
> into a full module or loaded on hardware, and it does not establish a
> fix for the original multi-second queue stalls. The independent CPU
> fence-scan performance proposal is not included here.
>
> Regards,
> Zihao
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 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..dc1cebbc0d9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c
> @@ -78,12 +78,10 @@ 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;
> + /* Page-table updates must not skip writes because of a signal. */
> + dma_resv_wait_timeout(vmbo->bo.tbo.base.resv, DMA_RESV_USAGE_KERNEL,
> + false, MAX_SCHEDULE_TIMEOUT);
The problem is rather that we shouldn't call dma_resv_wait_timeout() here in
the first place.
That should be done in amdgpu_vm_cpu_prepare() instead but currently can't be
done there because we don't call commit/prepare around page table allocation.
So we need to fix that first and then fix this bug here.
Regards,
Christian.
>
> pe += (unsigned long)amdgpu_bo_kptr(&vmbo->bo);
>
>
> base-commit: a6836fcbb5b22968019256025321d655b78bc49c