Re: [PATCH V4 1/2] scsi: core: avoid host-wide host_busy counter for scsi_mq

John Garry
2019-10-25T08:58:21Z

>> 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."

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.

>
>>
>> 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?

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.

Thanks,
John

>
> Thanks,
> Ming
>
> .
>