Skip to contentSkip to conversation

drm/amdgpu: re-check connection state before sending NPA-REVOKE

PATCH New Mukul Joshi 1 participant 1 message Sep 22

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: re-check connection state before sending NPA-REVOKE

The export cleanup worker checks amdgpu_ualink_check_conn_ready() once when building npa_release_bitmap, but not again in the send loop. Cleanup workers run concurrently on the unbounded NPA WQ (one per exported handle), so when a peer's egress dies many workers have already snapshot the connection as ESTABLISHED and all issue an LSDMA copy to the dead peer, flooding the log with repeated NPA-REVOKE send failures.

Re-check the connection immediately before each send, as the tlb shootdown, force_retry_rpcs and unmap_all_npa_addr loops already do, so once the first worker marks a peer NOT_READY the rest skip it.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c +18 -1
index 453315377f80..afb47a6f7c30 100644
@@ -2956,6 +2956,24 @@ static void amdgpu_ualink_exp_cleanup_worker(struct work_struct *work)
 	 */
 	for_each_set_bit(remote_acc_id, exp_xa_node->importers_bitmap,
 				 AMDGPU_UALINK_ACCEL_MAX) {
+		imp_entry = &exp_xa_node->importer_entries[remote_acc_id];
+
+		/* Re-check the connection right before the send. Many cleanup
+		 * workers run concurrently on the unbounded NPA WQ (one per
+		 * exported handle), and they all snapshot the connection as
+		 * ESTABLISHED in the build loop above before any of them fails.
+		 * Once a peer's egress dies, the first failing worker flips it
+		 * to NOT_READY; without this re-check every other in-flight
+		 * worker would still issue an LSDMA PIO copy to the same dead
+		 * peer and log a fresh "NPA-REVOKE send failed" storm.
+		 */
+		if (!amdgpu_ualink_check_conn_ready(adev, remote_acc_id,
+					imp_entry->generation_count)) {
+			clear_bit(remote_acc_id,
+				  exp_xa_node->npa_release_bitmap);
+			continue;
+		}
+
 		dev_dbg(adev->dev,
 			"EXP-CLEANUP: Sending NPA-REVOKE to remote:%u\n",
 			remote_acc_id);
@@ -2966,7 +2984,6 @@ static void amdgpu_ualink_exp_cleanup_worker(struct work_struct *work)
 				remote_acc_id);
 			clear_bit(remote_acc_id, exp_xa_node->npa_release_bitmap);
 
-			imp_entry = &exp_xa_node->importer_entries[remote_acc_id];
 			amdgpu_ualink_handle_connection_reset(adev, remote_acc_id,
 						AMDGPU_UALINK_CONN_NOT_READY,
 						imp_entry->generation_count);
Signature · 1 line
2.55.0