Skip to contentSkip to conversation

igb: fix TX stall during XDP teardown with AF_XDP zero-copy

PATCH In review Alex Dvoretsky 4 participants 13 messages Mar 6 – Mar 30

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

cover igb: fix TX stall during XDP teardown with AF_XDP zero-copy

When an AF_XDP zero-copy application exits while an XDP program remains attached, igb can permanently stall a TX queue associated with the AF_XDP socket. The interface stops forwarding traffic and typically requires a driver reload to recover.

Reproducer:

1. Attach an XDP program to igb
2. Run an AF_XDP zero-copy application
3. kill -9 the application

The TX watchdog eventually fires and the interface becomes unresponsive. Reproduced on Intel I210 with Linux 6.17.

igb_clean_rx_irq_zc() lacks a __IGB_DOWN guard. When the AF_XDP process exits the XSK pool is destroyed, but NAPI continues polling. The function then repeatedly returns the full budget, which prevents napi_complete_done() from completing. As a result igb_down() blocks in napi_synchronize() and TX completions stop being processed, eventually triggering the TX watchdog.

Patch 1 adds a __IGB_DOWN guard to igb_clean_rx_irq_zc() to break the infinite NAPI poll loop.

Patch 2 prevents igb_tx_timeout() from scheduling reset_task during XDP transitions when the device is shutting down.

Patch 3 adds synchronization in igb_xdp_setup() to ensure that pending ndo_xsk_wakeup() calls complete before the teardown continues, and refreshes trans_start after igb_open() to prevent false TX timeouts.

igc handles a similar stale trans_start situation via txq_trans_cond_update() (commit 86ea56c5b0c7). This patch adds equivalent protection for igb during XDP transitions.

Tested on Intel I210:

- AF_XDP ZC app exit with XDP attached
- XDP detach while AF_XDP running
- repeated XDP attach/detach cycles

Alex Dvoretsky (3):
igb: check __IGB_DOWN in igb_clean_rx_irq_zc()
igb: skip reset in igb_tx_timeout() during XDP transition
igb: add XDP transition guards in igb_xdp_setup()

 drivers/net/ethernet/intel/igb/igb_main.c | 15 +++++++++++++++
 drivers/net/ethernet/intel/igb/igb_xsk.c  |  3 +++
 2 files changed, 18 insertions(+)

--
2.51.0

#1 lore raw

PATCH 1/3 igb: check __IGB_DOWN in igb_clean_rx_irq_zc()

When an AF_XDP zero-copy application terminates abruptly (e.g., kill -9), the XSK buffer pool is destroyed but NAPI polling continues. igb_clean_rx_irq_zc() repeatedly returns the full budget (no descriptors, no buffers to allocate, xsk_buff_alloc() returns NULL) which makes napi_complete_done() re-arm the poll indefinitely.

Meanwhile igb_down() calls napi_synchronize(), which waits for a NAPI poll cycle that completes with done < budget. This never happens, so igb_down() blocks indefinitely. The 5-second TX watchdog fires because no TX completions are processed while NAPI is stuck. Since igb_down() never finishes, igb_up() is never called, and the TX queue remains permanently stalled.

Fix this by adding an __IGB_DOWN check at the top of igb_clean_rx_irq_zc(), returning 0 immediately when the adapter is going down. This allows napi_synchronize() in igb_down() to complete, matching the pattern already used in igb_clean_tx_irq().

Fixes 2c6196013f84 ("igb: Add AF_XDP zero-copy Rx support")
---
 drivers/net/ethernet/intel/igb/igb_xsk.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/igb/igb_xsk.c +3 -0
index 30ce5fbb5b77..ca4aa4d935d5 100644
@@ -351,6 +351,9 @@ int igb_clean_rx_irq_zc(struct igb_q_vector *q_vector,
 	u16 entries_to_alloc;
 	struct sk_buff *skb;
 
+	if (test_bit(__IGB_DOWN, &adapter->state))
+		return 0;
+
 	/* xdp_prog cannot be NULL in the ZC path */
 	xdp_prog = READ_ONCE(rx_ring->xdp_prog);
 
Signature · 1 line
2.51.0
#9 lore raw

PATCH 2/3 igb: skip reset in igb_tx_timeout() during XDP transition

In reply to Alex Dvoretsky

When igb_xdp_setup() transitions between XDP and non-XDP mode on a running device, it calls igb_close() followed by igb_open(). During this window the adapter is down while trans_start still contains the timestamp from before igb_close(), so the TX watchdog can fire a spurious timeout.

The resulting schedule_work(&adapter->reset_task) races with the igb_open() path: the reset task may run while the device is being brought back up, or immediately after, causing unexpected ring reinitialisation and register writes.

Fix this by checking __IGB_DOWN at the top of igb_tx_timeout(). A reset is unnecessary because the device will be fully reinitialised by the subsequent igb_open().

Fixes 9cbc948b5a20 ("igb: add XDP support")
---
 drivers/net/ethernet/intel/igb/igb_main.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/ethernet/intel/igb/igb_main.c +4 -0
index 223a10cae4a9..ddb7ce9e97bf 100644
@@ -6651,6 +6651,10 @@ static void igb_tx_timeout(struct net_device *netdev, unsigned int __always_unus
 	struct igb_adapter *adapter = netdev_priv(netdev);
 	struct e1000_hw *hw = &adapter->hw;
 
+	/* Ignore timeout if the adapter is going down. */
+	if (test_bit(__IGB_DOWN, &adapter->state))
+		return;
+
 	/* Do the reset outside of interrupt context */
 	adapter->tx_timeout_count++;
 
Signature · 1 line
2.51.0
#11 lore raw

PATCH 3/3 igb: add XDP transition guards in igb_xdp_setup()

In reply to Alex Dvoretsky

igb_xdp_setup() calls igb_close() + igb_open() when transitioning between XDP and non-XDP mode on a running device. This has two issues:

1. ndo_xsk_wakeup() runs under rcu_read_lock() and may still access the rings while igb_xdp_setup() removes the XDP program. Without waiting for an RCU grace period, igb_close() can tear down the rings while ndo_xsk_wakeup() is still executing. Add synchronize_rcu() before igb_close() when removing an XDP program to ensure all in-flight RCU readers complete first.

2. The igb_close()/igb_open() window leaves trans_start stale from before the close: the TX watchdog can fire a spurious timeout and queue a reset_task that races with igb_open(). Add netif_trans_update() after igb_open() to refresh the timestamp, and cancel_work() to cancel any reset_task that may have been queued while the device was down.

Note: cancel_work_sync() cannot be used here because igb_reset_task() takes rtnl_lock, which is already held by the ndo_bpf caller. Plain cancel_work() is sufficient: if reset_task is already running, it blocks on rtnl_lock and will check __IGB_DOWN when it acquires it.

Fixes 9cbc948b5a20 ("igb: add XDP support")
---
 drivers/net/ethernet/intel/igb/igb_main.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/net/ethernet/intel/igb/igb_main.c +11 -0
index ddb7ce9e97bf..9ba944bf67b4 100644
@@ -2913,6 +2913,9 @@ static int igb_xdp_setup(struct net_device *dev, struct netdev_bpf *bpf)
 
 	/* device is up and bpf is added/removed, must setup the RX queues */
 	if (need_reset && running) {
+		if (!prog)
+			/* Wait for RCU readers (e.g. ndo_xsk_wakeup). */
+			synchronize_rcu();
 		igb_close(dev);
 	} else {
 		for (i = 0; i < adapter->num_rx_queues; i++)
@@ -2936,6 +2939,14 @@ static int igb_xdp_setup(struct net_device *dev, struct netdev_bpf *bpf)
 	if (running)
 		igb_open(dev);
 
+	/* Refresh watchdog timestamp after reopen and cancel any
+	 * reset task queued while the device was down.
+	 */
+	if (need_reset && running) {
+		netif_trans_update(dev);
+		cancel_work(&adapter->reset_task);
+	}
+
 	return 0;
 }
 
Signature · 1 line
2.51.0
Reviewed-by on v1 1/3
#2 lore raw

RE: [Intel-wired-lan] [PATCH net 1/3] igb: check __IGB_DOWN in igb_clean_rx_irq_zc()

In reply to Alex Dvoretsky
Quoted 57 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Alex Dvoretsky
Sent: Friday, March 6, 2026 10:13 PM
To: [email protected]
Cc: [email protected]; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; Fijalkowski, Maciej <[email protected]>; Alex Dvoretsky <[email protected]>
Subject: [Intel-wired-lan] [PATCH net 1/3] igb: check __IGB_DOWN in igb_clean_rx_irq_zc()

When an AF_XDP zero-copy application terminates abruptly (e.g., kill - 9), the XSK buffer pool is destroyed but NAPI polling continues. igb_clean_rx_irq_zc() repeatedly returns the full budget (no descriptors, no buffers to allocate, xsk_buff_alloc() returns NULL) which makes napi_complete_done() re-arm the poll indefinitely.

Meanwhile igb_down() calls napi_synchronize(), which waits for a NAPI poll cycle that completes with done < budget. This never happens, so igb_down() blocks indefinitely. The 5-second TX watchdog fires because no TX completions are processed while NAPI is stuck. Since igb_down() never finishes, igb_up() is never called, and the TX queue remains permanently stalled.

Fix this by adding an __IGB_DOWN check at the top of igb_clean_rx_irq_zc(), returning 0 immediately when the adapter is going down. This allows napi_synchronize() in igb_down() to complete, matching the pattern already used in igb_clean_tx_irq().

Fixes 2c6196013f84 ("igb: Add AF_XDP zero-copy Rx support")
---
 drivers/net/ethernet/intel/igb/igb_xsk.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/igb/igb_xsk.c +3 -1
index 30ce5fbb5b77..ca4aa4d935d5 100644
@@ -351,6 +351,9 @@ int igb_clean_rx_irq_zc(struct igb_q_vector
 *q_vector,
 	u16 entries_to_alloc;
 	struct sk_buff *skb;
 
+	if (test_bit(__IGB_DOWN, &adapter->state))
+		return 0;
+
 	/* xdp_prog cannot be NULL in the ZC path */
 	xdp_prog = READ_ONCE(rx_ring->xdp_prog);
 
--
Quoted 1 line

2.51.0

Reviewed-by on v1 2/3
#10 lore raw

RE: [Intel-wired-lan] [PATCH net 2/3] igb: skip reset in igb_tx_timeout() during XDP transition

In reply to Alex Dvoretsky
Quoted 55 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Alex Dvoretsky
Sent: Friday, March 6, 2026 10:13 PM
To: [email protected]
Cc: [email protected]; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; Fijalkowski, Maciej <[email protected]>; Alex Dvoretsky <[email protected]>
Subject: [Intel-wired-lan] [PATCH net 2/3] igb: skip reset in igb_tx_timeout() during XDP transition

When igb_xdp_setup() transitions between XDP and non-XDP mode on a running device, it calls igb_close() followed by igb_open(). During this window the adapter is down while trans_start still contains the timestamp from before igb_close(), so the TX watchdog can fire a spurious timeout.

The resulting schedule_work(&adapter->reset_task) races with the igb_open() path: the reset task may run while the device is being brought back up, or immediately after, causing unexpected ring reinitialisation and register writes.

Fix this by checking __IGB_DOWN at the top of igb_tx_timeout(). A reset is unnecessary because the device will be fully reinitialised by the subsequent igb_open().

Fixes 9cbc948b5a20 ("igb: add XDP support")
---
 drivers/net/ethernet/intel/igb/igb_main.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/ethernet/intel/igb/igb_main.c +4 -1
index 223a10cae4a9..ddb7ce9e97bf 100644
@@ -6651,6 +6651,10 @@ static void igb_tx_timeout(struct net_device
 *netdev, unsigned int __always_unus
 	struct igb_adapter *adapter = netdev_priv(netdev);
 	struct e1000_hw *hw = &adapter->hw;
 
+	/* Ignore timeout if the adapter is going down. */
+	if (test_bit(__IGB_DOWN, &adapter->state))
+		return;
+
 	/* Do the reset outside of interrupt context */
 	adapter->tx_timeout_count++;
 
--
Quoted 1 line

2.51.0

Reviewed-by on v1 3/3
#12 lore raw

RE: [Intel-wired-lan] [PATCH net 3/3] igb: add XDP transition guards in igb_xdp_setup()

In reply to Alex Dvoretsky
Quoted 78 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Alex Dvoretsky
Sent: Friday, March 6, 2026 10:13 PM
To: [email protected]
Cc: [email protected]; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; Fijalkowski, Maciej <[email protected]>; Alex Dvoretsky <[email protected]>
Subject: [Intel-wired-lan] [PATCH net 3/3] igb: add XDP transition guards in igb_xdp_setup()

igb_xdp_setup() calls igb_close() + igb_open() when transitioning between XDP and non-XDP mode on a running device. This has two issues:

1. ndo_xsk_wakeup() runs under rcu_read_lock() and may still access the rings while igb_xdp_setup() removes the XDP program. Without waiting for an RCU grace period, igb_close() can tear down the rings while ndo_xsk_wakeup() is still executing. Add synchronize_rcu() before igb_close() when removing an XDP program to ensure all in-flight RCU readers complete first.

2. The igb_close()/igb_open() window leaves trans_start stale from before the close: the TX watchdog can fire a spurious timeout and queue a reset_task that races with igb_open(). Add netif_trans_update() after igb_open() to refresh the timestamp, and cancel_work() to cancel any reset_task that may have been queued while the device was down.

Note: cancel_work_sync() cannot be used here because igb_reset_task() takes rtnl_lock, which is already held by the ndo_bpf caller. Plain cancel_work() is sufficient: if reset_task is already running, it blocks on rtnl_lock and will check __IGB_DOWN when it acquires it.

Fixes 9cbc948b5a20 ("igb: add XDP support")
---
 drivers/net/ethernet/intel/igb/igb_main.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/net/ethernet/intel/igb/igb_main.c +0 -0
index ddb7ce9e97bf..9ba944bf67b4 100644
@@ -2913,6 +2913,9 @@ static int igb_xdp_setup(struct net_device *dev,
 struct netdev_bpf *bpf)
 
 	/* device is up and bpf is added/removed, must setup the RX

queues */

drivers/net/ethernet/intel/igb/igb_main.c +4 -0
 	if (need_reset && running) {
+		if (!prog)
+			/* Wait for RCU readers (e.g. ndo_xsk_wakeup). */
+			synchronize_rcu();
 		igb_close(dev);
 	} else {
 		for (i = 0; i < adapter->num_rx_queues; i++) @@ -2936,6
+2939,14 @@ static int igb_xdp_setup(struct net_device *dev, struct

netdev_bpf *bpf)

drivers/net/ethernet/intel/igb/igb_main.c +8 -1
 	if (running)
 		igb_open(dev);
 
+	/* Refresh watchdog timestamp after reopen and cancel any
+	 * reset task queued while the device was down.
+	 */
+	if (need_reset && running) {
+		netif_trans_update(dev);
+		cancel_work(&adapter->reset_task);
+	}
+
 	return 0;
 }
 
--
Quoted 1 line

2.51.0

#3 lore raw

Re: [PATCH net 1/3] igb: check __IGB_DOWN in igb_clean_rx_irq_zc()

In reply to Alex Dvoretsky
Quoted 13 lines · Alex Dvoretsky

When an AF_XDP zero-copy application terminates abruptly (e.g., kill -9), the XSK buffer pool is destroyed but NAPI polling continues. igb_clean_rx_irq_zc() repeatedly returns the full budget (no descriptors, no buffers to allocate, xsk_buff_alloc() returns NULL) which makes napi_complete_done() re-arm the poll indefinitely.

Meanwhile igb_down() calls napi_synchronize(), which waits for a NAPI poll cycle that completes with done < budget. This never happens, so igb_down() blocks indefinitely. The 5-second TX watchdog fires because no TX completions are processed while NAPI is stuck. Since igb_down() never finishes, igb_up() is never called, and the TX queue remains permanently stalled.

Quoted 4 lines

Fix this by adding an __IGB_DOWN check at the top of igb_clean_rx_irq_zc(), returning 0 immediately when the adapter is going down. This allows napi_synchronize() in igb_down() to complete, matching the pattern already used in igb_clean_tx_irq().

How about getting rid of napi_synchronize() instead of hurting hot path?

napi_disable() sets NAPI_STATE_DISABLE which should prevent further polls for you. Did you try that approach?

Quoted 25 lines
Fixes 2c6196013f84 ("igb: Add AF_XDP zero-copy Rx support")
---
 drivers/net/ethernet/intel/igb/igb_xsk.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/igb/igb_xsk.c +3 -0
index 30ce5fbb5b77..ca4aa4d935d5 100644
@@ -351,6 +351,9 @@ int igb_clean_rx_irq_zc(struct igb_q_vector *q_vector,
 	u16 entries_to_alloc;
 	struct sk_buff *skb;
 
+	if (test_bit(__IGB_DOWN, &adapter->state))
+		return 0;
+
 	/* xdp_prog cannot be NULL in the ZC path */
 	xdp_prog = READ_ONCE(rx_ring->xdp_prog);
 
Signature · 1 line
2.51.0
#4 lore raw

PATCH v2 1/1 igb: remove napi_synchronize() in igb_down()

When an AF_XDP zero-copy application terminates abruptly (e.g., kill -9), the XSK buffer pool is destroyed but NAPI polling continues. igb_clean_rx_irq_zc() repeatedly returns the full budget, preventing napi_complete_done() from clearing NAPI_STATE_SCHED.

igb_down() calls napi_synchronize() before napi_disable() for each queue vector. napi_synchronize() spins waiting for NAPI_STATE_SCHED to clear, which never happens. igb_down() blocks indefinitely, the TX watchdog fires, and the TX queue remains permanently stalled.

napi_disable() already handles this correctly: it sets NAPI_STATE_DISABLE. After a full-budget poll, __napi_poll() checks napi_disable_pending(). If set, it forces completion and clears NAPI_STATE_SCHED, breaking the loop that napi_synchronize() cannot.

napi_synchronize() was added in commit 41f149a285da ("igb: Fix possible panic caused by Rx traffic arrival while interface is down"). napi_disable() provides stronger guarantees: it prevents further scheduling and waits for any active poll to exit.
Other Intel drivers (ixgbe, ice, i40e) use napi_disable() without a preceding napi_synchronize() in their down paths.

Remove redundant napi_synchronize() call.

Fixes 2c6196013f84 ("igb: Add AF_XDP zero-copy Rx support")

---
Thanks for the suggestion, Maciej. I tested removing napi_synchronize() and it fixes the issue cleanly — napi_disable() handles the stuck poll via NAPI_STATE_DISABLE without needing any hot-path changes.

v2:
- Replaced 3-patch series with single napi_synchronize() removal, per Maciej Fijalkowski's suggestion. napi_disable() handles the stuck NAPI poll via NAPI_STATE_DISABLE, making the __IGB_DOWN checks in igb_clean_rx_irq_zc() and igb_tx_timeout(), and the transition guards in igb_xdp_setup(), all unnecessary.
- Tested on Intel I210 (igb) with AF_XDP zero-copy: full E2E traffic suite, graceful shutdown, and 5x kill-9 stress cycles. Zero tx_timeout events.

 drivers/net/ethernet/intel/igb/igb_main.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/ethernet/intel/igb/igb_main.c +0 -1
index 12e8e30d8a2d..a1b3c5e4f7d2 100644
@@ -2203,7 +2203,6 @@ void igb_down(struct igb_adapter *adapter)
 
 	for (i = 0; i < adapter->num_q_vectors; i++) {
 		if (adapter->q_vector[i]) {
-			napi_synchronize(&adapter->q_vector[i]->napi);
 			igb_set_queue_napi(adapter, i, NULL);
 			napi_disable(&adapter->q_vector[i]->napi);
 		}

--
2.51.0

Reviewed-by on v2 1/1
#5 lore raw

RE: [PATCH net v2] igb: remove napi_synchronize() in igb_down()

Quoted 67 lines

-----Original Message-----
From: Alex Dvoretsky <[email protected]>
Sent: Wednesday, March 11, 2026 9:45 PM
To: [email protected]
Cc: [email protected]; Fijalkowski, Maciej <[email protected]>; Loktionov, Aleksandr <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; Alex Dvoretsky <[email protected]>
Subject: [PATCH net v2] igb: remove napi_synchronize() in igb_down()

When an AF_XDP zero-copy application terminates abruptly (e.g., kill - 9), the XSK buffer pool is destroyed but NAPI polling continues. igb_clean_rx_irq_zc() repeatedly returns the full budget, preventing napi_complete_done() from clearing NAPI_STATE_SCHED.

igb_down() calls napi_synchronize() before napi_disable() for each queue vector. napi_synchronize() spins waiting for NAPI_STATE_SCHED to clear, which never happens. igb_down() blocks indefinitely, the TX watchdog fires, and the TX queue remains permanently stalled.

napi_disable() already handles this correctly: it sets NAPI_STATE_DISABLE.
After a full-budget poll, __napi_poll() checks napi_disable_pending(). If set, it forces completion and clears NAPI_STATE_SCHED, breaking the loop that napi_synchronize() cannot.

napi_synchronize() was added in commit 41f149a285da ("igb: Fix possible panic caused by Rx traffic arrival while interface is down"). napi_disable() provides stronger guarantees: it prevents further scheduling and waits for any active poll to exit.
Other Intel drivers (ixgbe, ice, i40e) use napi_disable() without a preceding napi_synchronize() in their down paths.

Remove redundant napi_synchronize() call.

Fixes 2c6196013f84 ("igb: Add AF_XDP zero-copy Rx support")

---
Thanks for the suggestion, Maciej. I tested removing napi_synchronize() and it fixes the issue cleanly — napi_disable() handles the stuck poll via NAPI_STATE_DISABLE without needing any hot- path changes.

v2:
- Replaced 3-patch series with single napi_synchronize() removal, per Maciej Fijalkowski's suggestion. napi_disable() handles the stuck NAPI poll via NAPI_STATE_DISABLE, making the __IGB_DOWN checks in igb_clean_rx_irq_zc() and igb_tx_timeout(), and the transition guards in igb_xdp_setup(), all unnecessary.
- Tested on Intel I210 (igb) with AF_XDP zero-copy: full E2E traffic suite, graceful shutdown, and 5x kill-9 stress cycles. Zero tx_timeout events.

 drivers/net/ethernet/intel/igb/igb_main.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/ethernet/intel/igb/igb_main.c +0 -0
index 12e8e30d8a2d..a1b3c5e4f7d2 100644

drivers/net/ethernet/intel/igb/igb_main.c void igb_down(struct igb_adapter *adapter) · line 2207

Quoted 6 lines
drivers/net/ethernet/intel/igb/igb_main.c +0 -1
@@ -2203,7 +2203,6 @@ void igb_down(struct igb_adapter *adapter)
 
 	for (i = 0; i < adapter->num_q_vectors; i++) {
 		if (adapter->q_vector[i]) {
-			napi_synchronize(&adapter->q_vector[i]->napi);
 			igb_set_queue_napi(adapter, i, NULL);
 			napi_disable(&adapter->q_vector[i]->napi);

Ok. But I’d swap the two remaining calls so we don’t modify any per‑queue NAPI plumbing while the poll could still be running. What do you think?

-       igb_set_queue_napi(adapter, i, NULL);
-       napi_disable(&adapter->q_vector[i]->napi);
+       napi_disable(&adapter->q_vector[i]->napi);
+       igb_set_queue_napi(adapter, i, NULL);
Quoted 3 lines
drivers/net/ethernet/intel/igb/igb_main.c +0 -1
 		}
--

2.51.0

#6 lore raw

PATCH v3 1/1 igb: remove napi_synchronize() in igb_down()

When an AF_XDP zero-copy application terminates abruptly (e.g., kill -9), the XSK buffer pool is destroyed but NAPI polling continues. igb_clean_rx_irq_zc() repeatedly returns the full budget, preventing napi_complete_done() from clearing NAPI_STATE_SCHED.

igb_down() calls napi_synchronize() before napi_disable() for each queue vector. napi_synchronize() spins waiting for NAPI_STATE_SCHED to clear, which never happens. igb_down() blocks indefinitely, the TX watchdog fires, and the TX queue remains permanently stalled.

napi_disable() already handles this correctly: it sets NAPI_STATE_DISABLE. After a full-budget poll, __napi_poll() checks napi_disable_pending(). If set, it forces completion and clears NAPI_STATE_SCHED, breaking the loop that napi_synchronize() cannot.

napi_synchronize() was added in commit 41f149a285da ("igb: Fix possible panic caused by Rx traffic arrival while interface is down"). napi_disable() provides stronger guarantees: it prevents further scheduling and waits for any active poll to exit.
Other Intel drivers (ixgbe, ice, i40e) use napi_disable() without a preceding napi_synchronize() in their down paths.

Remove redundant napi_synchronize() call and reorder napi_disable() before igb_set_queue_napi() so the queue-to-NAPI mapping is only cleared after polling has fully stopped.

Fixes 2c6196013f84 ("igb: Add AF_XDP zero-copy Rx support")

---
Agreed, that looks cleaner — no reason to touch the NAPI plumbing while the poll could still be running.

v3:
- Reorder napi_disable() before igb_set_queue_napi() per Aleksandr Loktionov's suggestion.

v2:
- Replaced 3-patch series with single napi_synchronize() removal, per Maciej Fijalkowski's suggestion. napi_disable() handles the stuck NAPI poll via NAPI_STATE_DISABLE, making the __IGB_DOWN checks in igb_clean_rx_irq_zc() and igb_tx_timeout(), and the transition guards in igb_xdp_setup(), all unnecessary.
- Tested on Intel I210 (igb) with AF_XDP zero-copy: full E2E traffic suite, graceful shutdown, and 5x kill-9 stress cycles. Zero tx_timeout events.

 drivers/net/ethernet/intel/igb/igb_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +1 -2
index 7c41e32256fa..0793842cb937 100644
@@ -2203,9 +2203,8 @@ void igb_down(struct igb_adapter *adapter)
 
 	for (i = 0; i < adapter->num_q_vectors; i++) {
 		if (adapter->q_vector[i]) {
-			napi_synchronize(&adapter->q_vector[i]->napi);
-			igb_set_queue_napi(adapter, i, NULL);
 			napi_disable(&adapter->q_vector[i]->napi);
+			igb_set_queue_napi(adapter, i, NULL);
 		}
 	}
 
Signature · 1 line
2.51.0
Reviewed-by on v3 1/1
#7 lore raw

Re: [PATCH net v3] igb: remove napi_synchronize() in igb_down()

Quoted 22 lines · Alex Dvoretsky

When an AF_XDP zero-copy application terminates abruptly (e.g., kill -9), the XSK buffer pool is destroyed but NAPI polling continues. igb_clean_rx_irq_zc() repeatedly returns the full budget, preventing napi_complete_done() from clearing NAPI_STATE_SCHED.

igb_down() calls napi_synchronize() before napi_disable() for each queue vector. napi_synchronize() spins waiting for NAPI_STATE_SCHED to clear, which never happens. igb_down() blocks indefinitely, the TX watchdog fires, and the TX queue remains permanently stalled.

napi_disable() already handles this correctly: it sets NAPI_STATE_DISABLE. After a full-budget poll, __napi_poll() checks napi_disable_pending(). If set, it forces completion and clears NAPI_STATE_SCHED, breaking the loop that napi_synchronize() cannot.

napi_synchronize() was added in commit 41f149a285da ("igb: Fix possible panic caused by Rx traffic arrival while interface is down"). napi_disable() provides stronger guarantees: it prevents further scheduling and waits for any active poll to exit.
Other Intel drivers (ixgbe, ice, i40e) use napi_disable() without a preceding napi_synchronize() in their down paths.

Quoted 8 lines

Remove redundant napi_synchronize() call and reorder napi_disable() before igb_set_queue_napi() so the queue-to-NAPI mapping is only cleared after polling has fully stopped.

Fixes 2c6196013f84 ("igb: Add AF_XDP zero-copy Rx support")
Quoted 39 lines

---
Agreed, that looks cleaner — no reason to touch the NAPI plumbing while the poll could still be running.

v3:
- Reorder napi_disable() before igb_set_queue_napi() per Aleksandr Loktionov's suggestion.

v2:
- Replaced 3-patch series with single napi_synchronize() removal, per Maciej Fijalkowski's suggestion. napi_disable() handles the stuck NAPI poll via NAPI_STATE_DISABLE, making the __IGB_DOWN checks in igb_clean_rx_irq_zc() and igb_tx_timeout(), and the transition guards in igb_xdp_setup(), all unnecessary.
- Tested on Intel I210 (igb) with AF_XDP zero-copy: full E2E traffic suite, graceful shutdown, and 5x kill-9 stress cycles. Zero tx_timeout events.

 drivers/net/ethernet/intel/igb/igb_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +1 -2
index 7c41e32256fa..0793842cb937 100644
@@ -2203,9 +2203,8 @@ void igb_down(struct igb_adapter *adapter)
 
 	for (i = 0; i < adapter->num_q_vectors; i++) {
 		if (adapter->q_vector[i]) {
-			napi_synchronize(&adapter->q_vector[i]->napi);
-			igb_set_queue_napi(adapter, i, NULL);
 			napi_disable(&adapter->q_vector[i]->napi);
+			igb_set_queue_napi(adapter, i, NULL);
 		}
 	}
 
Signature · 1 line
2.51.0
Tested-by
#8 lore raw

RE: [Intel-wired-lan] [PATCH net v3] igb: remove napi_synchronize() in igb_down()

Quoted 85 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Maciej Fijalkowski
Sent: Friday, March 13, 2026 10:29 AM
To: Alex Dvoretsky <[email protected]>
Cc: [email protected]; [email protected]; Loktionov, Aleksandr <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]
Subject: Re: [Intel-wired-lan] [PATCH net v3] igb: remove napi_synchronize() in igb_down()

Quoted 22 lines · Alex Dvoretsky

When an AF_XDP zero-copy application terminates abruptly (e.g., kill -9), the XSK buffer pool is destroyed but NAPI polling continues. igb_clean_rx_irq_zc() repeatedly returns the full budget, preventing napi_complete_done() from clearing NAPI_STATE_SCHED.

igb_down() calls napi_synchronize() before napi_disable() for each queue vector. napi_synchronize() spins waiting for NAPI_STATE_SCHED to clear, which never happens. igb_down() blocks indefinitely, the TX watchdog fires, and the TX queue remains permanently stalled.

napi_disable() already handles this correctly: it sets NAPI_STATE_DISABLE. After a full-budget poll, __napi_poll() checks napi_disable_pending(). If set, it forces completion and clears NAPI_STATE_SCHED, breaking the loop that napi_synchronize() cannot.

napi_synchronize() was added in commit 41f149a285da ("igb: Fix possible panic caused by Rx traffic arrival while interface is down"). napi_disable() provides stronger guarantees: it prevents further scheduling and waits for any active poll to exit.
Other Intel drivers (ixgbe, ice, i40e) use napi_disable() without a preceding napi_synchronize() in their down paths.

Quoted 8 lines

Remove redundant napi_synchronize() call and reorder napi_disable() before igb_set_queue_napi() so the queue-to-NAPI mapping is only cleared after polling has fully stopped.

Fixes 2c6196013f84 ("igb: Add AF_XDP zero-copy Rx support")
Quoted 37 lines

---
Agreed, that looks cleaner — no reason to touch the NAPI plumbing while the poll could still be running.

v3:
- Reorder napi_disable() before igb_set_queue_napi() per Aleksandr Loktionov's suggestion.

v2:
- Replaced 3-patch series with single napi_synchronize() removal, per Maciej Fijalkowski's suggestion. napi_disable() handles the stuck NAPI poll via NAPI_STATE_DISABLE, making the __IGB_DOWN checks in igb_clean_rx_irq_zc() and igb_tx_timeout(), and the transition guards in igb_xdp_setup(), all unnecessary.
- Tested on Intel I210 (igb) with AF_XDP zero-copy: full E2E traffic suite, graceful shutdown, and 5x kill-9 stress cycles. Zero tx_timeout events.

 drivers/net/ethernet/intel/igb/igb_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +1 -2
index 7c41e32256fa..0793842cb937 100644
@@ -2203,9 +2203,8 @@ void igb_down(struct igb_adapter *adapter)
 
 	for (i = 0; i < adapter->num_q_vectors; i++) {
 		if (adapter->q_vector[i]) {
-			napi_synchronize(&adapter->q_vector[i]->napi);
-			igb_set_queue_napi(adapter, i, NULL);
 			napi_disable(&adapter->q_vector[i]->napi);
+			igb_set_queue_napi(adapter, i, NULL);
 		}
 	}
 
Quoted 3 lines
Quoted 3 lines

--
2.51.0