public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Kaike Wan <kaike.wan@intel.com>
Cc: stable@vger.kernel.org, linux-rdma@vger.kernel.org,
	stable-commits@vger.kernel.org
Subject: Re: [PATCH] IB/hfi1: Failed to drain send queue when QP is put into error state
Date: Thu, 18 Apr 2019 17:50:49 +0200	[thread overview]
Message-ID: <20190418155049.GA28185@kroah.com> (raw)
In-Reply-To: <20190418130033.11508.931.stgit@scvm10.sc.intel.com>

On Thu, Apr 18, 2019 at 06:00:37AM -0700, Kaike Wan wrote:
> commit 662d66466637862ef955f7f6e78a286d8cf0ebef upstream.
> 
> When a QP is put into error state, all pending requests in the send work
> queue should be drained. The following sequence of events could lead to a
> failure, causing a request to hang:
> 
> (1) The QP builds a packet and tries to send through SDMA engine.
>     However, PIO engine is still busy. Consequently, this packet is put on
>     the QP's tx list and the QP is put on the PIO waiting list. The field
>     qp->s_flags is set with HFI1_S_WAIT_PIO_DRAIN;
> 
> (2) The QP is put into error state by the user application and
>     notify_error_qp() is called, which removes the QP from the PIO waiting
>     list and the packet from the QP's tx list. In addition, qp->s_flags is
>     cleared of RVT_S_ANY_WAIT_IO bits, which does not include
>     HFI1_S_WAIT_PIO_DRAIN bit;
> 
> (3) The hfi1_schdule_send() function is called to drain the QP's send
>     queue. Subsequently, hfi1_do_send() is called. Since the flag bit
>     HFI1_S_WAIT_PIO_DRAIN is set in qp->s_flags, hfi1_send_ok() fails.  As
>     a result, hfi1_do_send() bails out without draining any request from
>     the send queue;
> 
> (4) The PIO engine completes the sending and tries to wake up any QP on
>     its waiting list. But the QP has been removed from the PIO waiting
>     list and therefore is kept in sleep forever.
> 
> The fix is to clear qp->s_flags of HFI1_S_ANY_WAIT_IO bits in step (2).
> HFI1_S_ANY_WAIT_IO includes RVT_S_ANY_WAIT_IO and HFI1_S_WAIT_PIO_DRAIN.
> 
> [ Corrected commit message to match upstream ]
> 
> Fixes: 2e2ba09e48b7 ("IB/rdmavt, IB/hfi1: Create device dependent s_flags")
> Cc: <stable@vger.kernel.org> # 4.19.x+

Thanks, now queued up.

  reply	other threads:[~2019-04-18 15:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-18 13:00 [PATCH] IB/hfi1: Failed to drain send queue when QP is put into error state Kaike Wan
2019-04-18 15:50 ` Greg KH [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-04-16 13:09 Kaike Wan
2019-04-18  6:22 ` Jason Gunthorpe
2019-04-18 12:58   ` Wan, Kaike

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=20190418155049.GA28185@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=kaike.wan@intel.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=stable-commits@vger.kernel.org \
    --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