From: Ming Lei <ming.lei@redhat.com>
To: John Garry <john.garry@huawei.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
James Bottomley <James.Bottomley@hansenpartnership.com>,
Jens Axboe <axboe@kernel.dk>,
"Ewan D . Milne" <emilne@redhat.com>,
Omar Sandoval <osandov@fb.com>, Christoph Hellwig <hch@lst.de>,
Kashyap Desai <kashyap.desai@broadcom.com>,
Hannes Reinecke <hare@suse.de>,
Laurence Oberman <loberman@redhat.com>,
Bart Van Assche <bart.vanassche@wdc.com>
Subject: Re: [PATCH V4 1/2] scsi: core: avoid host-wide host_busy counter for scsi_mq
Date: Sat, 26 Oct 2019 05:53:11 +0800 [thread overview]
Message-ID: <20191025215311.GA7076@ming.t460p> (raw)
In-Reply-To: <36eb068c-37ed-756f-17ef-113aa55a17d0@huawei.com>
On Fri, Oct 25, 2019 at 11:13:12AM +0100, John Garry wrote:
> On 25/10/2019 10:43, Ming Lei wrote:
> > On Fri, Oct 25, 2019 at 09:58:16AM +0100, John Garry wrote:
> > >
> > > > > In scsi_host.h, we have for scsi_host_template.can_queue: "It is set to the
> > > > > maximum number of simultaneous commands a given host adapter will accept.",
> > > > > so that should be honoured.
> > > >
> > >
> > > Hi Ming,
> > >
> > > > That words should have been changed to:
> > > >
> > > > "It is set to the maximum number of simultaneous commands a given host adapter's
> > > > hw queue will accept."
> > >
>
> Hi Ming,
>
> > > I find this definition misleading. As you know, some MQ SAS HBAs can accept
> > > .can_queue commands on a given hw queue, but can still only accept
> > > .can_queue commands over all hw queues.
> >
> > I don't know there are such MQ HBA driver in tree,
>
> HiSilicon SAS HBA can accept 4096 commands on any given hw queue but can
> also only accept 4096 commands over all queues simultaneously. In fact, the
> hw queue depth is configurable.
>
> That's why I think that the definition is misleading.
That is why we call HiSilicon SAS is SQ device, still from
blk-mq/scsi-mq viewpoint, :-)
>
> I think I sound like a broken record now :)
>
> at least that is the
> > current blk-mq/scsi-mq model: each hw queue has its own independent
> > tags, so there can't be the limit for MQ HBA, which should allow to
> > accept (.can_queue * nr_hw_queues) commands. And I did hear people
> > complains bad performance caused by the atomic .host_busy counter.
> >
>
> ok, seems reasonable for now.
>
> > If you are talking about the current SQ(from blk-mq or scsi-mq viewpoint) HBA
> > which has multiple reply queue(HPSA, hisilicon SAS, mpt3sas, and megaraid_sas),
> > they are just the special type. According to scsi-mq's model, they should
> > belong to SQ HBA.
> >
> > >
> > > >
> > > > >
> > > > > And Scsi_host.nr_hw_queues: "it is assumed that each hardware queue has a
> > > > > queue depth of can_queue. In other words, the total queue depth per host is
> > > > > nr_hw_queues * can_queue."
> > > >
> > > > The above is correct.
> > > >
> > > > >
> > > > > I don't read "total queue depth per host" same as "maximum number of
> > > > > simultaneous commands a given host adapter will accept". If anything, the
> > > > > nr_hw_queues comment is ambiguous.
> > > > >
> > > > > >
> > > > > > The point is simple, because each hw queue has its own independent tags,
> > > > > > that is why I mentioned your Hisilicon SAS can't be converted to MQ
> > > > > > easily cause this hardware has only single shared tags.
> > > > >
> > > > > Please be aware that HiSilicon SAS HW would not be unique for SCSI HBAs in
> > > > > this regard, in that the unique hostwide tag is not just for HBA HW IO
> > > > > management, but also is used as the tag for SCSI TMFs.
> > > >
> > > > Right.
> > > >
> > > > >
> > > > > Just checking mpt3sas seems similar:
> > > > >
> > > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/scsi/mpt3sas/mpt3sas_scsih.c#n2918
> > > > >
> > > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/scsi/mpt3sas/mpt3sas_base.c#n3546
> > > >
> > > > Not only mpt3sas, there are also HPSA and more. And these drivers have to
> > > > support single hw queue of blk-mq, instead of real MQ. And the reason is that
> > > > these HBA has single tags.
> > >
> > > We should be able to do better than that.
> > >
> > > For a start, at least doesn't the check you remove in scsi_host_is_busy()
> > > limit commands the HBA accepts to .can_queue?
> >
> > As I mentioned above, that is current blk-mq/scsi-mq's model, each hw
> > queue has its own independent tags, so the check really doesn't make
> > sense. >
> > >
> > > And if you make the change in this patch, then the changes to improve blk-mq
> > > for CPU hotplug are pointless, as we can't change the SAS HBAs to expose
> > > multiple queues.
> >
> > No, just the small number of special type SCSI HBAs with multiple reply queue
> > and single tags can't benefit from the patchset of 'improve blk-mq for CPU hotplug',
> > and all other normal MQ device/drivers do get improved wrt. CPU hotplug.
> >
>
> TBH, I'm not sure on the group of SCSI drivers which could benefit then.
>
> As I see, only qla2xxx driver sets Scsi_host.nr_hw_queues and also uses
> pci_alloc_irq_vectors_affinity().
Other non-SCSI drivers can benefit from that patchset too, such as NVMe.
Except for qla2xxx, there are also lpfc, virtio-scsi and smartpqi, and
there will be more since I heard that new version of one other popular
SCSI HBA will support real MQ.
>
> > We have tried hosttags approach for the several drivers, but looks it is
> > too messy. Given there are only 3 or 4 such device, we still can improve
> > them via driver private approach in future if no generic way is doable.
>
> ok, I'd rather not go on this path - you may say I'm digging my head in the
> sand. Anyway, I'll continue to support the 'improve blk-mq for CPU hotplug'
> effort.
I meant that way is the last straw, :-)
Thanks,
Ming
next prev parent reply other threads:[~2019-10-25 21:53 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-09 9:32 [PATCH V4 0/2] scsi: avoid atomic operations in IO path Ming Lei
2019-10-09 9:32 ` [PATCH V4 1/2] scsi: core: avoid host-wide host_busy counter for scsi_mq Ming Lei
2019-10-09 16:14 ` Bart Van Assche
2019-10-23 8:52 ` John Garry
2019-10-24 0:58 ` Ming Lei
2019-10-24 9:19 ` John Garry
2019-10-24 21:24 ` Ming Lei
2019-10-25 8:58 ` John Garry
2019-10-25 9:43 ` Ming Lei
2019-10-25 10:13 ` John Garry
2019-10-25 21:53 ` Ming Lei [this message]
2019-10-28 9:42 ` John Garry
2019-10-09 9:32 ` [RFC PATCH V4 2/2] scsi: core: don't limit per-LUN queue depth for SSD Ming Lei
2019-10-09 16:05 ` Bart Van Assche
2019-10-10 0:43 ` Ming Lei
2019-10-17 18:30 ` Kashyap Desai
2019-10-23 1:28 ` Ming Lei
2019-10-23 7:46 ` Kashyap Desai
2019-10-24 1:09 ` Ming Lei
2019-10-25 10:04 ` Kashyap Desai
2019-10-25 21:58 ` Ming Lei
2019-11-04 9:30 ` Kashyap Desai
2019-11-05 0:23 ` Ming Lei
2019-10-23 0:30 ` [scsi] cc2f854c79: suspend_stress.fail kernel test robot
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=20191025215311.GA7076@ming.t460p \
--to=ming.lei@redhat.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=axboe@kernel.dk \
--cc=bart.vanassche@wdc.com \
--cc=emilne@redhat.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=john.garry@huawei.com \
--cc=kashyap.desai@broadcom.com \
--cc=linux-scsi@vger.kernel.org \
--cc=loberman@redhat.com \
--cc=martin.petersen@oracle.com \
--cc=osandov@fb.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