On 03/11/2021 09:40, Christoph Hellwig wrote: > On Tue, Nov 02, 2021 at 05:05:29PM -0700, Bart Van Assche wrote: >> - req = blk_get_request(q, REQ_OP_DRV_OUT, 0); >> + req = blk_mq_alloc_request(q, REQ_OP_DRV_OUT, BLK_MQ_REQ_RESERVED); > > blk_get_request will be gone in 5.16-rc, so this won't apply. > > But more importantly: SCSI LLDDs have absolutel no business calling > blk_get_request or blk_mq_alloc_request directly, but as usual UFS is > completely fucked up here. The UFS driver does not issue device commands to the block layer. blk_get_request() is used only to get a free slot. > Please add a SCSI midlayer helper to allocate the reserved tags, and > switch _all_ of this UFS we're sending our own commands crap to it > so it doesn't mix with the actual SCSI requests. It doesn't mix them. > We might or might not > want a separate request_queue for them as well as non-SCSI requests > really should not show up in ->queuecommand. Already has one (hba->cmd_queue), but as noted above, device commands aren't issued to it at the moment - they are sent directly. > Hannes and John have been > looking into this for a while and we need to sort this out properly. To avoid involving SCSI, since device commands aren't issued to the block layer, the UFS driver could instead keep 1 slot for itself (i.e. reduce the number of tags by one), and drop blk_get_request(); noting that currently only 1 device command is sent at a time due to hba->dev_cmd.lock mutex.