netpoll: second round of fixes.
Subsystems (11)
cover netpoll: second round of fixes.
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.
First patch is a fix in poll_one_napi().
Then following patches take care of ten drivers.
Eric Dumazet (11):
netpoll: do not test NAPI_STATE_SCHED in poll_one_napi()
hinic: remove ndo_poll_controller
ehea: remove ndo_poll_controller
net: hns: remove ndo_poll_controller
virtio_net: remove ndo_poll_controller
qlcnic: remove ndo_poll_controller
qlogic: netxen: remove ndo_poll_controller
net: ena: remove ndo_poll_controller
sfc: remove ndo_poll_controller
sfc-falcon: remove ndo_poll_controller
ibmvnic: remove ndo_poll_controller
drivers/net/ethernet/amazon/ena/ena_netdev.c | 22 --------- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 18 -------- .../net/ethernet/huawei/hinic/hinic_main.c | 20 --------- drivers/net/ethernet/ibm/ehea/ehea_main.c | 14 ------ drivers/net/ethernet/ibm/ibmvnic.c | 16 ------- .../ethernet/qlogic/netxen/netxen_nic_main.c | 23 ---------- .../net/ethernet/qlogic/qlcnic/qlcnic_main.c | 45 ------------------- drivers/net/ethernet/sfc/efx.c | 26 ----------- drivers/net/ethernet/sfc/falcon/efx.c | 26 ----------- drivers/net/virtio_net.c | 14 ------ net/core/netpoll.c | 20 +-------- 11 files changed, 1 insertion(+), 243 deletions(-)
Signature · 1 line
2.19.0.605.g01d371f741-goog
PATCH 1/11 netpoll: do not test NAPI_STATE_SCHED in poll_one_napi()
Since we do no longer require NAPI drivers to provide an ndo_poll_controller(), napi_schedule() has not been done before poll_one_napi() invocation.
So testing NAPI_STATE_SCHED is likely to cause early returns.
While we are at it, remove outdated comment.
Note to future bisections : This change might surface prior bugs in drivers. See commit 73f21c653f93 ("bnxt_en: Fix TX timeout during netpoll.") for one occurrence.
--- net/core/netpoll.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-)
net/core/netpoll.c +1 -19
@@ -135,27 +135,9 @@ static void queue_process(struct work_struct *work) } } -/* -* Check whether delayed processing was scheduled for our NIC. If so, -* we attempt to grab the poll lock and use ->poll() to pump the card. -* If this fails, either we've recursed in ->poll() or it's already -* running on another CPU. -* -* Note: we don't mask interrupts with this lock because we're using -* trylock here and interrupts are already disabled in the softirq -* case. Further, we test the poll_owner to avoid recursion on UP -* systems where the lock doesn't exist. -*/ static void poll_one_napi (struct napi_struct *napi) { -int work =0 ; - -/* net_rx_action's ->poll() invocations and our's are -* synchronized by this test which is only made while -* holding the napi->poll_lock. -*/ -if (!test_bit (NAPI_STATE_SCHED , &napi->state)) -return ; +int work;/* If we set this bit but see that it has already been set, * that indicates that napi has been disabled and we need
Signature · 1 line
2.19.0.605.g01d371f741-goog
Re: [PATCH net 01/11] netpoll: do not test NAPI_STATE_SCHED in poll_one_napi()
Quoted 9 lines · Eric Dumazet
Since we do no longer require NAPI drivers to provide an
ndo_poll_controller(),napi_schedule()has not been done beforepoll_one_napi()invocation.So testing
NAPI_STATE_SCHEDis likely to cause early returns.While we are at it, remove outdated comment.
Quoted 8 lines
Note to future bisections : This change might surface prior bugs in drivers. See commit
73f21c653f93("bnxt_en: Fix TX timeout during netpoll.") for one occurrence.Fixes ac3d9dd034e5 ("netpoll: make ndo_poll_controller() optional")Signed-off-by Eric Dumazet <[email protected]>Tested-by Song Liu <[email protected]>Cc Michael Chan <[email protected]>
Re: [PATCH net 01/11] netpoll: do not test NAPI_STATE_SCHED in poll_one_napi()
Quoted 18 lines · Michael Chan
Quoted 13 lines · Eric Dumazet
Since we do no longer require NAPI drivers to provide an
ndo_poll_controller(),napi_schedule()has not been done beforepoll_one_napi()invocation.So testing
NAPI_STATE_SCHEDis likely to cause early returns.While we are at it, remove outdated comment.
Note to future bisections : This change might surface prior bugs in drivers. See commit
73f21c653f93("bnxt_en: Fix TX timeout during netpoll.") for one occurrence.
Quoted 6 lines
Quoted 4 lines
Fixes ac3d9dd034e5 ("netpoll: make ndo_poll_controller() optional")Signed-off-by Eric Dumazet <[email protected]>Tested-by Song Liu <[email protected]>Cc Michael Chan <[email protected]>Reviewed-and-tested-by Michael Chan <[email protected]>
PATCH 2/11 hinic: remove ndo_poll_controller
In reply to Eric DumazetAs 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 can last for unlimited amount of time, since one cpu is generally not able to drain all the queues under load.
hinic uses NAPI for TX completions, so we better let core networking stack call the napi->poll() to avoid the capture.
Note that hinic_netpoll() was incorrectly scheduling NAPI on both RX and TX queues.
--- .../net/ethernet/huawei/hinic/hinic_main.c | 20 ------------------- 1 file changed, 20 deletions(-)
drivers/net/ethernet/huawei/hinic/hinic_main.c +0 -20
@@ -789,23 +789,6 @@ static void hinic_get_stats64(struct net_device *netdev, stats->tx_errors = nic_tx_stats->tx_dropped; } -#ifdef CONFIG_NET_POLL_CONTROLLER -static void hinic_netpoll (struct net_device *netdev) -{ -struct hinic_dev *nic_dev =netdev_priv (netdev); -int i, num_qps; - - num_qps =hinic_hwdev_num_qps (nic_dev->hwdev); -for (i =0 ; i < num_qps; i++) { -struct hinic_txq *txq = &nic_dev->txqs[i]; -struct hinic_rxq *rxq = &nic_dev->rxqs[i]; - -napi_schedule (&txq->napi); -napi_schedule (&rxq->napi); - } -} -#endif -static const struct net_device_ops hinic_netdev_ops = { .ndo_open = hinic_open, .ndo_stop = hinic_close,
@@ -818,9 +801,6 @@ static const struct net_device_ops hinic_netdev_ops = { .ndo_start_xmit = hinic_xmit_frame, .ndo_tx_timeout = hinic_tx_timeout, .ndo_get_stats64 = hinic_get_stats64, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = hinic_netpoll, -#endif };static void netdev_features_init (struct net_device *netdev)
Signature · 1 line
2.19.0.605.g01d371f741-goog
PATCH 3/11 ehea: remove ndo_poll_controller
In reply to Eric DumazetAs 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 can last for unlimited amount of time, since one cpu is generally not able to drain all the queues under load.
ehea uses NAPI for TX completions, so we better let core networking stack call the napi->poll() to avoid the capture.
--- drivers/net/ethernet/ibm/ehea/ehea_main.c | 14 -------------- 1 file changed, 14 deletions(-)
drivers/net/ethernet/ibm/ehea/ehea_main.c +0 -14
@@ -921,17 +921,6 @@ static int ehea_poll(struct napi_struct *napi, int budget)return rx; } -#ifdef CONFIG_NET_POLL_CONTROLLER -static void ehea_netpoll (struct net_device *dev) -{ -struct ehea_port *port =netdev_priv (dev); -int i; - -for (i =0 ; i < port->num_def_qps; i++) -napi_schedule (&port->port_res[i].napi); -} -#endif -static irqreturn_t ehea_recv_irq_handler (int irq,void *param) {struct ehea_port_res *pr = param;
@@ -2953,9 +2942,6 @@ static const struct net_device_ops ehea_netdev_ops = { .ndo_open = ehea_open, .ndo_stop = ehea_stop, .ndo_start_xmit = ehea_start_xmit, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = ehea_netpoll, -#endif .ndo_get_stats64 = ehea_get_stats64, .ndo_set_mac_address = ehea_set_mac_addr, .ndo_validate_addr = eth_validate_addr,
Signature · 1 line
2.19.0.605.g01d371f741-goog
PATCH 4/11 net: hns: remove ndo_poll_controller
In reply to Eric DumazetAs 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 can last for unlimited amount of time, since one cpu is generally not able to drain all the queues under load.
hns uses NAPI for TX completions, so we better let core networking stack call the napi->poll() to avoid the capture.
--- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 18 ------------------ 1 file changed, 18 deletions(-)
drivers/net/ethernet/hisilicon/hns/hns_enet.c +0 -18
@@ -1503,21 +1503,6 @@ static int hns_nic_do_ioctl(struct net_device *netdev, struct ifreq *ifr,return phy_mii_ioctl (phy_dev, ifr, cmd); } -/* use only for netconsole to poll with the device without interrupt */ -#ifdef CONFIG_NET_POLL_CONTROLLER -static void hns_nic_poll_controller (struct net_device *ndev) -{ -struct hns_nic_priv *priv =netdev_priv (ndev); -unsigned long flags; -int i; - -local_irq_save (flags); -for (i =0 ; i < priv->ae_handle->q_num *2 ; i++) -napi_schedule (&priv->ring_data[i].napi); -local_irq_restore (flags); -} -#endif -static netdev_tx_t hns_nic_net_xmit (struct sk_buff *skb,struct net_device *ndev) {
@@ -1970,9 +1955,6 @@ static const struct net_device_ops hns_nic_netdev_ops = { .ndo_set_features = hns_nic_set_features, .ndo_fix_features = hns_nic_fix_features, .ndo_get_stats64 = hns_nic_get_stats64, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = hns_nic_poll_controller, -#endif .ndo_set_rx_mode = hns_nic_set_rx_mode, .ndo_select_queue = hns_nic_select_queue, };
Signature · 1 line
2.19.0.605.g01d371f741-goog
PATCH 5/11 virtio_net: remove ndo_poll_controller
In reply to Eric DumazetAs 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 can last for unlimited amount of time, since one cpu is generally not able to drain all the queues under load.
virto_net uses NAPI for TX completions, so we better let core networking stack call the napi->poll() to avoid the capture.
--- drivers/net/virtio_net.c | 14 -------------- 1 file changed, 14 deletions(-)
drivers/net/virtio_net.c +0 -14
@@ -1699,17 +1699,6 @@ static void virtnet_stats(struct net_device *dev, tot->rx_frame_errors = dev->stats.rx_frame_errors; } -#ifdef CONFIG_NET_POLL_CONTROLLER -static void virtnet_netpoll (struct net_device *dev) -{ -struct virtnet_info *vi =netdev_priv (dev); -int i; - -for (i =0 ; i < vi->curr_queue_pairs; i++) -napi_schedule (&vi->rq[i].napi); -} -#endif -static void virtnet_ack_link_announce (struct virtnet_info *vi) {rtnl_lock ();
@@ -2447,9 +2436,6 @@ static const struct net_device_ops virtnet_netdev = { .ndo_get_stats64 = virtnet_stats, .ndo_vlan_rx_add_vid = virtnet_vlan_rx_add_vid, .ndo_vlan_rx_kill_vid = virtnet_vlan_rx_kill_vid, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = virtnet_netpoll, -#endif .ndo_bpf = virtnet_xdp, .ndo_xdp_xmit = virtnet_xdp_xmit, .ndo_features_check = passthru_features_check,
Signature · 1 line
2.19.0.605.g01d371f741-goog
PATCH 6/11 qlcnic: remove ndo_poll_controller
In reply to Eric DumazetAs 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 can last for unlimited amount of time, since one cpu is generally not able to drain all the queues under load.
qlcnic uses NAPI for TX completions, so we better let core networking stack call the napi->poll() to avoid the capture.
--- .../net/ethernet/qlogic/qlcnic/qlcnic_main.c | 45 ------------------- 1 file changed, 45 deletions(-)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +0 -45
@@ -59,9 +59,6 @@ static int qlcnic_close(struct net_device *netdev);static void qlcnic_tx_timeout (struct net_device *netdev);static void qlcnic_attach_work (struct work_struct *work);static void qlcnic_fwinit_work (struct work_struct *work); -#ifdef CONFIG_NET_POLL_CONTROLLER -static void qlcnic_poll_controller (struct net_device *netdev); -#endif static void qlcnic_idc_debug_info (struct qlcnic_adapter *adapter,u8 encoding);static int qlcnic_can_start_firmware (struct qlcnic_adapter *adapter);
@@ -545,9 +542,6 @@ static const struct net_device_ops qlcnic_netdev_ops = { .ndo_udp_tunnel_add = qlcnic_add_vxlan_port, .ndo_udp_tunnel_del = qlcnic_del_vxlan_port, .ndo_features_check = qlcnic_features_check, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = qlcnic_poll_controller, -#endif #ifdef CONFIG_QLCNIC_SRIOV .ndo_set_vf_mac = qlcnic_sriov_set_vf_mac, .ndo_set_vf_rate = qlcnic_sriov_set_vf_tx_rate,
@@ -3200,45 +3194,6 @@ static irqreturn_t qlcnic_msix_tx_intr(int irq, void *data)return IRQ_HANDLED ; } -#ifdef CONFIG_NET_POLL_CONTROLLER -static void qlcnic_poll_controller (struct net_device *netdev) -{ -struct qlcnic_adapter *adapter =netdev_priv (netdev); -struct qlcnic_host_sds_ring *sds_ring; -struct qlcnic_recv_context *recv_ctx; -struct qlcnic_host_tx_ring *tx_ring; -int ring; - -if (!test_bit (__QLCNIC_DEV_UP, &adapter->state)) -return ; - - recv_ctx = adapter->recv_ctx; - -for (ring =0 ; ring < adapter->drv_sds_rings; ring++) { - sds_ring = &recv_ctx->sds_rings[ring]; -qlcnic_disable_sds_intr (adapter, sds_ring); -napi_schedule (&sds_ring->napi); - } - -if (adapter->flags &QLCNIC_MSIX_ENABLED ) { -/* Only Multi-Tx queue capable devices need to -* schedule NAPI for TX rings -*/ -if ((qlcnic_83xx_check (adapter) && - (adapter->flags &QLCNIC_TX_INTR_SHARED )) || - (qlcnic_82xx_check (adapter) && - !qlcnic_check_multi_tx (adapter))) -return ; - -for (ring =0 ; ring < adapter->drv_tx_rings; ring++) { - tx_ring = &adapter->tx_ring[ring]; -qlcnic_disable_tx_intr (adapter, tx_ring); -napi_schedule (&tx_ring->napi); - } - } -} -#endif -static void qlcnic_idc_debug_info (struct qlcnic_adapter *adapter,u8 encoding) {
Signature · 1 line
2.19.0.605.g01d371f741-goog
PATCH 7/11 qlogic: netxen: remove ndo_poll_controller
In reply to Eric DumazetAs 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 can last for unlimited amount of time, since one cpu is generally not able to drain all the queues under load.
netxen uses NAPI for TX completions, so we better let core networking stack call the napi->poll() to avoid the capture.
--- .../ethernet/qlogic/netxen/netxen_nic_main.c | 23 ------------------- 1 file changed, 23 deletions(-)
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +0 -23
@@ -72,9 +72,6 @@ static void netxen_schedule_work(struct netxen_adapter *adapter, work_func_t func, int delay);static void netxen_cancel_fw_work (struct netxen_adapter *adapter);static int netxen_nic_poll (struct napi_struct *napi,int budget); -#ifdef CONFIG_NET_POLL_CONTROLLER -static void netxen_nic_poll_controller (struct net_device *netdev); -#endif static void netxen_create_sysfs_entries (struct netxen_adapter *adapter);static void netxen_remove_sysfs_entries (struct netxen_adapter *adapter);
@@ -581,9 +578,6 @@ static const struct net_device_ops netxen_netdev_ops = { .ndo_tx_timeout = netxen_tx_timeout, .ndo_fix_features = netxen_fix_features, .ndo_set_features = netxen_set_features, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = netxen_nic_poll_controller, -#endif };static inline bool netxen_function_zero (struct pci_dev *pdev)
@@ -2402,23 +2396,6 @@ static int netxen_nic_poll(struct napi_struct *napi, int budget)return work_done; } -#ifdef CONFIG_NET_POLL_CONTROLLER -static void netxen_nic_poll_controller (struct net_device *netdev) -{ -int ring; -struct nx_host_sds_ring *sds_ring; -struct netxen_adapter *adapter =netdev_priv (netdev); -struct netxen_recv_context *recv_ctx = &adapter->recv_ctx; - -disable_irq (adapter->irq); -for (ring =0 ; ring < adapter->max_sds_rings; ring++) { - sds_ring = &recv_ctx->sds_rings[ring]; -netxen_intr (adapter->irq, sds_ring); - } -enable_irq (adapter->irq); -} -#endif -static int nx_incr_dev_ref_cnt (struct netxen_adapter *adapter) {
Signature · 1 line
2.19.0.605.g01d371f741-goog
PATCH 8/11 net: ena: remove ndo_poll_controller
In reply to Eric DumazetAs 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 can last for unlimited amount of time, since one cpu is generally not able to drain all the queues under load.
ena uses NAPI for TX completions, so we better let core networking stack call the napi->poll() to avoid the capture.
--- drivers/net/ethernet/amazon/ena/ena_netdev.c | 22 -------------------- 1 file changed, 22 deletions(-)
drivers/net/ethernet/amazon/ena/ena_netdev.c +0 -22
@@ -2185,25 +2185,6 @@ static netdev_tx_t ena_start_xmit(struct sk_buff *skb, struct net_device *dev)return NETDEV_TX_OK ; } -#ifdef CONFIG_NET_POLL_CONTROLLER -static void ena_netpoll (struct net_device *netdev) -{ -struct ena_adapter *adapter =netdev_priv (netdev); -int i; - -/* Dont schedule NAPI if the driver is in the middle of reset -* or netdev is down. -*/ - -if (!test_bit (ENA_FLAG_DEV_UP , &adapter->flags) || -test_bit (ENA_FLAG_TRIGGER_RESET , &adapter->flags)) -return ; - -for (i =0 ; i < adapter->num_queues; i++) -napi_schedule (&adapter->ena_napi[i].napi); -} -#endif /* CONFIG_NET_POLL_CONTROLLER */ -static u16 ena_select_queue (struct net_device *dev,struct sk_buff *skb,struct net_device *sb_dev,select_queue_fallback_t fallback)
@@ -2369,9 +2350,6 @@ static const struct net_device_ops ena_netdev_ops = { .ndo_change_mtu = ena_change_mtu, .ndo_set_mac_address = NULL, .ndo_validate_addr = eth_validate_addr, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = ena_netpoll, -#endif /* CONFIG_NET_POLL_CONTROLLER */ }; static int ena_device_validate_params(struct ena_adapter *adapter,
Signature · 1 line
2.19.0.605.g01d371f741-goog
PATCH 9/11 sfc: remove ndo_poll_controller
In reply to Eric DumazetAs 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 can last for unlimited amount of time, since one cpu is generally not able to drain all the queues under load.
sfc uses NAPI for TX completions, so we better let core networking stack call the napi->poll() to avoid the capture.
--- drivers/net/ethernet/sfc/efx.c | 26 -------------------------- 1 file changed, 26 deletions(-)
drivers/net/ethernet/sfc/efx.c +0 -26
@@ -2206,29 +2206,6 @@ static void efx_fini_napi(struct efx_nic *efx)efx_fini_napi_channel (channel); } -/************************************************************************** -* -* Kernel netpoll interface -* -*************************************************************************/ - -#ifdef CONFIG_NET_POLL_CONTROLLER - -/* Although in the common case interrupts will be disabled, this is not -* guaranteed. However, all our work happens inside the NAPI callback, -* so no locking is required. -*/ -static void efx_netpoll (struct net_device *net_dev) -{ -struct efx_nic *efx =netdev_priv (net_dev); -struct efx_channel *channel; - -efx_for_each_channel (channel, efx) -efx_schedule_channel (channel); -} - -#endif -/************************************************************************** * * Kernel net device interface
@@ -2509,9 +2486,6 @@ static const struct net_device_ops efx_netdev_ops = {#endif .ndo_get_phys_port_id = efx_get_phys_port_id, .ndo_get_phys_port_name = efx_get_phys_port_name, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = efx_netpoll, -#endif .ndo_setup_tc = efx_setup_tc, #ifdef CONFIG_RFS_ACCEL .ndo_rx_flow_steer = efx_filter_rfs,
Signature · 1 line
2.19.0.605.g01d371f741-goog
Re: [PATCH net 09/11] sfc: remove ndo_poll_controller
Quoted 7 lines · Eric Dumazet
As diagnosed by Song Liu,
ndo_poll_controller()can be very dangerous on loaded hosts, since the cpu callingndo_poll_controller()might steal all NAPI contexts (for all RX/TX queues of the NIC). This capture can last for unlimited amount of time, since one cpu is generally not able to drain all the queues under load.
Quoted 7 lines
sfc uses NAPI for TX completions, so we better let core networking stack call the
napi->poll()to avoid the capture.Signed-off-by Eric Dumazet <[email protected]>Cc Edward Cree <[email protected]>Cc Bert Kenward <[email protected]>Cc Solarflare linux maintainers <[email protected]>
Quoted 49 lines
--- drivers/net/ethernet/sfc/efx.c | 26 -------------------------- 1 file changed, 26 deletions(-)drivers/net/ethernet/sfc/efx.c +0
-26@@ -2206,29 +2206,6 @@ static void efx_fini_napi(struct efx_nic *efx)efx_fini_napi_channel (channel); } -/************************************************************************** -* -* Kernel netpoll interface -* -*************************************************************************/ - -#ifdef CONFIG_NET_POLL_CONTROLLER - -/* Although in the common case interrupts will be disabled, this is not -* guaranteed. However, all our work happens inside the NAPI callback, -* so no locking is required. -*/ -static void efx_netpoll (struct net_device *net_dev) -{ -struct efx_nic *efx =netdev_priv (net_dev); -struct efx_channel *channel; - -efx_for_each_channel (channel, efx) -efx_schedule_channel (channel); -} - -#endif -/************************************************************************** * * Kernel net device interface @@ -2509,9 +2486,6 @@ static const struct net_device_ops efx_netdev_ops = {#endif .ndo_get_phys_port_id = efx_get_phys_port_id, .ndo_get_phys_port_name = efx_get_phys_port_name, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = efx_netpoll, -#endif .ndo_setup_tc = efx_setup_tc, #ifdef CONFIG_RFS_ACCEL .ndo_rx_flow_steer = efx_filter_rfs,
PATCH 10/11 sfc-falcon: remove ndo_poll_controller
In reply to Eric DumazetAs 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 can last for unlimited amount of time, since one cpu is generally not able to drain all the queues under load.
sfc-falcon uses NAPI for TX completions, so we better let core networking stack call the napi->poll() to avoid the capture.
--- drivers/net/ethernet/sfc/falcon/efx.c | 26 -------------------------- 1 file changed, 26 deletions(-)
drivers/net/ethernet/sfc/falcon/efx.c +0 -26
@@ -2052,29 +2052,6 @@ static void ef4_fini_napi(struct ef4_nic *efx)ef4_fini_napi_channel (channel); } -/************************************************************************** -* -* Kernel netpoll interface -* -*************************************************************************/ - -#ifdef CONFIG_NET_POLL_CONTROLLER - -/* Although in the common case interrupts will be disabled, this is not -* guaranteed. However, all our work happens inside the NAPI callback, -* so no locking is required. -*/ -static void ef4_netpoll (struct net_device *net_dev) -{ -struct ef4_nic *efx =netdev_priv (net_dev); -struct ef4_channel *channel; - -ef4_for_each_channel (channel, efx) -ef4_schedule_channel (channel); -} - -#endif -/************************************************************************** * * Kernel net device interface
@@ -2250,9 +2227,6 @@ static const struct net_device_ops ef4_netdev_ops = { .ndo_set_mac_address = ef4_set_mac_address, .ndo_set_rx_mode = ef4_set_rx_mode, .ndo_set_features = ef4_set_features, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = ef4_netpoll, -#endif .ndo_setup_tc = ef4_setup_tc, #ifdef CONFIG_RFS_ACCEL .ndo_rx_flow_steer = ef4_filter_rfs,
Signature · 1 line
2.19.0.605.g01d371f741-goog
Re: [PATCH net 10/11] sfc-falcon: remove ndo_poll_controller
Quoted 7 lines · Eric Dumazet
As diagnosed by Song Liu,
ndo_poll_controller()can be very dangerous on loaded hosts, since the cpu callingndo_poll_controller()might steal all NAPI contexts (for all RX/TX queues of the NIC). This capture can last for unlimited amount of time, since one cpu is generally not able to drain all the queues under load.
Quoted 7 lines
sfc-falcon uses NAPI for TX completions, so we better let core networking stack call the
napi->poll()to avoid the capture.Signed-off-by Eric Dumazet <[email protected]>Cc Solarflare linux maintainers <[email protected]>Cc Edward Cree <[email protected]>Cc Bert Kenward <[email protected]>
Quoted 49 lines
--- drivers/net/ethernet/sfc/falcon/efx.c | 26 -------------------------- 1 file changed, 26 deletions(-)drivers/net/ethernet/sfc/falcon/efx.c +0
-26@@ -2052,29 +2052,6 @@ static void ef4_fini_napi(struct ef4_nic *efx)ef4_fini_napi_channel (channel); } -/************************************************************************** -* -* Kernel netpoll interface -* -*************************************************************************/ - -#ifdef CONFIG_NET_POLL_CONTROLLER - -/* Although in the common case interrupts will be disabled, this is not -* guaranteed. However, all our work happens inside the NAPI callback, -* so no locking is required. -*/ -static void ef4_netpoll (struct net_device *net_dev) -{ -struct ef4_nic *efx =netdev_priv (net_dev); -struct ef4_channel *channel; - -ef4_for_each_channel (channel, efx) -ef4_schedule_channel (channel); -} - -#endif -/************************************************************************** * * Kernel net device interface @@ -2250,9 +2227,6 @@ static const struct net_device_ops ef4_netdev_ops = { .ndo_set_mac_address = ef4_set_mac_address, .ndo_set_rx_mode = ef4_set_rx_mode, .ndo_set_features = ef4_set_features, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = ef4_netpoll, -#endif .ndo_setup_tc = ef4_setup_tc, #ifdef CONFIG_RFS_ACCEL .ndo_rx_flow_steer = ef4_filter_rfs,
PATCH 11/11 ibmvnic: remove ndo_poll_controller
In reply to Eric DumazetAs 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 can last for unlimited amount of time, since one cpu is generally not able to drain all the queues under load.
ibmvnic uses NAPI for TX completions, so we better let core networking stack call the napi->poll() to avoid the capture.
ibmvnic_netpoll_controller() was completely wrong anyway, as it was scheduling NAPI to service RX queues (instead of TX), so I doubt netpoll ever worked on this driver.
--- drivers/net/ethernet/ibm/ibmvnic.c | 16 ---------------- 1 file changed, 16 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +0 -16
@@ -2207,19 +2207,6 @@ static int ibmvnic_poll(struct napi_struct *napi, int budget)return frames_processed; } -#ifdef CONFIG_NET_POLL_CONTROLLER -static void ibmvnic_netpoll_controller (struct net_device *dev) -{ -struct ibmvnic_adapter *adapter =netdev_priv (dev); -int i; - -replenish_pools (netdev_priv (dev)); -for (i =0 ; i < adapter->req_rx_queues; i++) -ibmvnic_interrupt_rx (adapter->rx_scrq[i]->irq, - adapter->rx_scrq[i]); -} -#endif -static int wait_for_reset (struct ibmvnic_adapter *adapter) {int rc, ret;
@@ -2292,9 +2279,6 @@ static const struct net_device_ops ibmvnic_netdev_ops = { .ndo_set_mac_address = ibmvnic_set_mac, .ndo_validate_addr = eth_validate_addr, .ndo_tx_timeout = ibmvnic_tx_timeout, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = ibmvnic_netpoll_controller, -#endif .ndo_change_mtu = ibmvnic_change_mtu, .ndo_features_check = ibmvnic_features_check, };
Signature · 1 line
2.19.0.605.g01d371f741-goog
David Miller
maintainerFrom: Eric Dumazet <[email protected]>
Date: Thu, 27 Sep 2018 09:31:50 -0700
Quoted 12 lines
As diagnosed by Song Liu,
ndo_poll_controller()can be very dangerous on loaded hosts, since the cpu callingndo_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 ando_poll_controller():
Quoted 8 lines
Most NAPI drivers have netpoll support already handled in core networking stack, since
netpoll_poll_dev()usespoll_napi(dev)to iterate through registered NAPI contexts for a device.First patch is a fix in
poll_one_napi().Then following patches take care of ten drivers.
Series applied, thanks Eric.