All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Hannes Reinecke <hare@suse.de>
Cc: Christoph Hellwig <hch@lst.de>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	James Bottomley <james.bottomley@hansenpartnership.com>,
	linux-scsi@vger.kernel.org,
	Sreekanth Reddy <sreekanth.reddy@broadcom.com>,
	Kashyap Desai <kashyap.desai@broadcom.com>,
	Sathya Prakash <sathya.prakash@broadcom.com>,
	Hannes Reinecke <hare@suse.com>
Subject: Re: [PATCHv3 10/10] mpt3sas: lockless command submission for scsi-mq
Date: Tue, 21 Feb 2017 16:03:49 +0100	[thread overview]
Message-ID: <20170221150349.GA28150@lst.de> (raw)
In-Reply-To: <77d6469d-1e96-3136-2753-2dcf1aed989c@suse.de>

On Tue, Feb 21, 2017 at 03:58:08PM +0100, Hannes Reinecke wrote:
> >> +	if (ioc->shost->use_blk_mq) {
> >> +		u32 unique_tag = blk_mq_unique_tag(scmd->request);
> >> +
> >> +		tag = blk_mq_unique_tag_to_tag(unique_tag);
> >> +	} else
> >> +		tag = scmd->request->tag;
> > 
> > All that unique_tag stuff is only required for SCSI LLDDs that
> > set nr_hw_queues > 1, which isn't the ase with this patch.
> > 
> Abstraction.
> I would not presume anything about SCSI-MQ/block-mq here; calling
> blk_mq_unique_tag() insulates me against any changes blk-mq might be
> doing for the tag allocation or management.

cmd->request->tag has the same meaning with blk-mq or not, so this
check is obviously wrong.

> >> +	ioc->shost->reserved_cmds = INTERNAL_SCSIIO_CMDS_COUNT;
> > 
> > Why?  You're never calling the block layer to allocate a reserved
> > request.
> > 
> The idea was to have a stub command for any ioctl passthrough commands,
> so they'll show up when traversing the list of active commands (hence it
> always uses 'scsiio_depth' and not 'can_queue').

Sure.  But setting reserved_cmds has nothing to do with that - it only
sets requests aside so they can be allocated using BLK_MQ_REQ_RESERVED.

If you reserve tags for purely driver internal usage without a struct
request just don't advertise them to the block layer at all.  This
is what we do in hpsa, and that's what mpt3sas should do as well.

> >> +		if (ioc->shost->use_blk_mq)
> >> +			smid = 1;
> >> +		else
> >> +			smid = ioc->scsiio_depth - ioc->shost->reserved_cmds;
> > 
> > Huh?  Explanation, please.
> > 
> When enabling reserved tags with blk-mq the reserved tag range is at the
> start of the tagspace; for legacy sq there is no reserved range, but
> 'can_queue' is reduced by the number of reserved commands, effectively
> locating the reserved tag range at the end of the tag space.

internal tag number are a blk-mq implementation detail, and drivers
should not second guess it.  As said above - just don't use the
reserved_cmds field and set the smids aside inside mpt3sas.

> Figuring out if there are still pending commands on the given target.

starget->target_busy

> Figuring out if there are pending commands on that LUN.

sdev->device_busy

      reply	other threads:[~2017-02-21 15:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-21 12:26 [PATCHv3 00/10] mpt3sas: Full mq support, part 1 Hannes Reinecke
2017-02-21 12:27 ` [PATCHv3 01/10] mpt3sas: switch to pci_alloc_irq_vectors Hannes Reinecke
2017-02-22  8:28   ` Christoph Hellwig
2017-02-22  9:06     ` Hannes Reinecke
2017-02-23  0:52     ` Martin K. Petersen
2017-02-23  8:19       ` Sreekanth Reddy
2017-02-21 12:27 ` [PATCHv3 02/10] mpt3sas: set default value for cb_idx Hannes Reinecke
2017-02-21 12:27 ` [PATCHv3 03/10] mpt3sas: use 'list_splice_init()' Hannes Reinecke
2017-02-21 12:27 ` [PATCHv3 04/10] mpt3sas: separate out _base_recovery_check() Hannes Reinecke
2017-02-21 12:27 ` [PATCHv3 05/10] mpt3sas: open-code _scsih_scsi_lookup_get() Hannes Reinecke
2017-02-21 12:27 ` [PATCHv3 06/10] mpt3sas: Introduce mpt3sas_get_st_from_smid() Hannes Reinecke
2017-02-21 12:27 ` [PATCHv3 07/10] mpt3sas: check command status before attempting abort Hannes Reinecke
2017-02-22  8:17   ` Sreekanth Reddy
2017-02-21 12:27 ` [PATCHv3 08/10] scsi: allocate reserved commands Hannes Reinecke
2017-02-21 14:13   ` Christoph Hellwig
2017-02-21 12:27 ` [PATCHv3 09/10] mpt3sas: always use first reserved smid for ioctl passthrough Hannes Reinecke
2017-02-21 14:18   ` Christoph Hellwig
2017-02-21 14:45     ` Hannes Reinecke
2017-02-21 12:27 ` [PATCHv3 10/10] mpt3sas: lockless command submission for scsi-mq Hannes Reinecke
2017-02-21 14:34   ` Christoph Hellwig
2017-02-21 14:58     ` Hannes Reinecke
2017-02-21 15:03       ` Christoph Hellwig [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=20170221150349.GA28150@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.