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>,
	Alex Estrin <alex.estrin@intel.com>,
	stable@vger.kernel.org
Subject: [PATCH for-next 12/13] IB/{hfi1, qib}: Add handling of kernel restart
Date: Wed, 04 Apr 2018 20:03:12 -0700	[thread overview]
Message-ID: <20180405030308.18766.22246.stgit@scvm10.sc.intel.com> (raw)
In-Reply-To: <20180405025915.18766.41569.stgit@scvm10.sc.intel.com>

From: Alex Estrin <alex.estrin@intel.com>

A warm restart will fail to unload the driver, leaving link state
potentially flapping up to the point the BIOS resets the adapter.
Correct the issue by hooking the shutdown pci method,
which will bring link down and remove the driver.

Cc: <stable@vger.kernel.org> # 4.9.x
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Alex Estrin <alex.estrin@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
---
 drivers/infiniband/hw/hfi1/hfi.h     |    1 +
 drivers/infiniband/hw/hfi1/init.c    |    5 +++++
 drivers/infiniband/hw/qib/qib.h      |    1 +
 drivers/infiniband/hw/qib/qib_init.c |    5 +++++
 4 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h
index 4305000..777abb8 100644
--- a/drivers/infiniband/hw/hfi1/hfi.h
+++ b/drivers/infiniband/hw/hfi1/hfi.h
@@ -1857,6 +1857,7 @@ struct cc_state *get_cc_state_protected(struct hfi1_pportdata *ppd)
 #define HFI1_HAS_SDMA_TIMEOUT  0x8
 #define HFI1_HAS_SEND_DMA      0x10   /* Supports Send DMA */
 #define HFI1_FORCED_FREEZE     0x80   /* driver forced freeze mode */
+#define HFI1_REMOVE           0x100   /* unloading device */
 
 /* IB dword length mask in PBC (lower 11 bits); same for all chips */
 #define HFI1_PBC_LENGTH_MASK                     ((1 << 11) - 1)
diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c
index c45cca5..20fa898 100644
--- a/drivers/infiniband/hw/hfi1/init.c
+++ b/drivers/infiniband/hw/hfi1/init.c
@@ -1388,6 +1388,7 @@ void hfi1_disable_after_error(struct hfi1_devdata *dd)
 	.name = DRIVER_NAME,
 	.probe = init_one,
 	.remove = remove_one,
+	.shutdown = remove_one,
 	.id_table = hfi1_pci_tbl,
 	.err_handler = &hfi1_pci_err_handler,
 };
@@ -1768,6 +1769,10 @@ static void remove_one(struct pci_dev *pdev)
 {
 	struct hfi1_devdata *dd = pci_get_drvdata(pdev);
 
+	if (dd->flags & HFI1_REMOVE)
+		return;
+	dd->flags |= HFI1_REMOVE;
+
 	/* close debugfs files before ib unregister */
 	hfi1_dbg_ibdev_exit(&dd->verbs_dev);
 
diff --git a/drivers/infiniband/hw/qib/qib.h b/drivers/infiniband/hw/qib/qib.h
index 4607245..677b757 100644
--- a/drivers/infiniband/hw/qib/qib.h
+++ b/drivers/infiniband/hw/qib/qib.h
@@ -1228,6 +1228,7 @@ int qib_cdev_init(int minor, const char *name,
 #define QIB_BADINTR           0x8000 /* severe interrupt problems */
 #define QIB_DCA_ENABLED       0x10000 /* Direct Cache Access enabled */
 #define QIB_HAS_QSFP          0x20000 /* device (card instance) has QSFP */
+#define QIB_REMOVE            0x40000 /* unloading device */
 
 /*
  * values for ppd->lflags (_ib_port_ related flags)
diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c
index 3990f38..796dea4 100644
--- a/drivers/infiniband/hw/qib/qib_init.c
+++ b/drivers/infiniband/hw/qib/qib_init.c
@@ -1201,6 +1201,7 @@ void qib_disable_after_error(struct qib_devdata *dd)
 	.name = QIB_DRV_NAME,
 	.probe = qib_init_one,
 	.remove = qib_remove_one,
+	.shutdown = qib_remove_one,
 	.id_table = qib_pci_tbl,
 	.err_handler = &qib_pci_err_handler,
 };
@@ -1526,6 +1527,10 @@ static void qib_remove_one(struct pci_dev *pdev)
 	struct qib_devdata *dd = pci_get_drvdata(pdev);
 	int ret;
 
+	if (dd->flags & QIB_REMOVE)
+		return;
+	dd->flags |= QIB_REMOVE;
+
 	/* unregister from IB core */
 	qib_unregister_ib_device(dd);
 

  parent reply	other threads:[~2018-04-05  3:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-05  3:01 [PATCH for-next 00/13] IB/hfi1,core: Driver updates for 4.17 Dennis Dalessandro
2018-04-05  3:01 ` [PATCH for-next 04/13] IB/hfi1: Fix handling of FECN marked multicast packet Dennis Dalessandro
2018-04-05  3:02 ` [PATCH for-next 07/13] IB/hfi1: Fix fault injection init/exit issues Dennis Dalessandro
2018-04-05  3:02 ` [PATCH for-next 08/13] IB/hfi1: Use after free race condition in send context error path Dennis Dalessandro
2018-04-05  3:03 ` [PATCH for-next 11/13] IB/hfi1: Reorder incorrect send context disable Dennis Dalessandro
2018-04-05  3:03 ` Dennis Dalessandro [this message]
2018-04-05 19:17   ` [PATCH for-next 12/13] IB/{hfi1, qib}: Add handling of kernel restart Jason Gunthorpe
2018-04-11 18:43     ` Estrin, Alex
2018-04-05  3:03 ` [PATCH for-next 13/13] IB/hfi1: Fix loss of BECN with AHG Dennis Dalessandro
2018-04-05  3:09 ` [PATCH for-next 00/13] IB/hfi1,core: Driver updates for 4.17 Jason Gunthorpe
2018-04-05  3:33   ` Dennis Dalessandro
2018-04-05  4:09     ` Bart Van Assche
2018-04-05 14:49     ` Jason Gunthorpe
2018-04-18  1:40 ` Jason Gunthorpe
2018-04-18  2:56   ` Dennis Dalessandro

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=20180405030308.18766.22246.stgit@scvm10.sc.intel.com \
    --to=dennis.dalessandro@intel.com \
    --cc=alex.estrin@intel.com \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mike.marciniszyn@intel.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).