2019-05-30 11:30:34

by Paolo Bonzini

[permalink] [raw]
Subject: [PATCH 0/2] scsi: add support for request batching

This allows a list of requests to be issued, with the LLD only writing
the hardware doorbell when necessary, after the last request was prepared.
This is more efficient if we have lists of requests to issue, particularly
on virtualized hardware, where writing the doorbell is more expensive than
on real hardware.

This applies to any HBA, either singlequeue or multiqueue; the second
patch implements it for virtio-scsi.

Paolo

Paolo Bonzini (2):
scsi_host: add support for request batching
virtio_scsi: implement request batching

drivers/scsi/scsi_lib.c | 37 ++++++++++++++++++++++---
drivers/scsi/virtio_scsi.c | 55 +++++++++++++++++++++++++++-----------
include/scsi/scsi_cmnd.h | 1 +
include/scsi/scsi_host.h | 16 +++++++++--
4 files changed, 89 insertions(+), 20 deletions(-)

--
2.21.0


2019-06-10 13:03:49

by Stefan Hajnoczi

[permalink] [raw]
Subject: Re: [PATCH 0/2] scsi: add support for request batching

On Thu, May 30, 2019 at 01:28:09PM +0200, Paolo Bonzini wrote:
> This allows a list of requests to be issued, with the LLD only writing
> the hardware doorbell when necessary, after the last request was prepared.
> This is more efficient if we have lists of requests to issue, particularly
> on virtualized hardware, where writing the doorbell is more expensive than
> on real hardware.
>
> This applies to any HBA, either singlequeue or multiqueue; the second
> patch implements it for virtio-scsi.
>
> Paolo
>
> Paolo Bonzini (2):
> scsi_host: add support for request batching
> virtio_scsi: implement request batching
>
> drivers/scsi/scsi_lib.c | 37 ++++++++++++++++++++++---
> drivers/scsi/virtio_scsi.c | 55 +++++++++++++++++++++++++++-----------
> include/scsi/scsi_cmnd.h | 1 +
> include/scsi/scsi_host.h | 16 +++++++++--
> 4 files changed, 89 insertions(+), 20 deletions(-)
>
> --
> 2.21.0
>

Reviewed-by: Stefan Hajnoczi <[email protected]>


Attachments:
(No filename) (0.98 kB)
signature.asc (499.00 B)
Download all attachments

2019-06-26 13:53:15

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [PATCH 0/2] scsi: add support for request batching

On 30/05/19 13:28, Paolo Bonzini wrote:
> This allows a list of requests to be issued, with the LLD only writing
> the hardware doorbell when necessary, after the last request was prepared.
> This is more efficient if we have lists of requests to issue, particularly
> on virtualized hardware, where writing the doorbell is more expensive than
> on real hardware.
>
> This applies to any HBA, either singlequeue or multiqueue; the second
> patch implements it for virtio-scsi.
>
> Paolo
>
> Paolo Bonzini (2):
> scsi_host: add support for request batching
> virtio_scsi: implement request batching
>
> drivers/scsi/scsi_lib.c | 37 ++++++++++++++++++++++---
> drivers/scsi/virtio_scsi.c | 55 +++++++++++++++++++++++++++-----------
> include/scsi/scsi_cmnd.h | 1 +
> include/scsi/scsi_host.h | 16 +++++++++--
> 4 files changed, 89 insertions(+), 20 deletions(-)
>


Ping? Are there any more objections?

Paolo

2019-06-26 14:16:17

by Douglas Gilbert

[permalink] [raw]
Subject: Re: [PATCH 0/2] scsi: add support for request batching

On 2019-06-26 9:51 a.m., Paolo Bonzini wrote:
> On 30/05/19 13:28, Paolo Bonzini wrote:
>> This allows a list of requests to be issued, with the LLD only writing
>> the hardware doorbell when necessary, after the last request was prepared.
>> This is more efficient if we have lists of requests to issue, particularly
>> on virtualized hardware, where writing the doorbell is more expensive than
>> on real hardware.
>>
>> This applies to any HBA, either singlequeue or multiqueue; the second
>> patch implements it for virtio-scsi.
>>
>> Paolo
>>
>> Paolo Bonzini (2):
>> scsi_host: add support for request batching
>> virtio_scsi: implement request batching
>>
>> drivers/scsi/scsi_lib.c | 37 ++++++++++++++++++++++---
>> drivers/scsi/virtio_scsi.c | 55 +++++++++++++++++++++++++++-----------
>> include/scsi/scsi_cmnd.h | 1 +
>> include/scsi/scsi_host.h | 16 +++++++++--
>> 4 files changed, 89 insertions(+), 20 deletions(-)
>>
>
>
> Ping? Are there any more objections?

I have no objections, just a few questions.

To implement this is the scsi_debug driver, a per device queue would
need to be added, correct? Then a 'commit_rqs' call would be expected
at some later point and it would drain that queue and submit each
command. Or is the queue draining ongoing in the LLD and 'commit_rqs'
means: don't return until that queue is empty?

So does that mean in the normal (i.e. non request batching) case
there are two calls to the LLD for each submitted command? Or is
'commit_rqs' optional, a sync-ing type command?

Doug Gilbert


2019-06-26 14:51:19

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [PATCH 0/2] scsi: add support for request batching

On 26/06/19 16:14, Douglas Gilbert wrote:
>
> I have no objections, just a few questions.
>
> To implement this is the scsi_debug driver, a per device queue would
> need to be added, correct?

Yes, queuecommand would then return before calling schedule_resp (for
all requests except the one with SCMD_LAST, see later). schedule_resp
would then be called for all requests in a batch.

> Then a 'commit_rqs' call would be expected
> at some later point and it would drain that queue and submit each
> command. Or is the queue draining ongoing in the LLD and 'commit_rqs'
> means: don't return until that queue is empty?

commit_rqs means the former; it is asynchronous.

However, commit_rqs is only called if a request batch fails submission
in the middle of the batch, so the request batch must be sent to the
HBA. If the whole request batch is sent successfully, then the LLD
takes care of sending the batch to the HBA when it sees SCMD_LAST in the
request.

So, in the scsi_debug case schedule_resp would be called for the whole
batch from commit_rqs *and* when queuecommand sees a command with the
SCMD_LAST flag set. This is exactly to avoid having two calls to the
LLD in the case of no request batching.

> So does that mean in the normal (i.e. non request batching) case
> there are two calls to the LLD for each submitted command? Or is
> 'commit_rqs' optional, a sync-ing type command?

It's not syncing. It's mandatory if the queuecommand function observes
SCMD_LAST, not needed at all if queuecommand ignores it. So it's not
needed at all until your driver adds support for batched submission of
requests to the HBA.

(All this is documented by the patches in the comments for struct
scsi_host_template, if those are not clear please reply to patch 1 with
your doubts).

Paolo

2019-06-27 03:38:09

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH 0/2] scsi: add support for request batching


Paolo,

> Ping? Are there any more objections?

It's a core change so we'll need some more reviews. I suggest you
resubmit.

--
Martin K. Petersen Oracle Linux Engineering

2019-06-27 08:18:39

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [PATCH 0/2] scsi: add support for request batching

On 27/06/19 05:37, Martin K. Petersen wrote:
>> Ping? Are there any more objections?
> It's a core change so we'll need some more reviews. I suggest you
> resubmit.

Resubmit exactly the same patches?

Paolo

2019-07-05 07:52:42

by Hannes Reinecke

[permalink] [raw]
Subject: Re: [PATCH 0/2] scsi: add support for request batching

On 6/27/19 10:17 AM, Paolo Bonzini wrote:
> On 27/06/19 05:37, Martin K. Petersen wrote:
>>> Ping? Are there any more objections?
>> It's a core change so we'll need some more reviews. I suggest you
>> resubmit.
>
> Resubmit exactly the same patches?
> Where is the ->commit_rqs() callback invoked?
I don't seem to be able to find it...

Cheers,

Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
[email protected] +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)

2019-07-05 12:13:37

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [PATCH 0/2] scsi: add support for request batching

On 05/07/19 09:13, Hannes Reinecke wrote:
> On 6/27/19 10:17 AM, Paolo Bonzini wrote:
>> On 27/06/19 05:37, Martin K. Petersen wrote:
>>>> Ping? Are there any more objections?
>>> It's a core change so we'll need some more reviews. I suggest you
>>> resubmit.
>> Resubmit exactly the same patches?
>> Where is the ->commit_rqs() callback invoked?
> I don't seem to be able to find it...

Stefan answered, and the series now has three reviews! It may be late
for 5.3 but I hope this can go in soon.

Thanks,

Paolo

2019-07-12 01:41:41

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH 0/2] scsi: add support for request batching


Paolo,

> Stefan answered, and the series now has three reviews! It may be late
> for 5.3 but I hope this can go in soon.

I queued these up for 5.4. Thanks!

--
Martin K. Petersen Oracle Linux Engineering