public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
	James Bottomley <james.bottomley@hansenpartnership.com>,
	linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>,
	Kashyap Desai <kashyap.desai@broadcom.com>,
	Sathya Prakash Veerichetty <sathya.prakash@broadcom.com>,
	Sumit Saxena <sumit.saxena@broadcom.com>,
	Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Subject: [PATCH 24/24] mpi3mr: split off bus_reset function from host_reset
Date: Mon,  2 May 2022 23:38:20 +0200	[thread overview]
Message-ID: <20220502213820.3187-25-hare@suse.de> (raw)
In-Reply-To: <20220502213820.3187-1-hare@suse.de>

SCSI EH host reset is the final callback in the escalation chain;
once we reach this we need to reset the controller.
As such it defeats the purpose to skip controller reset if no
I/Os are pending and the RAID device is to be reset; especially
after kexec there might be stale commands pending in firmware
for which we have no reference whatsoever.
So this patch splits off the check for pending I/O into a
'bus_reset' function, and leaves the actual controller reset
to the host reset.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Cc: Kashyap Desai <kashyap.desai@broadcom.com>
Cc: Sathya Prakash Veerichetty <sathya.prakash@broadcom.com>
Cc: Sumit Saxena <sumit.saxena@broadcom.com>
Cc: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
---
 drivers/scsi/mpi3mr/mpi3mr_os.c | 57 +++++++++++++++++++++------------
 1 file changed, 37 insertions(+), 20 deletions(-)

diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c
index f7cd70a15ea6..31f05e9f5ee0 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_os.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_os.c
@@ -3337,20 +3337,45 @@ void mpi3mr_wait_for_host_io(struct mpi3mr_ioc *mrioc, u32 timeout)
  * mpi3mr_eh_host_reset - Host reset error handling callback
  * @scmd: SCSI command reference
  *
- * Issue controller reset if the scmd is for a Physical Device,
- * if the scmd is for RAID volume, then wait for
- * MPI3MR_RAID_ERRREC_RESET_TIMEOUT and checke whether any
- * pending I/Os prior to issuing reset to the controller.
+ * Issue controller reset
  *
  * Return: SUCCESS of successful reset else FAILED
  */
 static int mpi3mr_eh_host_reset(struct scsi_cmnd *scmd)
+{
+	struct mpi3mr_ioc *mrioc = shost_priv(scmd->device->host);
+	int retval = FAILED, ret;
+
+	ret = mpi3mr_soft_reset_handler(mrioc,
+	    MPI3MR_RESET_FROM_EH_HOS, 1);
+	if (ret)
+		goto out;
+
+	retval = SUCCESS;
+out:
+	sdev_printk(KERN_INFO, scmd->device,
+	    "Host reset is %s for scmd(%p)\n",
+	    ((retval == SUCCESS) ? "SUCCESS" : "FAILED"), scmd);
+
+	return retval;
+}
+
+/**
+ * mpi3mr_eh_bus_reset - Bus reset error handling callback
+ * @scmd: SCSI command reference
+ *
+ * Checks whether pending I/Os are present for the RAID volume;
+ * if not there's no need to reset the adapter.
+ *
+ * Return: SUCCESS of successful reset else FAILED
+ */
+static int mpi3mr_eh_bus_reset(struct scsi_cmnd *scmd)
 {
 	struct mpi3mr_ioc *mrioc = shost_priv(scmd->device->host);
 	struct mpi3mr_stgt_priv_data *stgt_priv_data;
 	struct mpi3mr_sdev_priv_data *sdev_priv_data;
 	u8 dev_type = MPI3_DEVICE_DEVFORM_VD;
-	int retval = FAILED, ret;
+	int retval = FAILED;
 
 	sdev_priv_data = scmd->device->hostdata;
 	if (sdev_priv_data && sdev_priv_data->tgt_priv_data) {
@@ -3360,25 +3385,16 @@ static int mpi3mr_eh_host_reset(struct scsi_cmnd *scmd)
 
 	if (dev_type == MPI3_DEVICE_DEVFORM_VD) {
 		mpi3mr_wait_for_host_io(mrioc,
-		    MPI3MR_RAID_ERRREC_RESET_TIMEOUT);
-		if (!mpi3mr_get_fw_pending_ios(mrioc)) {
+			MPI3MR_RAID_ERRREC_RESET_TIMEOUT);
+		if (!mpi3mr_get_fw_pending_ios(mrioc))
 			retval = SUCCESS;
-			goto out;
-		}
 	}
+	if (retval == FAILED)
+		mpi3mr_print_pending_host_io(mrioc);
 
-	mpi3mr_print_pending_host_io(mrioc);
-	ret = mpi3mr_soft_reset_handler(mrioc,
-	    MPI3MR_RESET_FROM_EH_HOS, 1);
-	if (ret)
-		goto out;
-
-	retval = SUCCESS;
-out:
 	sdev_printk(KERN_INFO, scmd->device,
-	    "Host reset is %s for scmd(%p)\n",
-	    ((retval == SUCCESS) ? "SUCCESS" : "FAILED"), scmd);
-
+		"Bus reset is %s for scmd(%p)\n",
+		((retval == SUCCESS) ? "SUCCESS" : "FAILED"), scmd);
 	return retval;
 }
 
@@ -4094,6 +4110,7 @@ static struct scsi_host_template mpi3mr_driver_template = {
 	.change_queue_depth		= mpi3mr_change_queue_depth,
 	.eh_device_reset_handler	= mpi3mr_eh_dev_reset,
 	.eh_target_reset_handler	= mpi3mr_eh_target_reset,
+	.eh_bus_reset_handler		= mpi3mr_eh_bus_reset,
 	.eh_host_reset_handler		= mpi3mr_eh_host_reset,
 	.bios_param			= mpi3mr_bios_param,
 	.map_queues			= mpi3mr_map_queues,
-- 
2.29.2


  parent reply	other threads:[~2022-05-02 21:38 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-02 21:37 [PATCH 00/24] scsi: EH rework prep patches, part 1 Hannes Reinecke
2022-05-02 21:37 ` [PATCH 01/24] csiostor: use fc_block_rport() Hannes Reinecke
2022-05-03 14:06   ` Christoph Hellwig
2022-05-03 14:43   ` Johannes Thumshirn
2022-05-03 16:09   ` Bart Van Assche
2022-05-02 21:37 ` [PATCH 02/24] fc_fcp: " Hannes Reinecke
2022-05-03 14:06   ` Christoph Hellwig
2022-05-03 14:44   ` Johannes Thumshirn
2022-05-03 16:09   ` Bart Van Assche
2022-05-02 21:37 ` [PATCH 03/24] zfcp: open-code fc_block_scsi_eh() for host reset Hannes Reinecke
2022-05-03 14:06   ` Christoph Hellwig
2022-05-03 17:21   ` Steffen Maier
2022-05-03 18:42     ` Hannes Reinecke
2022-05-02 21:38 ` [PATCH 04/24] mptfc: simplify mpt_fc_block_error_handler() Hannes Reinecke
2022-05-03 14:07   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 05/24] mptfusion: correct definitions for mptscsih_dev_reset() Hannes Reinecke
2022-05-03 14:07   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 06/24] mptfc: open-code mptfc_block_error_handler() for bus reset Hannes Reinecke
2022-05-03 14:08   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 07/24] qedf: use fc rport as argument for qedf_initiate_tmf() Hannes Reinecke
2022-05-03 14:08   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 08/24] bnx2fc: Do not rely on a scsi command for lun or target reset Hannes Reinecke
2022-05-03 14:08   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 09/24] ibmvfc: open-code reset loop for " Hannes Reinecke
2022-05-03 14:09   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 10/24] ibmvfc: use fc_block_rport() Hannes Reinecke
2022-05-03 14:09   ` Christoph Hellwig
2022-05-03 15:20   ` Johannes Thumshirn
2022-05-03 16:11   ` Bart Van Assche
2022-05-02 21:38 ` [PATCH 11/24] fnic: use dedicated device reset command Hannes Reinecke
2022-05-03 14:09   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 12/24] fnic: use fc_block_rport() correctly Hannes Reinecke
2022-05-03 14:10   ` Christoph Hellwig
2022-05-03 15:22   ` Johannes Thumshirn
2022-05-02 21:38 ` [PATCH 13/24] aic7xxx: make BUILD_SCSIID() a function Hannes Reinecke
2022-05-03  9:39   ` kernel test robot
2022-05-03 14:12   ` Christoph Hellwig
2022-05-03 14:18     ` Hannes Reinecke
2022-05-02 21:38 ` [PATCH 14/24] aic79xx: " Hannes Reinecke
2022-05-03 14:13   ` Christoph Hellwig
2022-05-03 14:19     ` Hannes Reinecke
2022-05-02 21:38 ` [PATCH 15/24] aic7xxx: do not reference scsi command when resetting device Hannes Reinecke
2022-05-03 14:13   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 16/24] aic79xx: " Hannes Reinecke
2022-05-03 14:17   ` Christoph Hellwig
2022-05-03 15:25   ` Johannes Thumshirn
2022-05-02 21:38 ` [PATCH 17/24] snic: reserve tag for TMF Hannes Reinecke
2022-05-03 14:18   ` Christoph Hellwig
2022-05-03 15:41   ` Johannes Thumshirn
2022-05-03 16:18   ` Bart Van Assche
2022-05-03 18:31     ` Hannes Reinecke
2022-05-03 20:09       ` Bart Van Assche
2022-05-06 13:28   ` John Garry
2022-05-07  7:32     ` Hannes Reinecke
2022-05-09  6:44       ` John Garry
2022-05-02 21:38 ` [PATCH 18/24] snic: use dedicated device reset command Hannes Reinecke
2022-05-03 14:19   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 19/24] snic: Use scsi_host_busy_iter() to traverse commands Hannes Reinecke
2022-05-03 14:19   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 20/24] sym53c8xx_2: split off bus reset from host reset Hannes Reinecke
2022-05-03 14:20   ` Christoph Hellwig
2022-05-03 15:42   ` Johannes Thumshirn
2022-05-02 21:38 ` [PATCH 21/24] ips: Do not try to abort command " Hannes Reinecke
2022-05-03 14:20   ` Christoph Hellwig
2022-05-03 15:43   ` Johannes Thumshirn
2022-05-02 21:38 ` [PATCH 22/24] qla1280: separate out host reset function from qla1280_error_action() Hannes Reinecke
2022-05-03 14:20   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 23/24] megaraid: pass in NULL scb for host reset Hannes Reinecke
2022-05-03 14:20   ` Christoph Hellwig
2022-05-03 16:09   ` Johannes Thumshirn
2022-05-02 21:38 ` Hannes Reinecke [this message]
2022-05-03 14:21   ` [PATCH 24/24] mpi3mr: split off bus_reset function from host_reset Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2022-05-03 20:06 [PATCHv2 00/24] scsi: EH rework prep patches, part 1 Hannes Reinecke
2022-05-03 20:07 ` [PATCH 24/24] mpi3mr: split off bus_reset function from host_reset Hannes Reinecke

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=20220502213820.3187-25-hare@suse.de \
    --to=hare@suse.de \
    --cc=hch@lst.de \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=kashyap.desai@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sathya.prakash@broadcom.com \
    --cc=sreekanth.reddy@broadcom.com \
    --cc=sumit.saxena@broadcom.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