Re: [PATCH 2/2] virtio_scsi: implement request batching

From: Paolo Bonzini
Date: Fri May 31 2019 - 05:07:01 EST


On 30/05/19 19:28, Bart Van Assche wrote:
> On 5/30/19 4:28 AM, Paolo Bonzini wrote:
>> @@ -531,7 +547,8 @@ static int virtscsi_queuecommand(struct Scsi_Host
>> *shost,
>> ÂÂÂÂÂÂÂÂÂ req_size = sizeof(cmd->req.cmd);
>> ÂÂÂÂÂ }
>> Â -ÂÂÂ ret = virtscsi_kick_cmd(req_vq, cmd, req_size,
>> sizeof(cmd->resp.cmd));
>> +ÂÂÂ kick = (sc->flags & SCMD_LAST) != 0;
>> +ÂÂÂ ret = virtscsi_add_cmd(req_vq, cmd, req_size,
>> sizeof(cmd->resp.cmd), kick);
>
> Have you considered to have the SCSI core call commit_rqs() if bd->last
> is true? I think that would avoid that we need to introduce the
> SCMD_LAST flag and that would also avoid that every SCSI LLD that
> supports a commit_rqs callback has to introduce code to test the
> SCMD_LAST flag.

That is slightly worse for performance, as it unlocks and re-locks the
spinlock.

Paolo