Skip to contentSkip to conversation

e1000e: stop unnecessary polling when using msi-x

PATCH Applied Andy Gospodarek 3 participants 5 messages Jun 18, 2009 – Jun 22, 2009

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

PATCH 1/1 e1000e: stop unnecessary polling when using msi-x

The last hunk of this commit:

commit 12d04a3c12b420f23398b4d650127642469a60a6
Author: Alexander Duyck <[email protected]>
Date: Wed Mar 25 22:05:03 2009 +0000

e1000e: commonize tx cleanup routine to match e1000 & igb

changed the logic for determining if we should call napi_complete or not at then end of a napi poll.

If the NIC is using MSI-X with no work to do in ->poll, net_rx_action can just spin indefinitely on older kernels and for 2 jiffies on newer kernels since napi_complete is never called and budget isn't decremented.

Discovered and verified while testing driver backport to an older kernel.

---

 netdev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/e1000e/netdev.c +1 -1
index 677f604..679885a 100644
@@ -1997,7 +1997,7 @@ static int e1000_clean(struct napi_struct *napi, int budget)
 	struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi);
 	struct e1000_hw *hw = &adapter->hw;
 	struct net_device *poll_dev = adapter->netdev;
-	int tx_cleaned = 0, work_done = 0;
+	int tx_cleaned = 1, work_done = 0;
 
 	adapter = netdev_priv(poll_dev);
 
Acked-by on v1 1/1
#1 lore raw
Quoted 32 lines · Andy Gospodarek

The last hunk of this commit:

commit 12d04a3c12b420f23398b4d650127642469a60a6
Author: Alexander Duyck <[email protected]>
Date: Wed Mar 25 22:05:03 2009 +0000

e1000e: commonize tx cleanup routine to match e1000 & igb

changed the logic for determining if we should call napi_complete or not at then end of a napi poll.

If the NIC is using MSI-X with no work to do in ->poll, net_rx_action can just spin indefinitely on older kernels and for 2 jiffies on newer kernels since napi_complete is never called and budget isn't decremented.

Discovered and verified while testing driver backport to an older kernel.

---

 netdev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/e1000e/netdev.c +0 -0
index 677f604..679885a 100644

drivers/net/e1000e/netdev.c static int e1000_clean(struct napi_struct *napi, int budget) · line 2003

Quoted 8 lines
drivers/net/e1000e/netdev.c +1 -1
@@ -1997,7 +1997,7 @@ static int e1000_clean(struct napi_struct *napi, int budget)
 	struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi);
 	struct e1000_hw *hw = &adapter->hw;
 	struct net_device *poll_dev = adapter->netdev;
-	int tx_cleaned = 0, work_done = 0;
+	int tx_cleaned = 1, work_done = 0;
 
 	adapter = netdev_priv(poll_dev);
 

This is most certainly a bug, and the fix is correct. The logic for tx_cleaned is supposed to default to true in the event that there are no
tx queues cleaned as part of the polling routine.

maintainer Applied
#2 lore raw

From: Alexander Duyck <[email protected]>
Date: Thu, 18 Jun 2009 15:06:36 -0700

Quoted 36 lines
Quoted 23 lines · Andy Gospodarek

The last hunk of this commit:
commit 12d04a3c12b420f23398b4d650127642469a60a6
Author: Alexander Duyck <[email protected]>
Date: Wed Mar 25 22:05:03 2009 +0000
e1000e: commonize tx cleanup routine to match e1000 & igb
changed the logic for determining if we should call napi_complete or not at then end of a napi poll.
If the NIC is using MSI-X with no work to do in ->poll, net_rx_action can just spin indefinitely on older kernels and for 2 jiffies on newer kernels since napi_complete is never called and budget isn't decremented.
Discovered and verified while testing driver backport to an older kernel.

---
 netdev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/e1000e/netdev.c +0 -0
index 677f604..679885a 100644

drivers/net/e1000e/netdev.c static int e1000_clean(struct napi_struct *napi, · line 2003

Quoted 8 lines
drivers/net/e1000e/netdev.c +1 -1
@@ -1997,7 +1997,7 @@ static int e1000_clean(struct napi_struct *napi,
 int budget)
 	struct e1000_adapter *adapter = container_of(napi, struct
 	e1000_adapter, napi);
 	struct e1000_hw *hw = &adapter->hw;
 	struct net_device *poll_dev = adapter->netdev;
-	int tx_cleaned = 0, work_done = 0;
+	int tx_cleaned = 1, work_done = 0;
  	adapter = netdev_priv(poll_dev);

This is most certainly a bug, and the fix is correct. The logic for tx_cleaned is supposed to default to true in the event that there are no tx queues cleaned as part of the polling routine.

Quoted 1 line

Applied, thanks.

#3 lore raw
Quoted 39 lines · David Miller

From: Alexander Duyck <[email protected]>
Date: Thu, 18 Jun 2009 15:06:36 -0700

Quoted 36 lines
Quoted 23 lines · Andy Gospodarek

The last hunk of this commit:
commit 12d04a3c12b420f23398b4d650127642469a60a6
Author: Alexander Duyck <[email protected]>
Date: Wed Mar 25 22:05:03 2009 +0000
e1000e: commonize tx cleanup routine to match e1000 & igb
changed the logic for determining if we should call napi_complete or not at then end of a napi poll.
If the NIC is using MSI-X with no work to do in ->poll, net_rx_action can just spin indefinitely on older kernels and for 2 jiffies on newer kernels since napi_complete is never called and budget isn't decremented.
Discovered and verified while testing driver backport to an older kernel.

---
 netdev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/e1000e/netdev.c +0 -0
index 677f604..679885a 100644

drivers/net/e1000e/netdev.c static int e1000_clean(struct napi_struct *napi, · line 2003

Quoted 8 lines
drivers/net/e1000e/netdev.c +1 -1
@@ -1997,7 +1997,7 @@ static int e1000_clean(struct napi_struct *napi,
 int budget)
 	struct e1000_adapter *adapter = container_of(napi, struct
 	e1000_adapter, napi);
 	struct e1000_hw *hw = &adapter->hw;
 	struct net_device *poll_dev = adapter->netdev;
-	int tx_cleaned = 0, work_done = 0;
+	int tx_cleaned = 1, work_done = 0;
  	adapter = netdev_priv(poll_dev);

This is most certainly a bug, and the fix is correct. The logic for tx_cleaned is supposed to default to true in the event that there are no tx queues cleaned as part of the polling routine.

Quoted 3 lines
Quoted 1 line

Applied, thanks.

Thanks, Dave.

I did some more testing with 2.6.30 and ksoftirqd uses 100% of the cpu once the device is up. With this patch it does not, so it should probably go into 2.6.29-stable as well.

maintainer
#4 lore raw

From: Andy Gospodarek <[email protected]>
Date: Fri, 19 Jun 2009 11:06:34 -0400

Quoted 3 lines

I did some more testing with 2.6.30 and ksoftirqd uses 100% of the cpu once the device is up. With this patch it does not, so it should probably go into 2.6.29-stable as well.

Ok, will queue it up.