From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Emil Tantilov <emil.s.tantilov@intel.com>,
netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com,
Arun Sharma <asharma@fb.com>, stable <stable@vger.kernel.org>,
Jacob Keller <jacob.e.keller@intel.com>,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 02/16] ixgbe: fix spinlock recursion with netpoll and busy poll
Date: Fri, 14 Mar 2014 02:47:12 -0700 [thread overview]
Message-ID: <1394790446-31591-3-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1394790446-31591-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Emil Tantilov <emil.s.tantilov@intel.com>
This patch resolves a hang with busy poll when used with netconsole.
The main change is the check for netpoll packets in ixgbe_poll() which
prevents a call to spin_lock_bh() while interrupts are disabled.
In addition it removes the call to netif_rx() since netif_receive_skb()
can deal with netpoll packets and also replaced the global adapter flag
with per-q_vector bool that indicates Rx packet from netpoll which
should help with performance.
CC: Arun Sharma <asharma@fb.com>
CC: stable <stable@vger.kernel.org>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe.h | 3 ++-
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 18 +++++++++---------
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index 2fff0fc..d34abbc 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -386,6 +386,7 @@ struct ixgbe_q_vector {
int numa_node;
struct rcu_head rcu; /* to avoid race with update stats on free */
char name[IFNAMSIZ + 9];
+ bool netpoll_rx;
#ifdef CONFIG_NET_RX_BUSY_POLL
unsigned int state;
@@ -643,7 +644,7 @@ struct ixgbe_adapter {
#define IXGBE_FLAG_RX_1BUF_CAPABLE (u32)(1 << 4)
#define IXGBE_FLAG_RX_PS_CAPABLE (u32)(1 << 5)
#define IXGBE_FLAG_RX_PS_ENABLED (u32)(1 << 6)
-#define IXGBE_FLAG_IN_NETPOLL (u32)(1 << 7)
+
#define IXGBE_FLAG_DCA_ENABLED (u32)(1 << 8)
#define IXGBE_FLAG_DCA_CAPABLE (u32)(1 << 9)
#define IXGBE_FLAG_IMIR_ENABLED (u32)(1 << 10)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 8bea6ca..06aab2c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -1670,14 +1670,10 @@ static void ixgbe_process_skb_fields(struct ixgbe_ring *rx_ring,
static void ixgbe_rx_skb(struct ixgbe_q_vector *q_vector,
struct sk_buff *skb)
{
- struct ixgbe_adapter *adapter = q_vector->adapter;
-
- if (ixgbe_qv_busy_polling(q_vector))
+ if (ixgbe_qv_busy_polling(q_vector) || q_vector->netpoll_rx)
netif_receive_skb(skb);
- else if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL))
- napi_gro_receive(&q_vector->napi, skb);
else
- netif_rx(skb);
+ napi_gro_receive(&q_vector->napi, skb);
}
/**
@@ -2159,6 +2155,7 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
u64_stats_update_end(&rx_ring->syncp);
q_vector->rx.total_packets += total_rx_packets;
q_vector->rx.total_bytes += total_rx_bytes;
+ q_vector->netpoll_rx = false;
if (cleaned_count)
ixgbe_alloc_rx_buffers(rx_ring, cleaned_count);
@@ -2758,6 +2755,9 @@ int ixgbe_poll(struct napi_struct *napi, int budget)
ixgbe_for_each_ring(ring, q_vector->tx)
clean_complete &= !!ixgbe_clean_tx_irq(q_vector, ring);
+ if (test_bit(NAPI_STATE_NPSVC, &napi->state))
+ return budget;
+
if (!ixgbe_qv_lock_napi(q_vector))
return budget;
@@ -7273,14 +7273,14 @@ static void ixgbe_netpoll(struct net_device *netdev)
if (test_bit(__IXGBE_DOWN, &adapter->state))
return;
- adapter->flags |= IXGBE_FLAG_IN_NETPOLL;
if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) {
- for (i = 0; i < adapter->num_q_vectors; i++)
+ for (i = 0; i < adapter->num_q_vectors; i++) {
+ adapter->q_vector[i]->netpoll_rx = true;
ixgbe_msix_clean_rings(0, adapter->q_vector[i]);
+ }
} else {
ixgbe_intr(adapter->pdev->irq, netdev);
}
- adapter->flags &= ~IXGBE_FLAG_IN_NETPOLL;
}
#endif
--
1.8.3.1
next prev parent reply other threads:[~2014-03-14 9:47 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-14 9:47 [net-next 00/16][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2014-03-14 9:47 ` [net-next 01/16] ixgbe: add check for netif_carrier_ok in ixgbe_xmit_frame Jeff Kirsher
2014-03-14 18:57 ` David Miller
2014-03-14 20:19 ` Tantilov, Emil S
2014-03-14 21:51 ` David Miller
2014-03-15 0:19 ` Ben Hutchings
2014-03-15 0:24 ` Tantilov, Emil S
2014-03-14 9:47 ` Jeff Kirsher [this message]
2014-03-14 18:58 ` [net-next 02/16] ixgbe: fix spinlock recursion with netpoll and busy poll David Miller
2014-03-14 20:40 ` Tantilov, Emil S
2014-03-14 21:53 ` David Miller
2014-03-15 2:08 ` Eric W. Biederman
2014-03-14 9:47 ` [net-next 03/16] igb: Fix code comment Jeff Kirsher
2014-03-14 9:47 ` [net-next 04/16] i40e: delete netdev after deleting napi and vectors Jeff Kirsher
2014-03-14 9:47 ` [net-next 05/16] i40e: Fix a bug in the update logic for FDIR SB filter Jeff Kirsher
2014-03-14 9:47 ` [net-next 06/16] i40e/i40evf: Some flow director HW definition fixes Jeff Kirsher
2014-03-14 9:47 ` [net-next 07/16] i40e: make string references to q be queue Jeff Kirsher
2014-03-14 9:47 ` [net-next 08/16] i40e: cleanup strings Jeff Kirsher
2014-03-14 9:47 ` [net-next 09/16] i40e: simplified init string Jeff Kirsher
2014-03-14 9:47 ` [net-next 10/16] i40e: Fix function comments Jeff Kirsher
2014-03-14 9:47 ` [net-next 11/16] i40e: Define a new state variable to keep track of feature auto disable Jeff Kirsher
2014-03-14 9:47 ` [net-next 12/16] i40e: Add code to handle FD table full condition Jeff Kirsher
2014-03-14 9:47 ` [net-next 13/16] i40e: Bug fix for FDIR replay logic Jeff Kirsher
2014-03-14 9:47 ` [net-next 14/16] i40e: Let MDD events be handled by MDD handler Jeff Kirsher
2014-03-14 9:47 ` [net-next 15/16] i40e/i40evf: Use correct number of VF vectors Jeff Kirsher
2014-03-14 9:47 ` [net-next 16/16] i40e/i40evf: Use dma_set_mask_and_coherent Jeff Kirsher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1394790446-31591-3-git-send-email-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=asharma@fb.com \
--cc=davem@davemloft.net \
--cc=emil.s.tantilov@intel.com \
--cc=gospo@redhat.com \
--cc=jacob.e.keller@intel.com \
--cc=netdev@vger.kernel.org \
--cc=sassmann@redhat.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).