Patch 2 is v1 of the generation count fix. The Sashiko review of v1
pointed out that making the per-remote check exact can skip the only
unmap of the shared NPA range in Source-Alias mode, and the BO is freed
anyway, leaving valid PTEs to freed VRAM in the NPA VM. The same happens
without patch 2 whenever no importer passes the check (for instance after
a failed TLB shootdown), and in Source-Ident mode for every importer
that is not ready.

Patch 1 makes amdgpu_ualink_unmap_all_npa_addr() walk the bitmap copy
the callers already free the NPA VA ranges with (the TLB shootdown has
cleared the bits of importers that are not ready by then), and unmap
every range in it whether or not the importer's connection is still
ready, so that patch 2 can no longer leave PTEs behind. This also answers the 
question I asked
below the cut in v1.

Neither patch has been runtime-tested (no UALink hardware); both are
compile-tested with W=1 on x86_64 allmodconfig.

---
Changes in v2:
- New patch 1: always unmap the exported NPA range(s) in
  amdgpu_ualink_unmap_all_npa_addr(), reported by Sashiko.
- Patch 2: drop the "does not change that policy" paragraph and explain
  why the stricter check no longer affects the unmap.
- Link to v1: 
https://patch.msgid.link/20261203-fix-u5-amdgpu-ualink-alias-gencount-v1-1-a2e17004b...@tuta.io

---
bob (2):
      drm/amdgpu: unmap exported NPA ranges even if the importer is gone
      drm/amdgpu: use the per-remote UALink generation count in Source-Alias 
mode

 drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c | 50 +++++++++++++++++++++---------
 1 file changed, 36 insertions(+), 14 deletions(-)
---
base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
change-id: 20261203-fix-u5-amdgpu-ualink-alias-gencount-f68079768059

Best regards,
--  
bob <[email protected]>


Reply via email to