drm/amdgpu: Enable remote TLB shootdown
Subsystems (2)
PATCH v2 1/3 drm/amdgpu: Enable remote TLB shootdown
FW remote TLB shootdown support is ready now. Remove the early-return stub so the command is actually sent to the peer GPU.
This requires nHT firmware version >= 1.2.E.1 (IFWI >= BRP0660).
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c +1 -2
@@ -6072,9 +6072,8 @@ static int amdgpu_ualink_remote_shootdown(struct amdgpu_device *adev,struct amdgpu_ualink_ring *ring;int r; -dev_dbg (adev->dev,"skip remote shootdown to remote_accel_id %u\n" , +dev_dbg (adev->dev,"send remote shootdown to remote_accel_id %u\n" , remote_accel_id); -return 0 ; peer = &remote->peer[remote_accel_id]; ring = &peer->shootdown;
Signature · 1 line
2.50.1
PATCH v2 2/3 drm/amdgpu: Enable RPC on importer NPA mappings
On NPA mappings PTE.X is repurposed as the RPC (remote presence check) enable bit. Set it for importer mappings, so the importer takes a page fault once the exporter's NPA mapping is gone, instead of accessing a stale mapping.
This runs after the generic AMDGPU_VM_PAGE_EXECUTABLE handling and intentionally overrides the UAPI flag. The exporter and the remote ring, wptr and doorbell mappings keep their own PTE.X handling.
--- drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c +3 -1
@@ -616,7 +616,9 @@ static void gmc_v12_1_get_npa_flags(struct amdgpu_device *adev,AMDGPU_PTE_BUS_ATOMICS ; *flags &= ~AMDGPU_PTE_VALID ; *flags &= ~AMDGPU_PTE_SYSTEM ; - *flags &= ~AMDGPU_PTE_EXECUTABLE ; + +/* PTE.X=1 turns on RPC (remote presence check), overrides vm_flags */ + *flags |=AMDGPU_PTE_EXECUTABLE ; }/*
Signature · 1 line
2.50.1
PATCH v2 3/3 wip: debug remote shootdown
In reply to Philip YangFor KFDTest testing, don't merge.
To verify if remote shootdown flushes the TLB on the importer.
exporter, amdgpu_ualink_revoke_exported_memory doesn't send NPA-REVOKE, so the importer keeps the NPA address mapping. Still send remote shootdown to importer, to flush importer TLB, and then unmap from NPA vm, free BO and NPA address.
The -EFAULT return makes the caller clear npa_release_bitmap, so the exporter doesn't wait for an NPA-RELEASE that will never come. The resulting "NPA-REVOKE send failed" errors are expected.
KFDTest UALink remote_shootdown_test steps:
exporter importer
1. export BO
2. import BO, map NPA address to GPU
access remote BO with SDMA
3. free BO, send remote shootdown
unmap from NPA vm
4. access remote BO with SDMA
Test result:
If GPU page fault on importer, test passed, remote shootdown works as expected
If GPU page fault on exporter NPA vmid 15, test failed, remote shootdown didn't flush importer TLB or RPC not working.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c +4 -0
@@ -1943,6 +1943,10 @@ static int amdgpu_ualink_send_npa_revoke_msg(struct amdgpu_device *adev, {u32 dw0, dw1, dw2, dw3; +dev_dbg (adev->dev,"dont send NPA revoke to accel_id %u for KFDTest\n" , + remote_acc_id); +return -EFAULT ; + dw0 =lower_32_bits (handle.handle_lo); dw0 &= ~AMDGPU_UALINK_MESSAGE_HEADER_MASK ; dw0 |=AMDGPU_UALINK_NPA_REVOKE_MSG ;
Signature · 1 line
2.50.1
Quoted 6 lines · Philip Yang
FW remote TLB shootdown support is ready now. Remove the early-return stub so the command is actually sent to the peer GPU.
This requires nHT firmware version >= 1.2.E.1 (IFWI >= BRP0660).
Signed-off-by Philip Yang <[email protected]>
The series is
Quoted 19 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c +1
-2@@ -6072,9 +6072,8 @@ static int amdgpu_ualink_remote_shootdown(struct amdgpu_device *adev,struct amdgpu_ualink_ring *ring;int r; -dev_dbg (adev->dev,"skip remote shootdown to remote_accel_id %u\n" , +dev_dbg (adev->dev,"send remote shootdown to remote_accel_id %u\n" , remote_accel_id); -return 0 ; peer = &remote->peer[remote_accel_id]; ring = &peer->shootdown;