All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH] fm10k: use software values when checking for Tx hangs in hot path
@ 2016-06-09 20:28 Jacob Keller
  2016-06-09 21:27 ` kbuild test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Jacob Keller @ 2016-06-09 20:28 UTC (permalink / raw)
  To: intel-wired-lan

A previous patch added support to check for hardware tx pending in the
fm10k_down routine. This support was intended to ensure that we
accurately check what the hardware state is. However, checking for Tx
hangs in this manor during the hotpath results in a large performance
hit. Avoid this by making the hotpath check use the SW counters instead.

Fixes: a0f53cf49cb0 ("fm10k: use actual hardware registers when checking for pending Tx", 2016-06-08)
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_main.c | 19 +++++++++++++++----
 drivers/net/ethernet/intel/fm10k/fm10k_pci.c  |  2 +-
 2 files changed, 16 insertions(+), 5 deletions(-)

Jeff,

This patch could be squashed into the one mentioned in "fixes" which is
currently on your queue. However, it will create conflicts with another
patch as well which adds a use of the function. Please let me know if
you want me to squash these changes in? If you do it by hand you have to
squash this part in and also fix the follow-on patch that uses the
function.

Regards,
Jake

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
index e9767b6366a8..a4ea84273ea1 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
@@ -1128,13 +1128,24 @@ static u64 fm10k_get_tx_completed(struct fm10k_ring *ring)
 	return ring->stats.packets;
 }
 
-u64 fm10k_get_tx_pending(struct fm10k_ring *ring)
+/**
+ * fm10k_get_tx_pending - how many tx descriptors not processed
+ * @ring: the ring structure
+ * @in_sw: is tx_pending being checked in SW or in HW?
+ */
+u64 fm10k_get_tx_pending(struct fm10k_ring *ring, bool in_sw)
 {
 	struct fm10k_intfc *interface = ring->q_vector->interface;
 	struct fm10k_hw *hw = &interface->hw;
+	u32 head, tail;
 
-	u32 head = fm10k_read_reg(hw, FM10K_TDH(ring->reg_idx));
-	u32 tail = fm10k_read_reg(hw, FM10K_TDT(ring->reg_idx));
+	if (likely(in_sw)) {
+		head = ring->next_to_clean;
+		tail = ring->next_to_use;
+	} else {
+		head = fm10k_read_reg(hw, FM10K_TDH(ring->reg_idx));
+		tail = fm10k_read_reg(hw, FM10K_TDT(ring->reg_idx));
+	}
 
 	return ((head <= tail) ? tail : tail + ring->count) - head;
 }
@@ -1143,7 +1154,7 @@ bool fm10k_check_tx_hang(struct fm10k_ring *tx_ring)
 {
 	u32 tx_done = fm10k_get_tx_completed(tx_ring);
 	u32 tx_done_old = tx_ring->tx_stats.tx_done_old;
-	u32 tx_pending = fm10k_get_tx_pending(tx_ring);
+	u32 tx_pending = fm10k_get_tx_pending(tx_ring, true);
 
 	clear_check_for_tx_hang(tx_ring);
 
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
index 559cda999f49..b0c3d7b3a34c 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
@@ -1699,7 +1699,7 @@ void fm10k_down(struct fm10k_intfc *interface)
 
 		/* start checking at the last ring to have pending Tx */
 		for (; i < interface->num_tx_queues; i++)
-			if (fm10k_get_tx_pending(interface->tx_ring[i]))
+			if (fm10k_get_tx_pending(interface->tx_ring[i], false))
 				break;
 
 		/* if all the queues are drained, we can break now */
-- 
2.9.0.rc1.405.g81f467e


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Intel-wired-lan] [PATCH] fm10k: use software values when checking for Tx hangs in hot path
  2016-06-09 20:28 [Intel-wired-lan] [PATCH] fm10k: use software values when checking for Tx hangs in hot path Jacob Keller
@ 2016-06-09 21:27 ` kbuild test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kbuild test robot @ 2016-06-09 21:27 UTC (permalink / raw)
  To: intel-wired-lan

Hi,

[auto build test ERROR on jkirsher-next-queue/dev-queue]
[cannot apply to v4.7-rc2 next-20160609]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jacob-Keller/fm10k-use-software-values-when-checking-for-Tx-hangs-in-hot-path/20160610-043049
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git dev-queue
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

>> drivers/net/ethernet/intel/fm10k/fm10k_main.c:1136:5: error: conflicting types for 'fm10k_get_tx_pending'
    u64 fm10k_get_tx_pending(struct fm10k_ring *ring, bool in_sw)
        ^~~~~~~~~~~~~~~~~~~~
   In file included from drivers/net/ethernet/intel/fm10k/fm10k_main.c:29:0:
   drivers/net/ethernet/intel/fm10k/fm10k.h:461:5: note: previous declaration of 'fm10k_get_tx_pending' was here
    u64 fm10k_get_tx_pending(struct fm10k_ring *ring);
        ^~~~~~~~~~~~~~~~~~~~
--
   drivers/net/ethernet/intel/fm10k/fm10k_pci.c: In function 'fm10k_down':
>> drivers/net/ethernet/intel/fm10k/fm10k_pci.c:1702:8: error: too many arguments to function 'fm10k_get_tx_pending'
       if (fm10k_get_tx_pending(interface->tx_ring[i], false))
           ^~~~~~~~~~~~~~~~~~~~
   In file included from drivers/net/ethernet/intel/fm10k/fm10k_pci.c:24:0:
   drivers/net/ethernet/intel/fm10k/fm10k.h:461:5: note: declared here
    u64 fm10k_get_tx_pending(struct fm10k_ring *ring);
        ^~~~~~~~~~~~~~~~~~~~

vim +/fm10k_get_tx_pending +1136 drivers/net/ethernet/intel/fm10k/fm10k_main.c

  1130	
  1131	/**
  1132	 * fm10k_get_tx_pending - how many tx descriptors not processed
  1133	 * @ring: the ring structure
  1134	 * @in_sw: is tx_pending being checked in SW or in HW?
  1135	 */
> 1136	u64 fm10k_get_tx_pending(struct fm10k_ring *ring, bool in_sw)
  1137	{
  1138		struct fm10k_intfc *interface = ring->q_vector->interface;
  1139		struct fm10k_hw *hw = &interface->hw;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 55052 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20160610/96c313ad/attachment-0001.obj>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-09 21:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-09 20:28 [Intel-wired-lan] [PATCH] fm10k: use software values when checking for Tx hangs in hot path Jacob Keller
2016-06-09 21:27 ` kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.