From: Christoph Hellwig <hch@lst.de>
To: Hannes Reinecke <hare@suse.de>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
Christoph Hellwig <hch@lst.de>,
James Bottomley <james.bottomley@hansenpartnership.com>,
Sreekanth Reddy <sreekanth.reddy@broadcom.com>,
Kashyap Desai <kashyap.desai@broadcom.com>,
Sathya Prakash <sathya.prakash@broadcom.com>,
linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.com>
Subject: Re: [PATCHv2 09/11] mpt3sas: lockless command submission for scsi-mq
Date: Fri, 17 Feb 2017 09:54:10 +0100 [thread overview]
Message-ID: <20170217085410.GD18443@lst.de> (raw)
In-Reply-To: <1487319790-97340-10-git-send-email-hare@suse.de>
On Fri, Feb 17, 2017 at 09:23:08AM +0100, Hannes Reinecke wrote:
> Enable lockless command submission for scsi-mq by moving the
> command structure into the payload for struct request.
>
> Signed-off-by: Hannes Reinecke <hare@suse.com>
> ---
> drivers/scsi/mpt3sas/mpt3sas_base.c | 123 ++++-----
> drivers/scsi/mpt3sas/mpt3sas_base.h | 13 +-
> drivers/scsi/mpt3sas/mpt3sas_ctl.c | 85 ++++--
> drivers/scsi/mpt3sas/mpt3sas_scsih.c | 460 ++++++++++++++-----------------
> drivers/scsi/mpt3sas/mpt3sas_warpdrive.c | 20 +-
> 5 files changed, 330 insertions(+), 371 deletions(-)
>
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
> index dec86c4..e9470a3 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
> @@ -865,9 +865,17 @@ static int mpt3sas_remove_dead_ioc_func(void *arg)
> struct scsiio_tracker *
> mpt3sas_get_st_from_smid(struct MPT3SAS_ADAPTER *ioc, u16 smid)
> {
> + u32 unique_tag;
> + struct scsi_cmnd *cmd;
> +
> WARN_ON(!smid);
> WARN_ON(smid >= ioc->hi_priority_smid);
> - return &ioc->scsi_lookup[smid - 1];
> + unique_tag = smid - 1;
> + cmd = scsi_host_find_tag(ioc->shost, unique_tag);
> + if (cmd)
> + return scsi_cmd_priv(cmd);
> +
> + return NULL;
> }
>
> /**
> @@ -2343,34 +2351,23 @@ struct scsiio_tracker *
> mpt3sas_base_get_smid_scsiio(struct MPT3SAS_ADAPTER *ioc, u8 cb_idx,
> struct scsi_cmnd *scmd)
> {
> - unsigned long flags;
> struct scsiio_tracker *request;
> u16 smid;
>
> - spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
> - if (list_empty(&ioc->free_list)) {
> - spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
> - pr_err(MPT3SAS_FMT "%s: smid not available\n",
> - ioc->name, __func__);
> - return 0;
> - }
> -
> if (!scmd) {
> - /* ioctl command, always use the first slot */
> - request = ioc->lookup[0];
> - request->scmd = NULL;
> + smid = 1;
> + request = mpt3sas_get_st_from_smid(ioc, smid);
How is this going to work? mpt3sas_get_st_from_smid fails if we
don't find a block layer tag derived from smid?
> /**
> * mpt3sas_base_free_smid - put smid back on free_list
> * @ioc: per adapter object
> @@ -2428,22 +2441,21 @@ struct scsiio_tracker *
> unsigned long flags;
> int i;
>
> if (smid < ioc->hi_priority_smid) {
> + struct scsiio_tracker *st;
>
> + st = mpt3sas_get_st_from_smid(ioc, smid);
> + if (WARN_ON(!st)) {
> + _base_recovery_check(ioc);
> + return;
> + }
> + mpt3sas_base_clear_st(ioc, st);
> _base_recovery_check(ioc);
st = mpt3sas_get_st_from_smid(ioc, smid);
if (!WARN_ON_ONCE(!st))
mpt3sas_base_clear_st(ioc, st);
_base_recovery_check(ioc);
return;
> /* pending command count */
> - spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
> - for (i = 0; i < ioc->scsiio_depth; i++)
> - if (ioc->scsi_lookup[i].cb_idx != 0xFF)
> - ioc->pending_io_count++;
> - spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
> + blk_mq_tagset_busy_iter(&ioc->shost->tag_set,
> + _count_pending, ioc);
You can't rely on blk-mq being used, and we'd really want to avoid
layering violations like this anyway.
next prev parent reply other threads:[~2017-02-17 8:54 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-17 8:22 [PATCHv2 00/11] mpt3sas: Full mq support, part 1 Hannes Reinecke
2017-02-17 8:23 ` [PATCHv2 01/11] mpt3sas: switch to pci_alloc_irq_vectors Hannes Reinecke
2017-02-17 8:23 ` [PATCHv2 02/11] mpt3sas: set default value for cb_idx Hannes Reinecke
2017-02-17 8:23 ` [PATCHv2 03/11] mpt3sas: use 'list_splice_init()' Hannes Reinecke
2017-02-17 8:33 ` Christoph Hellwig
2017-02-17 8:23 ` [PATCHv2 04/11] mpt3sas: separate out _base_recovery_check() Hannes Reinecke
2017-02-17 8:23 ` [PATCHv2 05/11] mpt3sas: open-code _scsih_scsi_lookup_get() Hannes Reinecke
2017-02-17 8:23 ` [PATCHv2 06/11] mpt3sas: Introduce mpt3sas_get_st_from_smid() Hannes Reinecke
2017-02-17 9:35 ` Johannes Thumshirn
2017-02-17 9:40 ` Johannes Thumshirn
2017-02-17 8:23 ` [PATCHv2 07/11] mpt3sas: check command status before attempting abort Hannes Reinecke
2017-02-17 8:35 ` Christoph Hellwig
2017-02-17 8:39 ` Hannes Reinecke
2017-02-17 8:23 ` [PATCHv2 08/11] mpt3sas: always use smid 1 for ioctl passthrough Hannes Reinecke
2017-02-17 8:45 ` Christoph Hellwig
2017-02-17 8:52 ` Hannes Reinecke
2017-02-17 8:23 ` [PATCHv2 09/11] mpt3sas: lockless command submission for scsi-mq Hannes Reinecke
2017-02-17 8:54 ` Christoph Hellwig [this message]
2017-02-17 9:03 ` Hannes Reinecke
2017-02-17 9:09 ` Christoph Hellwig
2017-02-17 8:23 ` [PATCHv2 10/11] scsi: allocate reserved commands Hannes Reinecke
2017-02-17 8:55 ` Christoph Hellwig
2017-02-17 9:00 ` Hannes Reinecke
2017-02-17 12:37 ` Christoph Hellwig
2017-02-17 8:23 ` [PATCHv2 11/11] mpt3sas: register " Hannes Reinecke
2017-02-17 12:38 ` Christoph Hellwig
2017-02-17 13:18 ` Hannes Reinecke
2017-02-17 13:23 ` Christoph Hellwig
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=20170217085410.GD18443@lst.de \
--to=hch@lst.de \
--cc=hare@suse.com \
--cc=hare@suse.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 \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.