Skip to contentSkip to conversation

the patch which affect performance of virtio-scsi

Qemu-devel Wangting (Kathy) 2 participants 7 messages Feb 3, 2015 – Feb 9, 2015

lore
Share & tools
lore
#0 lore raw

Hi Paolo,

Recently I test IO performance with virtio-scsi, and find out that the patch of "virtio-scsi: add support for the any_layout feature" affects IO performance of model with 4KB 32iodepth sequence read.

Why cdb and sense is removed from the struct of VirtIOSCSICmdReq and VirtIOSCSICmdResp? How do you consider the impact of the changes to the performance?
Although the latest version of qemu can optimize the performance by the way of reading merger, I think the affect of this patch cannot be ignored.

Best wishes,

Ting

#1 lore raw

Sorry, I find that the patch of "virtio-scsi: Optimize virtio_scsi_init_req" can slove this problem.

By the way, can you tell me the reason of the change about cdb and sense?

Quoted 15 lines · Wangting (Kathy)

Hi Paolo,

Recently I test IO performance with virtio-scsi, and find out that the patch of "virtio-scsi: add support for the any_layout feature" affects IO performance of model with 4KB 32iodepth sequence read.

Why cdb and sense is removed from the struct of VirtIOSCSICmdReq and VirtIOSCSICmdResp? How do you consider the impact of the changes to the performance?
Although the latest version of qemu can optimize the performance by the way of reading merger, I think the affect of this patch cannot be ignored.

Best wishes,

Ting

#2 lore raw
Quoted 1 line · Wangting (Kathy)

Sorry, I find that the patch of "virtio-scsi: Optimize virtio_scsi_init_req" can slove this problem.

Great that you could confirm that. :)

Quoted 1 line

By the way, can you tell me the reason of the change about cdb and sense?

cdb and sense are variable-size items. ANY_LAYOUT support changed
VirtIOSCSIReq: instead of having a pointer to the request, it copies the request from guest memory into VirtIOSCSIReq. This is required because the request might not be contiguous in guest memory. And because the request and response headers (e.g. VirtIOSCSICmdReq and VirtIOSCSICmdResp) are included by value in VirtIOSCSIReq, the variable-sized fields have to be treated specially.

Only one of them can remain in VirtIOSCSIReq, because you cannot have a flexible array member (e.g. "uint_8 sense[];") in the middle of a struct.

cdb is always used, so it is chosen for the variable-sized part of
VirtIOSCSIReq: cdb was simply moved from VirtIOSCSICmdReq to VirtIOSCSIReq.

Instead, requests that complete with sense data are not a fast path. Hence sense is retrieved from the SCSIRequest, and virtio_scsi_command_complete copies it into the guest buffer via scsi_req_get_sense + qemu_iovec_from_buf.

Paolo

#3 lore raw

OK, Thank you very much for your detailed explanation.

But I have another question about the big change from qemu-1.5.3 to qemu-1.6.0-rc0.

When I use ramdisk for IO performance testing, the result is as follows.

[fio-test] rw bs iodepth jobs bw iops
------------------------------------------------------------------------------------

qemu-1.5.3          read       4k         32          1         285MB/s    73208
qemu-1.6.0-rc0      read       4k         32          1         253MB/s    64967

And virtio-blk is the same.

I know there are so many differences between qemu-1.5 and qemu-1.6, but I am confused about what new features impact the performance so much. Do you know it?

Quoted 29 lines · Paolo Bonzini
Quoted 1 line · Wangting (Kathy)

Sorry, I find that the patch of "virtio-scsi: Optimize virtio_scsi_init_req" can slove this problem.

Great that you could confirm that. :)

Quoted 1 line

By the way, can you tell me the reason of the change about cdb and sense?

cdb and sense are variable-size items. ANY_LAYOUT support changed
VirtIOSCSIReq: instead of having a pointer to the request, it copies the request from guest memory into VirtIOSCSIReq. This is required because the request might not be contiguous in guest memory. And because the request and response headers (e.g. VirtIOSCSICmdReq and VirtIOSCSICmdResp) are included by value in VirtIOSCSIReq, the variable-sized fields have to be treated specially.

Only one of them can remain in VirtIOSCSIReq, because you cannot have a flexible array member (e.g. "uint_8 sense[];") in the middle of a struct.

cdb is always used, so it is chosen for the variable-sized part of
VirtIOSCSIReq: cdb was simply moved from VirtIOSCSICmdReq to VirtIOSCSIReq.

Instead, requests that complete with sense data are not a fast path. Hence sense is retrieved from the SCSIRequest, and virtio_scsi_command_complete copies it into the guest buffer via scsi_req_get_sense + qemu_iovec_from_buf.

Paolo

#4 lore raw
Quoted 8 lines · Wangting (Kathy)

OK, Thank you very much for your detailed explanation.

But I have another question about the big change from qemu-1.5.3 to qemu-1.6.0-rc0.

When I use ramdisk for IO performance testing, the result is as follows.

[fio-test] rw bs iodepth jobs bw iops
------------------------------------------------------------------------------------

Quoted 7 lines
qemu-1.5.3          read       4k         32          1         285MB/s    73208
qemu-1.6.0-rc0      read       4k         32          1         253MB/s    64967

And virtio-blk is the same.

I know there are so many differences between qemu-1.5 and qemu-1.6, but I am confused about what new features impact the performance so much. Do you know it?

No, sorry. Please try newer versions first and see if this was fixed. QEMU 1.6 is more than a year old.

Paolo

#5 lore raw
Quoted 16 lines · Paolo Bonzini
Quoted 13 lines · Wangting (Kathy)

OK, Thank you very much for your detailed explanation.

But I have another question about the big change from qemu-1.5.3 to qemu-1.6.0-rc0.

When I use ramdisk for IO performance testing, the result is as follows.

[fio-test] rw bs iodepth jobs bw iops
------------------------------------------------------------------------------------

qemu-1.5.3          read       4k         32          1         285MB/s    73208
qemu-1.6.0-rc0      read       4k         32          1         253MB/s    64967

And virtio-blk is the same.

Quoted 9 lines
Quoted 2 lines

I know there are so many differences between qemu-1.5 and qemu-1.6, but I am confused about what new features impact the performance so much. Do you know it?

No, sorry. Please try newer versions first and see if this was fixed. QEMU 1.6 is more than a year old.

Paolo

OK, thanks.

Ting

#6 lore raw
In reply to Wangting (Kathy)
Quoted 7 lines · Wangting (Kathy)

Hi Paolo,

Recently I test IO performance with virtio-scsi, and find out that the patch of "virtio-scsi: add support for the any_layout feature" affects IO performance of model with 4KB 32iodepth sequence read.

Why cdb and sense is removed from the struct of VirtIOSCSICmdReq and VirtIOSCSICmdResp?

Because I could not find any other way to implement ANY_LAYOUT, and virtio 1.0 requires that feature.

The performance however was already improved in commit faf1e1f (virtio-scsi: Optimize virtio_scsi_init_req, 2014-09-16).

Paolo

Quoted 3 lines

How do you consider the impact of the changes to the performance?
Although the latest version of qemu can optimize the performance by the way of reading merger, I think the affect of this patch cannot be ignored.