From: Hannes Reinecke <hare@suse.de>
To: John Garry <john.garry@huawei.com>,
"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.com>
Subject: Re: [PATCH 17/24] snic: reserve tag for TMF
Date: Sat, 7 May 2022 09:32:44 +0200 [thread overview]
Message-ID: <42bded36-5125-e9c4-85ef-ab490612a550@suse.de> (raw)
In-Reply-To: <39ac80da-ce97-55e5-4fb7-5bab02a191ea@huawei.com>
On 5/6/22 06:28, John Garry wrote:
>> diff --git a/drivers/scsi/snic/snic_main.c
>> b/drivers/scsi/snic/snic_main.c
>> index 29d56396058c..f344cbc27923 100644
>> --- a/drivers/scsi/snic/snic_main.c
>> +++ b/drivers/scsi/snic/snic_main.c
>> @@ -512,6 +512,9 @@ snic_probe(struct pci_dev *pdev, const struct
>> pci_device_id *ent)
>> max_t(u32, SNIC_MIN_IO_REQ, max_ios));
>> snic->max_tag_id = shost->can_queue;
>> + /* Reserve one reset command */
>> + shost->can_queue--;
>> + snic->tmf_tag_id = shost->can_queue;
>> shost->max_lun = snic->config.luns_per_tgt;
>> shost->max_id = SNIC_MAX_TARGET;
>> diff --git a/drivers/scsi/snic/snic_scsi.c
>> b/drivers/scsi/snic/snic_scsi.c
>> index 5f17666f3e1d..e18c8c5e4b46 100644
>> --- a/drivers/scsi/snic/snic_scsi.c
>> +++ b/drivers/scsi/snic/snic_scsi.c
>> @@ -1018,17 +1018,6 @@ snic_hba_reset_cmpl_handler(struct snic *snic,
>> struct snic_fw_req *fwreq)
>> "reset_cmpl: type = %x, hdr_stat = %x, cmnd_id = %x,
>> hid = %x, ctx = %lx\n",
>> typ, hdr_stat, cmnd_id, hid, ctx);
>> - /* spl case, host reset issued through ioctl */
>> - if (cmnd_id == SCSI_NO_TAG) {
>> - rqi = (struct snic_req_info *) ctx;
>> - SNIC_HOST_INFO(snic->shost,
>> - "reset_cmpl:Tag %d ctx %lx cmpl stat %s\n",
>> - cmnd_id, ctx, snic_io_status_to_str(hdr_stat));
>> - sc = rqi->sc;
>> -
>> - goto ioctl_hba_rst;
>> - }
>> -
>> if (cmnd_id >= snic->max_tag_id) {
>> SNIC_HOST_ERR(snic->shost,
>> "reset_cmpl: Tag 0x%x out of Range,HdrStat %s\n",
>> @@ -1039,7 +1028,6 @@ snic_hba_reset_cmpl_handler(struct snic *snic,
>> struct snic_fw_req *fwreq)
>> }
>> sc = scsi_host_find_tag(snic->shost, cmnd_id);
>> -ioctl_hba_rst:
>> if (!sc) {
>> atomic64_inc(&snic->s_stats.io.sc_null);
>> SNIC_HOST_ERR(snic->shost,
>> @@ -1725,7 +1713,7 @@ snic_dr_clean_single_req(struct snic *snic,
>> {
>> struct snic_req_info *rqi = NULL;
>> struct snic_tgt *tgt = NULL;
>> - struct scsi_cmnd *sc = NULL;
>> + struct scsi_cmnd *sc;
>> spinlock_t *io_lock = NULL;
>> u32 sv_state = 0, tmf = 0;
>> DECLARE_COMPLETION_ONSTACK(tm_done);
>> @@ -2238,13 +2226,6 @@ snic_issue_hba_reset(struct snic *snic, struct
>> scsi_cmnd *sc)
>> goto hba_rst_end;
>> }
>> - if (snic_cmd_tag(sc) == SCSI_NO_TAG) {
>> - memset(scsi_cmd_priv(sc), 0,
>> - sizeof(struct snic_internal_io_state));
>> - SNIC_HOST_INFO(snic->shost, "issu_hr:Host reset thru ioctl.\n");
>> - rqi->sc = sc;
>> - }
>> -
>> req = rqi_to_req(rqi);
>> io_lock = snic_io_lock_hash(snic, sc);
>> @@ -2319,11 +2300,13 @@ snic_issue_hba_reset(struct snic *snic, struct
>> scsi_cmnd *sc)
>> } /* end of snic_issue_hba_reset */
>> int
>> -snic_reset(struct Scsi_Host *shost, struct scsi_cmnd *sc)
>> +snic_reset(struct Scsi_Host *shost)
>> {
>> struct snic *snic = shost_priv(shost);
>> + struct scsi_cmnd *sc = NULL;
>> enum snic_state sv_state;
>> unsigned long flags;
>> + u32 start_time = jiffies;
>> int ret = FAILED;
>> /* Set snic state as SNIC_FWRESET*/
>> @@ -2348,6 +2331,18 @@ snic_reset(struct Scsi_Host *shost, struct
>> scsi_cmnd *sc)
>> while (atomic_read(&snic->ios_inflight))
>> schedule_timeout(msecs_to_jiffies(1));
>> + sc = scsi_host_find_tag(shost, snic->tmf_tag_id);
>
> Maybe I am missing something but this does not seem right. As I see,
> blk-mq has driver tags in range [0, snic->tmf_tag_id - 1], so we cannot
> call scsi_host_find_tag() -> blk_mq_unique_tag_to_tag(snic->tmf_tag_id)
>
We do decrease 'can_queue' by '1' just at the start of this patch, hence
the last tag is always available for TMF.
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
next prev parent reply other threads:[~2022-05-07 7:32 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 [this message]
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 ` [PATCH 24/24] mpi3mr: split off bus_reset function from host_reset Hannes Reinecke
2022-05-03 14:21 ` 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:06 ` [PATCH 17/24] snic: reserve tag for TMF 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=42bded36-5125-e9c4-85ef-ab490612a550@suse.de \
--to=hare@suse.de \
--cc=hare@suse.com \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=john.garry@huawei.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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