public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bart.vanassche@gmail.com>
To: Damien Le Moal <dlemoal@kernel.org>,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org,
	John Garry <john.g.garry@oracle.com>,
	Hannes Reinecke <hare@suse.de>,
	Christoph Hellwig <hch@infradead.org>,
	Jens Axboe <axboe@kernel.dk>, Ming Lei <ming.lei@redhat.com>,
	"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Subject: Re: [PATCH v4 6/6] scsi: core: Improve IOPS in case of host-wide tags
Date: Fri, 19 Dec 2025 16:05:21 -0800	[thread overview]
Message-ID: <ddf72e7a-a5a0-48d0-8714-9f3caa4345bb@gmail.com> (raw)
In-Reply-To: <074e472e-4320-4d42-b4ac-a1fa7585e2b6@kernel.org>

On 12/19/25 3:06 PM, Damien Le Moal wrote:
> On 12/20/25 02:35, Bart Van Assche wrote:
>> On 12/16/25 7:24 PM, Damien Le Moal wrote:
>>> On 12/17/25 07:30, Bart Van Assche wrote:
>>>> The SCSI core uses the budget map to restrict the number of commands
>>>> that are in flight per logical unit. That limit check can be left out if
>>>> host->cmd_per_lun >= host->can_queue and if the host tag set is shared
>>>> across all hardware queues or if there is only one hardware queue  Since
>>>
>>> Missing a period at the end of the sentence (before Since). But more
>>> importantly, this does not explain why the above is true, and frankly, I do not
>>> see it...
>> Hi Damien,
>>
>> The purpose of the SCSI device budget map is to prevent that the queue
>> depth limit for that SCSI device is exceeded. If there is only a single
>> hardware queue or there is a host-wide tag set and host->cmd_per_lun is
>> identical to host->can_queue, it is not possible that the queue depth
>> for a single SCSI device is exceeded and hence the SCSI device budget
>> map is not needed.
> 
> Still very confusing because as far as I understand things, a host is not
> necessarily a LUN/block device (you can have several devices/LUNs on the same
> host). So in general host->can_queue != device max queue depth. Also, I am not
> entirely sure if host->cmd_per_lun and max queue depth of the LUN are the same
> thing, given that SCSI does not define a maximum device queue depth...

Hi Damien,

There are important use cases, e.g. the UFS driver, where
host->can_queue is identical to the maximum queue depth per logical
unit. A single UFS device typically supports multiple logical units.

>> Please help with reviewing the ATA patch in this series.
> 
> For AHCI, we are dealing with single queue devices, always. For this case, I do
> not think that the scsi budget is needed since we will always have scsi tag ==
> ATA tag, between 0 and 31. So if you can allocate a tag, you can always submit
> the command.
> 
> But for libsas HBAs, I am not sure at all if what you did is solid/works,
> because I still do not understand it. Please provide more detailed explanations
> in your code (comments) and commit messages to better explain what you are doing
> is safe.

I plan to modify scsi_needs_budget_map() in patch 6/6 such that SCSI
hosts that define a .change_queue_depth method and/or that set
.track_queue_depth. This will prevent that this optimization applies to
libsas HBAs. From include/scsi/libsas.h:

#define __LIBSAS_SHT_BASE						\
	[ ... ]
	.change_queue_depth		= sas_change_queue_depth,	\
	[ ... ]

Thanks,

Bart.

  reply	other threads:[~2025-12-20  0:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-16 22:30 [PATCH v4 0/6] Increase SCSI IOPS Bart Van Assche
2025-12-16 22:30 ` [PATCH v4 1/6] block: Rename busy_tag_iter_fn into blk_mq_rq_iter_fn Bart Van Assche
2025-12-16 22:30 ` [PATCH v4 2/6] block: Introduce __blk_mq_tagset_iter() Bart Van Assche
2025-12-16 22:30 ` [PATCH v4 3/6] block: Introduce blk_mq_tagset_iter() Bart Van Assche
2025-12-16 22:30 ` [PATCH v4 4/6] ata: libata: Set .needs_budget_token Bart Van Assche
2025-12-16 22:30 ` [PATCH v4 5/6] scsi: core: Generalize scsi_device_busy() Bart Van Assche
2025-12-16 22:30 ` [PATCH v4 6/6] scsi: core: Improve IOPS in case of host-wide tags Bart Van Assche
2025-12-17  3:24   ` Damien Le Moal
2025-12-19 17:35     ` Bart Van Assche
2025-12-19 23:06       ` Damien Le Moal
2025-12-20  0:05         ` Bart Van Assche [this message]
2025-12-20  0:13           ` Damien Le Moal
2025-12-20  0:28             ` Bart Van Assche

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=ddf72e7a-a5a0-48d0-8714-9f3caa4345bb@gmail.com \
    --to=bart.vanassche@gmail.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=axboe@kernel.dk \
    --cc=dlemoal@kernel.org \
    --cc=hare@suse.de \
    --cc=hch@infradead.org \
    --cc=john.g.garry@oracle.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ming.lei@redhat.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