linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dennis Dalessandro <dennis.dalessandro@intel.com>
To: jgg@ziepe.ca, dledford@redhat.com
Cc: linux-rdma@vger.kernel.org,
	Mike Marciniszyn <mike.marciniszyn@intel.com>,
	Kaike Wan <kaike.wan@intel.com>
Subject: [PATCH for-next 11/11] IB/hfi1: Don't cancel unused work item
Date: Tue, 26 Nov 2019 09:04:18 -0500	[thread overview]
Message-ID: <20191126140418.57492.24201.stgit@awfm-01.aw.intel.com> (raw)
In-Reply-To: <20191126140020.57492.67772.stgit@awfm-01.aw.intel.com>

From: Kaike Wan <kaike.wan@intel.com>

In iowait structure, two iowait_work entries were included to queue
a given object: one for normal IB operations, and the other for TID
RDMA operations. For non-TID RDMA operations, the iowait_work structure
for TID RDMA is initialized to contain a NULL function (not used).
When the QP is reset, the function iowait_cancel_work will be called
to cancel any pending work. The problem is that this function will
call cancel_work_sync for both iowait_work entries, even though the
one for TID RDMA is not used at all. Eventually, the call cascades to
__flush_work, wherein a WARN_ON will be triggered due to the fact that
work->func is NULL.

The WARN_ON was introduced in the following commit:
commit 4d43d395fed1 ("workqueue: Try to catch flush_work() without INIT_WORK().")

This patch fixes the issue by making sure that a work function is
present for TID RDMA before calling cancel_work_sync in
iowait_cancel_work.

Fixes: 5da0fc9dbf89 ("IB/hfi1: Prepare resource waits for dual leg")
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Kaike Wan <kaike.wan@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
---
 drivers/infiniband/hw/hfi1/iowait.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/hfi1/iowait.c b/drivers/infiniband/hw/hfi1/iowait.c
index adb4a1b..5836fe7 100644
--- a/drivers/infiniband/hw/hfi1/iowait.c
+++ b/drivers/infiniband/hw/hfi1/iowait.c
@@ -81,7 +81,9 @@ void iowait_init(struct iowait *wait, u32 tx_limit,
 void iowait_cancel_work(struct iowait *w)
 {
 	cancel_work_sync(&iowait_get_ib_work(w)->iowork);
-	cancel_work_sync(&iowait_get_tid_work(w)->iowork);
+	/* Make sure that the iowork for TID RDMA is used */
+	if (iowait_get_tid_work(w)->iowork.func)
+		cancel_work_sync(&iowait_get_tid_work(w)->iowork);
 }
 
 /**


      parent reply	other threads:[~2019-11-26 14:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26 14:03 [PATCH for-next 00/11] rdmavt/hfi1 updates for next Dennis Dalessandro
2019-11-26 14:03 ` [PATCH for-next 01/11] IB/hfi1: Add accessor API routines to access context members Dennis Dalessandro
2019-11-26 14:03 ` [PATCH for-next 02/11] IB/hfi1: List all receive contexts from debugfs Dennis Dalessandro
2019-11-26 14:03 ` [PATCH for-next 03/11] IB/hfi1: Move chip specific functions to chip.c Dennis Dalessandro
2019-11-26 14:03 ` [PATCH for-next 04/11] IB/hfi1: Add fast and slow handlers for receive context Dennis Dalessandro
2019-11-26 14:03 ` [PATCH for-next 05/11] IB/hfi1: Move common receive IRQ code to function Dennis Dalessandro
2019-11-26 14:03 ` [PATCH for-next 06/11] IB/hfi1: IB/hfi1: Add an API to handle special case drop Dennis Dalessandro
2019-11-26 14:03 ` [PATCH for-next 07/11] IB/hfi1: Create API for auto activate Dennis Dalessandro
2019-11-26 14:04 ` [PATCH for-next 08/11] IB/hfi1: Decouple IRQ name from type Dennis Dalessandro
2019-11-26 14:04 ` [PATCH for-next 09/11] IB/hfi1: Return void in packet receiving functions Dennis Dalessandro
2019-11-26 14:04 ` [PATCH for-next 10/11] IB/rdmavt: Correct comments in rdmavt_qp.h header Dennis Dalessandro
2019-11-26 14:04 ` Dennis Dalessandro [this message]

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=20191126140418.57492.24201.stgit@awfm-01.aw.intel.com \
    --to=dennis.dalessandro@intel.com \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=kaike.wan@intel.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mike.marciniszyn@intel.com \
    /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).