Skip to contentSkip to conversation

igc: remove napi_synchronize() in igc_down()

PATCH In review David Carlier 4 participants 4 messages Jul 12 – Jul 20

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

PATCH 1/1 igc: remove napi_synchronize() in igc_down()

When an AF_XDP zero-copy application is killed abruptly, the XSK pool is torn down but NAPI keeps polling. igc_clean_rx_irq_zc() then returns the full budget on every poll, so napi_complete_done() never clears NAPI_STATE_SCHED.

igc_down() calls napi_synchronize() before napi_disable(), so it spins forever waiting for that bit and the interface never goes down. Drop the napi_synchronize() and let napi_disable() do the job -- it sets NAPI_STATE_DISABLE, which forces the stuck poll to complete. Reorder it ahead of igc_set_queue_napi() so the NAPI mapping is cleared only after polling has stopped, matching the recent igb fix b1e067240379.

Fixes fc9df2a0b520 ("igc: Enable RX via AF_XDP zero-copy")
---
 drivers/net/ethernet/intel/igc/igc_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +1 -2
index 2c9e2dfd8499..b3883a5a7d7a 100644
@@ -5352,9 +5352,8 @@ void igc_down(struct igc_adapter *adapter)
 
 	for (i = 0; i < adapter->num_q_vectors; i++) {
 		if (adapter->q_vector[i]) {
-			napi_synchronize(&adapter->q_vector[i]->napi);
-			igc_set_queue_napi(adapter, i, NULL);
 			napi_disable(&adapter->q_vector[i]->napi);
+			igc_set_queue_napi(adapter, i, NULL);
 		}
 	}
 
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines · David Carlier

When an AF_XDP zero-copy application is killed abruptly, the XSK pool is torn down but NAPI keeps polling. igc_clean_rx_irq_zc() then returns the full budget on every poll, so napi_complete_done() never clears NAPI_STATE_SCHED.

igc_down() calls napi_synchronize() before napi_disable(), so it spins forever waiting for that bit and the interface never goes down. Drop the napi_synchronize() and let napi_disable() do the job -- it sets NAPI_STATE_DISABLE, which forces the stuck poll to complete. Reorder it ahead of igc_set_queue_napi() so the NAPI mapping is cleared only after polling has stopped, matching the recent igb fix b1e067240379.

Quoted 4 lines
Fixes fc9df2a0b520 ("igc: Enable RX via AF_XDP zero-copy")

This is a mirror of what Alex Dvoretsky did on igb, correct? Did you reproduce the same issue on your side or is it a blind shot at this driver?

Regardless, I think it's a correct thing to do, but some clarification would be nice.

Quoted 22 lines
---
 drivers/net/ethernet/intel/igc/igc_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +1 -2
index 2c9e2dfd8499..b3883a5a7d7a 100644
@@ -5352,9 +5352,8 @@ void igc_down(struct igc_adapter *adapter)
 
 	for (i = 0; i < adapter->num_q_vectors; i++) {
 		if (adapter->q_vector[i]) {
-			napi_synchronize(&adapter->q_vector[i]->napi);
-			igc_set_queue_napi(adapter, i, NULL);
 			napi_disable(&adapter->q_vector[i]->napi);
+			igc_set_queue_napi(adapter, i, NULL);
 		}
 	}
 
Signature · 1 line
2.53.0
Reviewed-by
#2 lore raw
Quoted 46 lines · Maciej Fijalkowski
Quoted 12 lines · David Carlier

When an AF_XDP zero-copy application is killed abruptly, the XSK pool is torn down but NAPI keeps polling. igc_clean_rx_irq_zc() then returns the full budget on every poll, so napi_complete_done() never clears NAPI_STATE_SCHED.

igc_down() calls napi_synchronize() before napi_disable(), so it spins forever waiting for that bit and the interface never goes down. Drop the napi_synchronize() and let napi_disable() do the job -- it sets NAPI_STATE_DISABLE, which forces the stuck poll to complete. Reorder it ahead of igc_set_queue_napi() so the NAPI mapping is cleared only after polling has stopped, matching the recent igb fix b1e067240379.

Quoted 4 lines
Fixes fc9df2a0b520 ("igc: Enable RX via AF_XDP zero-copy")

This is a mirror of what Alex Dvoretsky did on igb, correct? Did you reproduce the same issue on your side or is it a blind shot at this driver?

Regardless, I think it's a correct thing to do, but some clarification would be nice.

Quoted 19 lines
---
  drivers/net/ethernet/intel/igc/igc_main.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +1 -2
index 2c9e2dfd8499..b3883a5a7d7a 100644
@@ -5352,9 +5352,8 @@ void igc_down(struct igc_adapter *adapter)
 
  	for (i = 0; i < adapter->num_q_vectors; i++) {
  		if (adapter->q_vector[i]) {
-			napi_synchronize(&adapter->q_vector[i]->napi);
-			igc_set_queue_napi(adapter, i, NULL);
  			napi_disable(&adapter->q_vector[i]->napi);
+			igc_set_queue_napi(adapter, i, NULL);
  		}
  	}
 
Quoted 3 lines
Quoted 3 lines
Signature · 1 line
2.53.0
Tested-by
#3 lore raw
Quoted 41 lines · Dima
Quoted 40 lines · Maciej Fijalkowski
Quoted 12 lines · David Carlier

When an AF_XDP zero-copy application is killed abruptly, the XSK pool is torn down but NAPI keeps polling. igc_clean_rx_irq_zc() then returns the full budget on every poll, so napi_complete_done() never clears NAPI_STATE_SCHED.

igc_down() calls napi_synchronize() before napi_disable(), so it spins forever waiting for that bit and the interface never goes down. Drop the napi_synchronize() and let napi_disable() do the job -- it sets NAPI_STATE_DISABLE, which forces the stuck poll to complete. Reorder it ahead of igc_set_queue_napi() so the NAPI mapping is cleared only after polling has stopped, matching the recent igb fix b1e067240379.

Quoted 4 lines
Fixes fc9df2a0b520 ("igc: Enable RX via AF_XDP zero-copy")

This is a mirror of what Alex Dvoretsky did on igb, correct? Did you reproduce the same issue on your side or is it a blind shot at this driver?

Regardless, I think it's a correct thing to do, but some clarification would be nice.

Quoted 13 lines

---
  drivers/net/ethernet/intel/igc/igc_main.c | 3 +--

  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +0 -2
index 2c9e2dfd8499..b3883a5a7d7a 100644
@@ -5352,9 +5352,8 @@ void igc_down(struct igc_adapter *adapter)
       for (i = 0; i < adapter->num_q_vectors; i++) {
           if (adapter->q_vector[i]) {
-            napi_synchronize(&adapter->q_vector[i]->napi);
-            igc_set_queue_napi(adapter, i, NULL);
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
drivers/net/ethernet/intel/igc/igc_main.c +1 -0
               napi_disable(&adapter->q_vector[i]->napi);
+            igc_set_queue_napi(adapter, i, NULL);
           }
       }
Signature · 1 line
2.53.0