Skip to contentSkip to conversation

ice: lag: in RCU, use atomic allocation

PATCH In review Michal Schmidt 4 participants 4 messages Oct 23, 2023 – Nov 4, 2023

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

PATCH 1/1 ice: lag: in RCU, use atomic allocation

Sleeping is not allowed in RCU read-side critical sections. Use atomic allocations under rcu_read_lock.

Fixes 1e0f9881ef79 ("ice: Flesh out implementation of support for SRIOV on bonded interface")
Fixes 41ccedf5ca8f ("ice: implement lag netdev event handler")
Fixes 3579aa86fb40 ("ice: update reset path for SRIOV LAG support")
---
 drivers/net/ethernet/intel/ice/ice_lag.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_lag.c +3 -3
index 7b1256992dcf..33f01420eece 100644
@@ -595,7 +595,7 @@ void ice_lag_move_new_vf_nodes(struct ice_vf *vf)
 		INIT_LIST_HEAD(&ndlist.node);
 		rcu_read_lock();
 		for_each_netdev_in_bond_rcu(lag->upper_netdev, tmp_nd) {
-			nl = kzalloc(sizeof(*nl), GFP_KERNEL);
+			nl = kzalloc(sizeof(*nl), GFP_ATOMIC);
 			if (!nl)
 				break;
 
@@ -1672,7 +1672,7 @@ ice_lag_event_handler(struct notifier_block *notif_blk, unsigned long event,
 
 		rcu_read_lock();
 		for_each_netdev_in_bond_rcu(upper_netdev, tmp_nd) {
-			nd_list = kzalloc(sizeof(*nd_list), GFP_KERNEL);
+			nd_list = kzalloc(sizeof(*nd_list), GFP_ATOMIC);
 			if (!nd_list)
 				break;
 
@@ -2046,7 +2046,7 @@ void ice_lag_rebuild(struct ice_pf *pf)
 		INIT_LIST_HEAD(&ndlist.node);
 		rcu_read_lock();
 		for_each_netdev_in_bond_rcu(lag->upper_netdev, tmp_nd) {
-			nl = kzalloc(sizeof(*nl), GFP_KERNEL);
+			nl = kzalloc(sizeof(*nl), GFP_ATOMIC);
 			if (!nl)
 				break;
 
Signature · 1 line
2.41.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines

-----Original Message-----
From: Michal Schmidt <[email protected]>
Sent: Monday, October 23, 2023 1:00 PM
To: [email protected]
Cc: Ertman, David M <[email protected]>; Daniel Machon <[email protected]>; Nguyen, Anthony L <[email protected]>; Brandeburg, Jesse <[email protected]>; [email protected]
Subject: [PATCH net] ice: lag: in RCU, use atomic allocation

Quoted 7 lines

Sleeping is not allowed in RCU read-side critical sections. Use atomic allocations under rcu_read_lock.

Fixes 1e0f9881ef79 ("ice: Flesh out implementation of support for SRIOV on bonded interface")
Fixes 41ccedf5ca8f ("ice: implement lag netdev event handler")
Fixes 3579aa86fb40 ("ice: update reset path for SRIOV LAG support")

Thanks Michal

Quoted 38 lines
---
 drivers/net/ethernet/intel/ice/ice_lag.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_lag.c +3 -4
index 7b1256992dcf..33f01420eece 100644
@@ -595,7 +595,7 @@ void ice_lag_move_new_vf_nodes(struct ice_vf *vf)
 		INIT_LIST_HEAD(&ndlist.node);
 		rcu_read_lock();
 		for_each_netdev_in_bond_rcu(lag->upper_netdev, tmp_nd) {
-			nl = kzalloc(sizeof(*nl), GFP_KERNEL);
+			nl = kzalloc(sizeof(*nl), GFP_ATOMIC);
 			if (!nl)
 				break;
 
@@ -1672,7 +1672,7 @@ ice_lag_event_handler(struct notifier_block *notif_blk, unsigned long event,
 
 		rcu_read_lock();
 		for_each_netdev_in_bond_rcu(upper_netdev, tmp_nd) {
-			nd_list = kzalloc(sizeof(*nd_list), GFP_KERNEL);
+			nd_list = kzalloc(sizeof(*nd_list), GFP_ATOMIC);
 			if (!nd_list)
 				break;
 
@@ -2046,7 +2046,7 @@ void ice_lag_rebuild(struct ice_pf *pf)
 		INIT_LIST_HEAD(&ndlist.node);
 		rcu_read_lock();
 		for_each_netdev_in_bond_rcu(lag->upper_netdev, tmp_nd) {
-			nl = kzalloc(sizeof(*nl), GFP_KERNEL);
+			nl = kzalloc(sizeof(*nl), GFP_ATOMIC);
 			if (!nl)
 				break;
 
--

2.41.0

Tested-by on v1 1/1
#2 lore raw
In reply to Michal Schmidt
Quoted 10 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Schmidt
Sent: Monday, October 23, 2023 4:30 PM
To: [email protected]
Cc: Ertman, David M <[email protected]>; [email protected]; Nguyen, Anthony L <[email protected]>; Daniel Machon <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: [Intel-wired-lan] [PATCH net] ice: lag: in RCU, use atomic allocation

Sleeping is not allowed in RCU read-side critical sections. Use atomic allocations under rcu_read_lock.

Quoted 8 lines
Fixes 1e0f9881ef79 ("ice: Flesh out implementation of support for SRIOV on bonded interface")
Fixes 41ccedf5ca8f ("ice: implement lag netdev event handler")
Fixes 3579aa86fb40 ("ice: update reset path for SRIOV LAG support")
---
 drivers/net/ethernet/intel/ice/ice_lag.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
reviewer Reviewed-by on v1 1/1
#3 lore raw
In reply to Michal Schmidt
Quoted 7 lines · Michal Schmidt

Sleeping is not allowed in RCU read-side critical sections. Use atomic allocations under rcu_read_lock.

Fixes 1e0f9881ef79 ("ice: Flesh out implementation of support for SRIOV on bonded interface")
Fixes 41ccedf5ca8f ("ice: implement lag netdev event handler")
Fixes 3579aa86fb40 ("ice: update reset path for SRIOV LAG support")