Re: [PATCH 10/18] scsi: implement reserved command handling

Hannes Reinecke
2021-05-04T18:09:55Z

On 5/4/21 6:59 PM, Bart Van Assche wrote:
> On 5/4/21 6:12 AM, Hannes Reinecke wrote:
>> On 5/4/21 12:55 PM, John Garry wrote:
>>> On 04/05/2021 07:17, Hannes Reinecke wrote:
>>>> On 5/4/21 5:20 AM, Bart Van Assche wrote:
>>>>> On 5/3/21 8:03 AM, Hannes Reinecke wrote:
>>>>>> These commands are set aside before allocating the block-mq tag
>>>>>> bitmap,
>>>>>> so they'll never show up as busy in the tag map.
>>>>>
>>>>> That doesn't sound correct to me. Should the above perhaps be changed
>>>>> into "blk_mq_start_request() is never called for internal commands so
>>>>> they'll never show up as busy in the tag map"?
>>>>>
>>>> Yes, will do.
>>>
>>> So why don't these - or shouldn't these - turn up in the busy tag map?
>>>
>>> One of the motivations to use these block requests for internal
>>> commands is that we can take advantage of the block layer handling for
>>> CPU hotplug for MQ hosts, i.e. if blk-mq can't see these are inflight,
>>> then they would be missed in blk_mq_hctx_notify_offline() ->
>>> blk_mq_hctx_has_requests(), right? And who knows what else...
>>>
>> Oh, but of course it's possible to call 'start' on these requests to
>> have them counted in the busy map.
>> I just didn't see the need for it until now, that's all.
>
> This is possible but this will require careful review of at least the
> following code paths such that nothing unexpected happens for internal
> commands:
> * The SCSI timeout code.
> * All blk_mq_tagset_busy_iter() and scsi_host_busy_iter() callers. As an
> example, scsi_host_busy() must not include LLD-internal commands.
>
Oh, _that_ is easy. These are reserved commands, which will have the
last bool argument to the iter functions set to 'true'.

bool (*fn)(struct scsi_cmnd *, void *, bool)

So we just need to return from the iter if the last argument is true.

Cheers,

Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions Germany GmbH, 90409 Nürnberg
GF: F. Imendörffer, HRB 36809 (AG Nürnberg)