Skip to contentSkip to conversation

be2net: call napi_disable() for all event queues

PATCH Superseded Ivan Vecera 3 participants 4 messages Nov 26, 2013 – Nov 27, 2013

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 be2net: call napi_disable() for all event queues

The recent be2net commit 6384a4d (adds a support for busy polling) introduces a regression that results in kernel crash. It incorrectly modified be_close() so napi_disable() is called only for the first queue. This breaks a correct pairing of napi_enable/_disable for the rest of event queues and causes a crash in subsequent be_open() call.

Cc Sathya Perla <[email protected]>
Cc Subbu Seetharaman <[email protected]>
Cc Ajit Khaparde <[email protected]>
---
 drivers/net/ethernet/emulex/benet/be_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/emulex/benet/be_main.c +1 -1
index 78a0e85..0aec4d2 100644
@@ -2663,8 +2663,8 @@ static int be_close(struct net_device *netdev)
 			napi_disable(&eqo->napi);
 			be_disable_busy_poll(eqo);
 		}
-		adapter->flags &= ~BE_FLAGS_NAPI_ENABLED;
 	}
+	adapter->flags &= ~BE_FLAGS_NAPI_ENABLED;
 
 	be_async_mcc_disable(adapter);
 
Signature · 1 line
1.8.3.2
Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines

-----Original Message-----
From: Ivan Vecera [mailto:[email protected]]
Sent: Tuesday, November 26, 2013 10:55 AM
To: [email protected]
Cc: Sathya Perla; Subramanian Seetharaman; Ajit Khaparde
Subject: [PATCH net] be2net: call napi_disable() for all event queues

The recent be2net commit 6384a4d (adds a support for busy polling) introduces a regression that results in kernel crash. It incorrectly modified be_close() so napi_disable() is called only for the first queue. This breaks a correct pairing of napi_enable/_disable for the rest of event queues and causes a crash in subsequent be_open() call.

Quoted 4 lines
Cc Sathya Perla <[email protected]>
Cc Subbu Seetharaman <[email protected]>
Cc Ajit Khaparde <[email protected]>
Quoted 21 lines
---
 drivers/net/ethernet/emulex/benet/be_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/emulex/benet/be_main.c +1 -2
index 78a0e85..0aec4d2 100644
@@ -2663,8 +2663,8 @@ static int be_close(struct net_device *netdev)
 			napi_disable(&eqo->napi);
 			be_disable_busy_poll(eqo);
 		}
-		adapter->flags &= ~BE_FLAGS_NAPI_ENABLED;
 	}
+	adapter->flags &= ~BE_FLAGS_NAPI_ENABLED;
 
 	be_async_mcc_disable(adapter);
 
--

1.8.3.2

#2 lore raw
In reply to Ivan Vecera
Quoted 23 lines

-----Original Message-----
From: Ivan Vecera [mailto:[email protected]]

The recent be2net commit 6384a4d (adds a support for busy polling) introduces a regression that results in kernel crash. It incorrectly modified be_close() so napi_disable() is called only for the first queue. This breaks a correct pairing of napi_enable/_disable for the rest of event queues and causes a crash in subsequent be_open() call.

Cc Sathya Perla <[email protected]>
Cc Subbu Seetharaman <[email protected]>
Cc Ajit Khaparde <[email protected]>
---
 drivers/net/ethernet/emulex/benet/be_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/emulex/benet/be_main.c +0 -0
index 78a0e85..0aec4d2 100644

drivers/net/ethernet/emulex/benet/be_main.c static int be_close(struct net_device *netdev) · line 2668

Quoted 7 lines
drivers/net/ethernet/emulex/benet/be_main.c +1 -1
@@ -2663,8 +2663,8 @@ static int be_close(struct net_device *netdev)
 			napi_disable(&eqo->napi);
 			be_disable_busy_poll(eqo);
 		}
-		adapter->flags &= ~BE_FLAGS_NAPI_ENABLED;
 	}
+	adapter->flags &= ~BE_FLAGS_NAPI_ENABLED;
 

Ivan, Thanks for spotting this.
Your fix is correct but it'll be nice if the for-loop for napi_disable is not even entered when FLAGS_NAPI_ENABLED is not set, as in:

drivers/net/ethernet/emulex/benet/be_main.c +2 -2
index 603b662..40d2adb 100644
@@ -2658,8 +2658,8 @@ static int be_close(struct net_device *netdev)
 
 	be_roce_dev_close(adapter);
 
-	for_all_evt_queues(adapter, eqo, i) {
-		if (adapter->flags & BE_FLAGS_NAPI_ENABLED) {
+	if (adapter->flags & BE_FLAGS_NAPI_ENABLED) {
+		for_all_evt_queues(adapter, eqo, i) {
 			napi_disable(&eqo->napi);
 			be_disable_busy_poll(eqo);
 		}

Could you also add the following line to your patch as it fixes a regression caused by an older be2net commit:

Fixes 6384a4d0dcf9 ("be2net: add support for ndo_busy_poll")

-Sathya

#3 lore raw
Quoted 51 lines · Sathya Perla
Quoted 23 lines

-----Original Message-----
From: Ivan Vecera [mailto:[email protected]]

The recent be2net commit 6384a4d (adds a support for busy polling) introduces a regression that results in kernel crash. It incorrectly modified be_close() so napi_disable() is called only for the first queue. This breaks a correct pairing of napi_enable/_disable for the rest of event queues and causes a crash in subsequent be_open() call.

Cc Sathya Perla <[email protected]>
Cc Subbu Seetharaman <[email protected]>
Cc Ajit Khaparde <[email protected]>
---
  drivers/net/ethernet/emulex/benet/be_main.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/emulex/benet/be_main.c +0 -0
index 78a0e85..0aec4d2 100644

drivers/net/ethernet/emulex/benet/be_main.c static int be_close(struct net_device *netdev) · line 2668

Quoted 7 lines
drivers/net/ethernet/emulex/benet/be_main.c +1 -1
@@ -2663,8 +2663,8 @@ static int be_close(struct net_device *netdev)
  			napi_disable(&eqo->napi);
  			be_disable_busy_poll(eqo);
  		}
-		adapter->flags &= ~BE_FLAGS_NAPI_ENABLED;
  	}
+	adapter->flags &= ~BE_FLAGS_NAPI_ENABLED;
 

Ivan, Thanks for spotting this.
Your fix is correct but it'll be nice if the for-loop for napi_disable is not even entered when FLAGS_NAPI_ENABLED is not set, as in:

drivers/net/ethernet/emulex/benet/be_main.c +2 -2
index 603b662..40d2adb 100644
@@ -2658,8 +2658,8 @@ static int be_close(struct net_device *netdev)
 
  	be_roce_dev_close(adapter);
 
-	for_all_evt_queues(adapter, eqo, i) {
-		if (adapter->flags & BE_FLAGS_NAPI_ENABLED) {
+	if (adapter->flags & BE_FLAGS_NAPI_ENABLED) {
+		for_all_evt_queues(adapter, eqo, i) {
  			napi_disable(&eqo->napi);
  			be_disable_busy_poll(eqo);
  		}
Quoted 4 lines

Could you also add the following line to your patch as it fixes a regression caused by an older be2net commit:

Fixes 6384a4d0dcf9 ("be2net: add support for ndo_busy_poll")

Sure, I'm sending v2.

Ivan