On 1/28/19 3:21 PM, Christoph Hellwig wrote:
On Mon, Jan 28, 2019 at 03:14:19PM +0100, Hannes Reinecke wrote:
The most straigthforward approach would be something like
'blk_mq_get_private_request()' (ie similar to the existing
'blk_mq_get_request()'). But that requires a working request queue and will
expose a 'struct request', (and by implication a struct scsi_cmnd).
The same interface as we do in other block drivers:
blk_mq_alloc_request with BLK_MQ_REQ_RESERVED. And yes, this gets us
a struct scsi_cmnd, which is exactly what we need.
Well ... not always.
Some drivers (eg aacraid or hpsa) use internal commands to query
hardware, handle events and the like.
These commands use the same infrastructure than normal SCSI commands,
and hence need to use the same tag pool. But they are most definitely
_not_ SCSI commands, and won't be needing any of those allocations.
For most users of private tags/commands we need to be the queue working
_prior_ to setting up the 'normal' request queues, as the commands are used
to fetch information from the hardware required to setup the queues.
And typically the 'private' commands are driver-specific, ie the payload
_after_ the scsi command, so the allocation for the request and the scsi
command is pretty much pointless here.
And in that case you want a request_queue that is host-wide for these
commands as you obviously don't have the per-LU regular request_queues.
Yes.
We actually have a few uses like that in existing old SCSI drivers,
where we create a fake struct scsi_device to send command to the host,
which doesn't sound all that bad except for the fact that we need an
escape for the lun value to avoid getting in the way.
> In general I'm not sure this is the most common use case - I'd expect
the most common use to be proper implementing TMFs..
Command abort and device reset being the most common, indeed, and can be
handled by creating an additional 'admin' queue.
The more interesting cases will be where internal commands are used to
retrieve configuration information. If we were to go with the admin
queue approach we'll need to reconfigure the tagset after issuing those
commands. Possible, but not entirely trivial.
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare@xxxxxxx +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)