Skip to content

Commit 841dfa4

Browse files
committed
Merge branch 'netpoll-avoid-capture-effects-for-NAPI-drivers'
Eric Dumazet says: ==================== netpoll: avoid capture effects for NAPI drivers As diagnosed by Song Liu, ndo_poll_controller() can be very dangerous on loaded hosts, since the cpu calling ndo_poll_controller() might steal all NAPI contexts (for all RX/TX queues of the NIC). This capture, showing one ksoftirqd eating all cycles can last for unlimited amount of time, since one cpu is generally not able to drain all the queues under load. It seems that all networking drivers that do use NAPI for their TX completions, should not provide a ndo_poll_controller() : Most NAPI drivers have netpoll support already handled in core networking stack, since netpoll_poll_dev() uses poll_napi(dev) to iterate through registered NAPI contexts for a device. This patch series take care of the first round, we will handle other drivers in future rounds. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 16fdf8b + 765cdc2 commit 841dfa4

File tree

18 files changed

+12
-339
lines changed

18 files changed

+12
-339
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -971,16 +971,13 @@ static void bond_poll_controller(struct net_device *bond_dev)
971971
struct slave *slave = NULL;
972972
struct list_head *iter;
973973
struct ad_info ad_info;
974-
struct netpoll_info *ni;
975-
const struct net_device_ops *ops;
976974

977975
if (BOND_MODE(bond) == BOND_MODE_8023AD)
978976
if (bond_3ad_get_active_agg_info(bond, &ad_info))
979977
return;
980978

981979
bond_for_each_slave_rcu(bond, slave, iter) {
982-
ops = slave->dev->netdev_ops;
983-
if (!bond_slave_is_up(slave) || !ops->ndo_poll_controller)
980+
if (!bond_slave_is_up(slave))
984981
continue;
985982

986983
if (BOND_MODE(bond) == BOND_MODE_8023AD) {
@@ -992,11 +989,7 @@ static void bond_poll_controller(struct net_device *bond_dev)
992989
continue;
993990
}
994991

995-
ni = rcu_dereference_bh(slave->dev->npinfo);
996-
if (down_trylock(&ni->dev_lock))
997-
continue;
998-
ops->ndo_poll_controller(slave->dev);
999-
up(&ni->dev_lock);
992+
netpoll_poll_dev(slave->dev);
1000993
}
1001994
}
1002995

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12894,19 +12894,6 @@ static int bnx2x_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1289412894
}
1289512895
}
1289612896

12897-
#ifdef CONFIG_NET_POLL_CONTROLLER
12898-
static void poll_bnx2x(struct net_device *dev)
12899-
{
12900-
struct bnx2x *bp = netdev_priv(dev);
12901-
int i;
12902-
12903-
for_each_eth_queue(bp, i) {
12904-
struct bnx2x_fastpath *fp = &bp->fp[i];
12905-
napi_schedule(&bnx2x_fp(bp, fp->index, napi));
12906-
}
12907-
}
12908-
#endif
12909-
1291012897
static int bnx2x_validate_addr(struct net_device *dev)
1291112898
{
1291212899
struct bnx2x *bp = netdev_priv(dev);
@@ -13113,9 +13100,6 @@ static const struct net_device_ops bnx2x_netdev_ops = {
1311313100
.ndo_tx_timeout = bnx2x_tx_timeout,
1311413101
.ndo_vlan_rx_add_vid = bnx2x_vlan_rx_add_vid,
1311513102
.ndo_vlan_rx_kill_vid = bnx2x_vlan_rx_kill_vid,
13116-
#ifdef CONFIG_NET_POLL_CONTROLLER
13117-
.ndo_poll_controller = poll_bnx2x,
13118-
#endif
1311913103
.ndo_setup_tc = __bnx2x_setup_tc,
1312013104
#ifdef CONFIG_BNX2X_SRIOV
1312113105
.ndo_set_vf_mac = bnx2x_set_vf_mac,

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7672,21 +7672,6 @@ static void bnxt_tx_timeout(struct net_device *dev)
76727672
bnxt_queue_sp_work(bp);
76737673
}
76747674

7675-
#ifdef CONFIG_NET_POLL_CONTROLLER
7676-
static void bnxt_poll_controller(struct net_device *dev)
7677-
{
7678-
struct bnxt *bp = netdev_priv(dev);
7679-
int i;
7680-
7681-
/* Only process tx rings/combined rings in netpoll mode. */
7682-
for (i = 0; i < bp->tx_nr_rings; i++) {
7683-
struct bnxt_tx_ring_info *txr = &bp->tx_ring[i];
7684-
7685-
napi_schedule(&txr->bnapi->napi);
7686-
}
7687-
}
7688-
#endif
7689-
76907675
static void bnxt_timer(struct timer_list *t)
76917676
{
76927677
struct bnxt *bp = from_timer(bp, t, timer);
@@ -8519,9 +8504,6 @@ static const struct net_device_ops bnxt_netdev_ops = {
85198504
.ndo_set_vf_link_state = bnxt_set_vf_link_state,
85208505
.ndo_set_vf_spoofchk = bnxt_set_vf_spoofchk,
85218506
.ndo_set_vf_trust = bnxt_set_vf_trust,
8522-
#endif
8523-
#ifdef CONFIG_NET_POLL_CONTROLLER
8524-
.ndo_poll_controller = bnxt_poll_controller,
85258507
#endif
85268508
.ndo_setup_tc = bnxt_setup_tc,
85278509
#ifdef CONFIG_RFS_ACCEL

drivers/net/ethernet/intel/fm10k/fm10k.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,6 @@ void fm10k_update_stats(struct fm10k_intfc *interface);
504504
void fm10k_service_event_schedule(struct fm10k_intfc *interface);
505505
void fm10k_macvlan_schedule(struct fm10k_intfc *interface);
506506
void fm10k_update_rx_drop_en(struct fm10k_intfc *interface);
507-
#ifdef CONFIG_NET_POLL_CONTROLLER
508-
void fm10k_netpoll(struct net_device *netdev);
509-
#endif
510507

511508
/* Netdev */
512509
struct net_device *fm10k_alloc_netdev(const struct fm10k_info *info);

drivers/net/ethernet/intel/fm10k/fm10k_netdev.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,9 +1648,6 @@ static const struct net_device_ops fm10k_netdev_ops = {
16481648
.ndo_udp_tunnel_del = fm10k_udp_tunnel_del,
16491649
.ndo_dfwd_add_station = fm10k_dfwd_add_station,
16501650
.ndo_dfwd_del_station = fm10k_dfwd_del_station,
1651-
#ifdef CONFIG_NET_POLL_CONTROLLER
1652-
.ndo_poll_controller = fm10k_netpoll,
1653-
#endif
16541651
.ndo_features_check = fm10k_features_check,
16551652
};
16561653

drivers/net/ethernet/intel/fm10k/fm10k_pci.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,28 +1210,6 @@ static irqreturn_t fm10k_msix_mbx_vf(int __always_unused irq, void *data)
12101210
return IRQ_HANDLED;
12111211
}
12121212

1213-
#ifdef CONFIG_NET_POLL_CONTROLLER
1214-
/**
1215-
* fm10k_netpoll - A Polling 'interrupt' handler
1216-
* @netdev: network interface device structure
1217-
*
1218-
* This is used by netconsole to send skbs without having to re-enable
1219-
* interrupts. It's not called while the normal interrupt routine is executing.
1220-
**/
1221-
void fm10k_netpoll(struct net_device *netdev)
1222-
{
1223-
struct fm10k_intfc *interface = netdev_priv(netdev);
1224-
int i;
1225-
1226-
/* if interface is down do nothing */
1227-
if (test_bit(__FM10K_DOWN, interface->state))
1228-
return;
1229-
1230-
for (i = 0; i < interface->num_q_vectors; i++)
1231-
fm10k_msix_clean_rings(0, interface->q_vector[i]);
1232-
}
1233-
1234-
#endif
12351213
#define FM10K_ERR_MSG(type) case (type): error = #type; break
12361214
static void fm10k_handle_fault(struct fm10k_intfc *interface, int type,
12371215
struct fm10k_fault *fault)

drivers/net/ethernet/intel/i40evf/i40evf_main.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -396,29 +396,6 @@ static void i40evf_map_rings_to_vectors(struct i40evf_adapter *adapter)
396396
adapter->aq_required |= I40EVF_FLAG_AQ_MAP_VECTORS;
397397
}
398398

399-
#ifdef CONFIG_NET_POLL_CONTROLLER
400-
/**
401-
* i40evf_netpoll - A Polling 'interrupt' handler
402-
* @netdev: network interface device structure
403-
*
404-
* This is used by netconsole to send skbs without having to re-enable
405-
* interrupts. It's not called while the normal interrupt routine is executing.
406-
**/
407-
static void i40evf_netpoll(struct net_device *netdev)
408-
{
409-
struct i40evf_adapter *adapter = netdev_priv(netdev);
410-
int q_vectors = adapter->num_msix_vectors - NONQ_VECS;
411-
int i;
412-
413-
/* if interface is down do nothing */
414-
if (test_bit(__I40E_VSI_DOWN, adapter->vsi.state))
415-
return;
416-
417-
for (i = 0; i < q_vectors; i++)
418-
i40evf_msix_clean_rings(0, &adapter->q_vectors[i]);
419-
}
420-
421-
#endif
422399
/**
423400
* i40evf_irq_affinity_notify - Callback for affinity changes
424401
* @notify: context as to what irq was changed
@@ -3229,9 +3206,6 @@ static const struct net_device_ops i40evf_netdev_ops = {
32293206
.ndo_features_check = i40evf_features_check,
32303207
.ndo_fix_features = i40evf_fix_features,
32313208
.ndo_set_features = i40evf_set_features,
3232-
#ifdef CONFIG_NET_POLL_CONTROLLER
3233-
.ndo_poll_controller = i40evf_netpoll,
3234-
#endif
32353209
.ndo_setup_tc = i40evf_setup_tc,
32363210
};
32373211

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4806,30 +4806,6 @@ void ice_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats)
48064806
stats->rx_length_errors = vsi_stats->rx_length_errors;
48074807
}
48084808

4809-
#ifdef CONFIG_NET_POLL_CONTROLLER
4810-
/**
4811-
* ice_netpoll - polling "interrupt" handler
4812-
* @netdev: network interface device structure
4813-
*
4814-
* Used by netconsole to send skbs without having to re-enable interrupts.
4815-
* This is not called in the normal interrupt path.
4816-
*/
4817-
static void ice_netpoll(struct net_device *netdev)
4818-
{
4819-
struct ice_netdev_priv *np = netdev_priv(netdev);
4820-
struct ice_vsi *vsi = np->vsi;
4821-
struct ice_pf *pf = vsi->back;
4822-
int i;
4823-
4824-
if (test_bit(__ICE_DOWN, vsi->state) ||
4825-
!test_bit(ICE_FLAG_MSIX_ENA, pf->flags))
4826-
return;
4827-
4828-
for (i = 0; i < vsi->num_q_vectors; i++)
4829-
ice_msix_clean_rings(0, vsi->q_vectors[i]);
4830-
}
4831-
#endif /* CONFIG_NET_POLL_CONTROLLER */
4832-
48334809
/**
48344810
* ice_napi_disable_all - Disable NAPI for all q_vectors in the VSI
48354811
* @vsi: VSI having NAPI disabled
@@ -5497,9 +5473,6 @@ static const struct net_device_ops ice_netdev_ops = {
54975473
.ndo_validate_addr = eth_validate_addr,
54985474
.ndo_change_mtu = ice_change_mtu,
54995475
.ndo_get_stats64 = ice_get_stats64,
5500-
#ifdef CONFIG_NET_POLL_CONTROLLER
5501-
.ndo_poll_controller = ice_netpoll,
5502-
#endif /* CONFIG_NET_POLL_CONTROLLER */
55035476
.ndo_vlan_rx_add_vid = ice_vlan_rx_add_vid,
55045477
.ndo_vlan_rx_kill_vid = ice_vlan_rx_kill_vid,
55055478
.ndo_set_features = ice_set_features,

drivers/net/ethernet/intel/igb/igb_main.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,6 @@ static struct notifier_block dca_notifier = {
205205
.priority = 0
206206
};
207207
#endif
208-
#ifdef CONFIG_NET_POLL_CONTROLLER
209-
/* for netdump / net console */
210-
static void igb_netpoll(struct net_device *);
211-
#endif
212208
#ifdef CONFIG_PCI_IOV
213209
static unsigned int max_vfs;
214210
module_param(max_vfs, uint, 0);
@@ -2881,9 +2877,6 @@ static const struct net_device_ops igb_netdev_ops = {
28812877
.ndo_set_vf_spoofchk = igb_ndo_set_vf_spoofchk,
28822878
.ndo_set_vf_trust = igb_ndo_set_vf_trust,
28832879
.ndo_get_vf_config = igb_ndo_get_vf_config,
2884-
#ifdef CONFIG_NET_POLL_CONTROLLER
2885-
.ndo_poll_controller = igb_netpoll,
2886-
#endif
28872880
.ndo_fix_features = igb_fix_features,
28882881
.ndo_set_features = igb_set_features,
28892882
.ndo_fdb_add = igb_ndo_fdb_add,
@@ -9053,29 +9046,6 @@ static int igb_pci_sriov_configure(struct pci_dev *dev, int num_vfs)
90539046
return 0;
90549047
}
90559048

9056-
#ifdef CONFIG_NET_POLL_CONTROLLER
9057-
/* Polling 'interrupt' - used by things like netconsole to send skbs
9058-
* without having to re-enable interrupts. It's not called while
9059-
* the interrupt routine is executing.
9060-
*/
9061-
static void igb_netpoll(struct net_device *netdev)
9062-
{
9063-
struct igb_adapter *adapter = netdev_priv(netdev);
9064-
struct e1000_hw *hw = &adapter->hw;
9065-
struct igb_q_vector *q_vector;
9066-
int i;
9067-
9068-
for (i = 0; i < adapter->num_q_vectors; i++) {
9069-
q_vector = adapter->q_vector[i];
9070-
if (adapter->flags & IGB_FLAG_HAS_MSIX)
9071-
wr32(E1000_EIMC, q_vector->eims_value);
9072-
else
9073-
igb_irq_disable(adapter);
9074-
napi_schedule(&q_vector->napi);
9075-
}
9076-
}
9077-
#endif /* CONFIG_NET_POLL_CONTROLLER */
9078-
90799049
/**
90809050
* igb_io_error_detected - called when PCI error is detected
90819051
* @pdev: Pointer to PCI device

drivers/net/ethernet/intel/ixgb/ixgb_main.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,6 @@ static int ixgb_vlan_rx_kill_vid(struct net_device *netdev,
8181
__be16 proto, u16 vid);
8282
static void ixgb_restore_vlan(struct ixgb_adapter *adapter);
8383

84-
#ifdef CONFIG_NET_POLL_CONTROLLER
85-
/* for netdump / net console */
86-
static void ixgb_netpoll(struct net_device *dev);
87-
#endif
88-
8984
static pci_ers_result_t ixgb_io_error_detected (struct pci_dev *pdev,
9085
enum pci_channel_state state);
9186
static pci_ers_result_t ixgb_io_slot_reset (struct pci_dev *pdev);
@@ -348,9 +343,6 @@ static const struct net_device_ops ixgb_netdev_ops = {
348343
.ndo_tx_timeout = ixgb_tx_timeout,
349344
.ndo_vlan_rx_add_vid = ixgb_vlan_rx_add_vid,
350345
.ndo_vlan_rx_kill_vid = ixgb_vlan_rx_kill_vid,
351-
#ifdef CONFIG_NET_POLL_CONTROLLER
352-
.ndo_poll_controller = ixgb_netpoll,
353-
#endif
354346
.ndo_fix_features = ixgb_fix_features,
355347
.ndo_set_features = ixgb_set_features,
356348
};
@@ -2195,23 +2187,6 @@ ixgb_restore_vlan(struct ixgb_adapter *adapter)
21952187
ixgb_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid);
21962188
}
21972189

2198-
#ifdef CONFIG_NET_POLL_CONTROLLER
2199-
/*
2200-
* Polling 'interrupt' - used by things like netconsole to send skbs
2201-
* without having to re-enable interrupts. It's not called while
2202-
* the interrupt routine is executing.
2203-
*/
2204-
2205-
static void ixgb_netpoll(struct net_device *dev)
2206-
{
2207-
struct ixgb_adapter *adapter = netdev_priv(dev);
2208-
2209-
disable_irq(adapter->pdev->irq);
2210-
ixgb_intr(adapter->pdev->irq, dev);
2211-
enable_irq(adapter->pdev->irq);
2212-
}
2213-
#endif
2214-
22152190
/**
22162191
* ixgb_io_error_detected - called when PCI error is detected
22172192
* @pdev: pointer to pci device with error

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8768,28 +8768,6 @@ static int ixgbe_del_sanmac_netdev(struct net_device *dev)
87688768
return err;
87698769
}
87708770

8771-
#ifdef CONFIG_NET_POLL_CONTROLLER
8772-
/*
8773-
* Polling 'interrupt' - used by things like netconsole to send skbs
8774-
* without having to re-enable interrupts. It's not called while
8775-
* the interrupt routine is executing.
8776-
*/
8777-
static void ixgbe_netpoll(struct net_device *netdev)
8778-
{
8779-
struct ixgbe_adapter *adapter = netdev_priv(netdev);
8780-
int i;
8781-
8782-
/* if interface is down do nothing */
8783-
if (test_bit(__IXGBE_DOWN, &adapter->state))
8784-
return;
8785-
8786-
/* loop through and schedule all active queues */
8787-
for (i = 0; i < adapter->num_q_vectors; i++)
8788-
ixgbe_msix_clean_rings(0, adapter->q_vector[i]);
8789-
}
8790-
8791-
#endif
8792-
87938771
static void ixgbe_get_ring_stats64(struct rtnl_link_stats64 *stats,
87948772
struct ixgbe_ring *ring)
87958773
{
@@ -10251,9 +10229,6 @@ static const struct net_device_ops ixgbe_netdev_ops = {
1025110229
.ndo_get_vf_config = ixgbe_ndo_get_vf_config,
1025210230
.ndo_get_stats64 = ixgbe_get_stats64,
1025310231
.ndo_setup_tc = __ixgbe_setup_tc,
10254-
#ifdef CONFIG_NET_POLL_CONTROLLER
10255-
.ndo_poll_controller = ixgbe_netpoll,
10256-
#endif
1025710232
#ifdef IXGBE_FCOE
1025810233
.ndo_select_queue = ixgbe_select_queue,
1025910234
.ndo_fcoe_ddp_setup = ixgbe_fcoe_ddp_get,

drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4233,24 +4233,6 @@ static int ixgbevf_change_mtu(struct net_device *netdev, int new_mtu)
42334233
return 0;
42344234
}
42354235

4236-
#ifdef CONFIG_NET_POLL_CONTROLLER
4237-
/* Polling 'interrupt' - used by things like netconsole to send skbs
4238-
* without having to re-enable interrupts. It's not called while
4239-
* the interrupt routine is executing.
4240-
*/
4241-
static void ixgbevf_netpoll(struct net_device *netdev)
4242-
{
4243-
struct ixgbevf_adapter *adapter = netdev_priv(netdev);
4244-
int i;
4245-
4246-
/* if interface is down do nothing */
4247-
if (test_bit(__IXGBEVF_DOWN, &adapter->state))
4248-
return;
4249-
for (i = 0; i < adapter->num_rx_queues; i++)
4250-
ixgbevf_msix_clean_rings(0, adapter->q_vector[i]);
4251-
}
4252-
#endif /* CONFIG_NET_POLL_CONTROLLER */
4253-
42544236
static int ixgbevf_suspend(struct pci_dev *pdev, pm_message_t state)
42554237
{
42564238
struct net_device *netdev = pci_get_drvdata(pdev);
@@ -4482,9 +4464,6 @@ static const struct net_device_ops ixgbevf_netdev_ops = {
44824464
.ndo_tx_timeout = ixgbevf_tx_timeout,
44834465
.ndo_vlan_rx_add_vid = ixgbevf_vlan_rx_add_vid,
44844466
.ndo_vlan_rx_kill_vid = ixgbevf_vlan_rx_kill_vid,
4485-
#ifdef CONFIG_NET_POLL_CONTROLLER
4486-
.ndo_poll_controller = ixgbevf_netpoll,
4487-
#endif
44884467
.ndo_features_check = ixgbevf_features_check,
44894468
.ndo_bpf = ixgbevf_xdp,
44904469
};

0 commit comments

Comments
 (0)