All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH S50 10/15] ice: need_wakeup flag might not be set for Tx
Date: Mon, 13 Jul 2020 13:53:13 -0700	[thread overview]
Message-ID: <20200713205318.32425-10-anthony.l.nguyen@intel.com> (raw)
In-Reply-To: <20200713205318.32425-1-anthony.l.nguyen@intel.com>

From: Krzysztof Kazimierczak <krzysztof.kazimierczak@intel.com>

This is a port of i40e commit 705639572e8c ("i40e: need_wakeup flag might
not be set for Tx").

Quoting the original commit message:

"The need_wakeup flag for Tx might not be set for AF_XDP sockets that
are only used to send packets. This happens if there is at least one
outstanding packet that has not been completed by the hardware and we
get that corresponding completion (which will not generate an interrupt
since interrupts are disabled in the napi poll loop) between the time we
stopped processing the Tx completions and interrupts are enabled again.
In this case, the need_wakeup flag will have been cleared at the end of
the Tx completion processing as we believe we will get an interrupt from
the outstanding completion at a later point in time. But if this
completion interrupt occurs before interrupts are enable, we lose it and
should at that point really have set the need_wakeup flag since there
are no more outstanding completions that can generate an interrupt to
continue the processing. When this happens, user space will see a Tx
queue need_wakeup of 0 and skip issuing a syscall, which means will
never get into the Tx processing again and we have a deadlock."

As a result, packet processing stops. This patch introduces a fix for
this issue, by always setting the need_wakeup flag at the end of an
interrupt processing. This ensures that the deadlock will not happen.

Signed-off-by: Krzysztof Kazimierczak <krzysztof.kazimierczak@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_xsk.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c
index 6badfd62dc63..87862918bc7a 100644
--- a/drivers/net/ethernet/intel/ice/ice_xsk.c
+++ b/drivers/net/ethernet/intel/ice/ice_xsk.c
@@ -706,8 +706,6 @@ static bool ice_xmit_zc(struct ice_ring *xdp_ring, int budget)
 	if (tx_desc) {
 		ice_xdp_ring_update_tail(xdp_ring);
 		xsk_umem_consume_tx_done(xdp_ring->xsk_umem);
-		if (xsk_umem_uses_need_wakeup(xdp_ring->xsk_umem))
-			xsk_clear_tx_need_wakeup(xdp_ring->xsk_umem);
 	}
 
 	return budget > 0 && work_done;
@@ -783,12 +781,8 @@ bool ice_clean_tx_irq_zc(struct ice_ring *xdp_ring, int budget)
 	if (xsk_frames)
 		xsk_umem_complete_tx(xdp_ring->xsk_umem, xsk_frames);
 
-	if (xsk_umem_uses_need_wakeup(xdp_ring->xsk_umem)) {
-		if (xdp_ring->next_to_clean == xdp_ring->next_to_use)
-			xsk_set_tx_need_wakeup(xdp_ring->xsk_umem);
-		else
-			xsk_clear_tx_need_wakeup(xdp_ring->xsk_umem);
-	}
+	if (xsk_umem_uses_need_wakeup(xdp_ring->xsk_umem))
+		xsk_set_tx_need_wakeup(xdp_ring->xsk_umem);
 
 	ice_update_tx_ring_stats(xdp_ring, total_packets, total_bytes);
 	xmit_done = ice_xmit_zc(xdp_ring, ICE_DFLT_IRQ_WORK);
-- 
2.20.1


  parent reply	other threads:[~2020-07-13 20:53 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-13 20:53 [Intel-wired-lan] [PATCH S50 01/15] ice: Implement LFC workaround Tony Nguyen
2020-07-13 20:53 ` [Intel-wired-lan] [PATCH S50 02/15] ice: Fix link broken after GLOBR reset Tony Nguyen
2020-07-16 17:48   ` Bowers, AndrewX
2020-07-13 20:53 ` [Intel-wired-lan] [PATCH S50 03/15] ice: fix link event handling timing Tony Nguyen
2020-07-16 17:46   ` Bowers, AndrewX
2020-07-13 20:53 ` [Intel-wired-lan] [PATCH S50 04/15] ice: restore VF MSI-X state during PCI reset Tony Nguyen
2020-07-16 17:46   ` Bowers, AndrewX
2020-07-13 20:53 ` [Intel-wired-lan] [PATCH S50 05/15] ice: return correct error code from ice_aq_sw_rules Tony Nguyen
2020-07-16 17:45   ` Bowers, AndrewX
2020-07-13 20:53 ` [Intel-wired-lan] [PATCH S50 06/15] ice: fix overwriting TX/RX descriptor values when rebuilding VSI Tony Nguyen
2020-07-16 17:49   ` Bowers, AndrewX
2020-07-13 20:53 ` [Intel-wired-lan] [PATCH S50 07/15] ice: Add RL profile bit mask check Tony Nguyen
2020-07-16 17:47   ` Bowers, AndrewX
2020-07-13 20:53 ` [Intel-wired-lan] [PATCH S50 08/15] ice: Adjust scheduler default BW weight Tony Nguyen
2020-07-16 17:47   ` Bowers, AndrewX
2020-07-13 20:53 ` [Intel-wired-lan] [PATCH S50 09/15] ice: distribute Tx queues evenly Tony Nguyen
2020-07-16 17:50   ` Bowers, AndrewX
2020-07-13 20:53 ` Tony Nguyen [this message]
2020-07-16 17:49   ` [Intel-wired-lan] [PATCH S50 10/15] ice: need_wakeup flag might not be set for Tx Bowers, AndrewX
2020-07-13 20:53 ` [Intel-wired-lan] [PATCH S50 11/15] ice: Allow all VLANs in safe mode Tony Nguyen
2020-07-16 17:46   ` Bowers, AndrewX
2020-07-13 20:53 ` [Intel-wired-lan] [PATCH S50 12/15] ice: cleanup VSI on probe fail Tony Nguyen
2020-07-16 17:48   ` Bowers, AndrewX
2020-07-13 20:53 ` [Intel-wired-lan] [PATCH S50 13/15] ice: reduce scope of variable Tony Nguyen
2020-07-16 17:49   ` Bowers, AndrewX
2020-07-13 20:53 ` [Intel-wired-lan] [PATCH S50 14/15] ice: disable no longer needed workaround for FW logging Tony Nguyen
2020-07-16 17:48   ` Bowers, AndrewX
2020-07-13 20:53 ` [Intel-wired-lan] [PATCH S50 15/15] ice: fix unused parameter warning Tony Nguyen
2020-07-16 17:48   ` Bowers, AndrewX
2020-07-16 17:47 ` [Intel-wired-lan] [PATCH S50 01/15] ice: Implement LFC workaround Bowers, AndrewX

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=20200713205318.32425-10-anthony.l.nguyen@intel.com \
    --to=anthony.l.nguyen@intel.com \
    --cc=intel-wired-lan@osuosl.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 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.