All of lore.kernel.org
 help / color / mirror / Atom feed
* How to extend QEMU's vhost-user tests after implementing vhost-user-blk device backend
@ 2019-11-13  9:23 Coiby Xu
  2019-11-14 11:14 ` Stefan Hajnoczi
  0 siblings, 1 reply; 6+ messages in thread
From: Coiby Xu @ 2019-11-13  9:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi

Hi,

I've implemented vhost-user-blk device backend by following
https://wiki.qemu.org/Google_Summer_of_Code_2019#vhost-user-blk_device_backend.
But I'm not sure what kind of tests I should write or to extend to
take advantage of implemented vhost-user-blk device backend. The
existing two tests related to vhost user are tests/vhost-user-bridge.c
and tests/vhost-user-test.c both of which act as vhost user server to
test QEMU's implementation of vhost user client. Am I supposed to
extend these two tests? Could you elaborate on the final step "Extend
QEMU's vhost-user tests to take advantage of your vhost-user-blk
device backend"?

Thank you!
--
Best regards,
Coiby


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to extend QEMU's vhost-user tests after implementing vhost-user-blk device backend
  2019-11-13  9:23 How to extend QEMU's vhost-user tests after implementing vhost-user-blk device backend Coiby Xu
@ 2019-11-14 11:14 ` Stefan Hajnoczi
  2019-12-11 15:25   ` Coiby Xu
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Hajnoczi @ 2019-11-14 11:14 UTC (permalink / raw)
  To: Coiby Xu; +Cc: Kevin Wolf, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1545 bytes --]

On Wed, Nov 13, 2019 at 05:23:46PM +0800, Coiby Xu wrote:
> I've implemented vhost-user-blk device backend by following
> https://wiki.qemu.org/Google_Summer_of_Code_2019#vhost-user-blk_device_backend.
> But I'm not sure what kind of tests I should write or to extend to
> take advantage of implemented vhost-user-blk device backend. The
> existing two tests related to vhost user are tests/vhost-user-bridge.c
> and tests/vhost-user-test.c both of which act as vhost user server to
> test QEMU's implementation of vhost user client. Am I supposed to
> extend these two tests? Could you elaborate on the final step "Extend
> QEMU's vhost-user tests to take advantage of your vhost-user-blk
> device backend"?

Hi Coiby,
The following tests/virtio-blk-test.c test cases will also work with
vhost-user-blk: basic, indirect, idx, nxvirtq.  The other test cases
may require more work because they send QMP commands like block_resize
or device_add virtio-blk-pci.

In theory block_resize should work because the vhost-user-blk device
backend can send a VIRTIO Configuration Space changed interrupt
(VHOST_USER_SLAVE_CONFIG_CHANGE_MSG), but I haven't checked if this code
path is fully implemented.

In order to reuse existing test cases you could add new initialization
code to virtio-blk-test.c that:
1. Starts the vhost-user-blk device backend
2. Adds a -device vhost-user-blk-pci connected to that device backend

Please post your patches to qemu-devel even if you don't have test cases
yet.  That way you can get review feedback earlier.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to extend QEMU's vhost-user tests after implementing vhost-user-blk device backend
  2019-11-14 11:14 ` Stefan Hajnoczi
@ 2019-12-11 15:25   ` Coiby Xu
  2019-12-13 10:58     ` Stefan Hajnoczi
  0 siblings, 1 reply; 6+ messages in thread
From: Coiby Xu @ 2019-12-11 15:25 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Kevin Wolf, qemu-devel

Hi Stefan,

I'm now writing the tests for vhost-user-blk device based on
tests/virtio-blk-test.c. But block_resize command doesn't apply to
vhost-user-blk device.

After launching vhost-user backend server, I type the following
command to connect to it

(qemu) chardev-add socket,id=char1,path=/tmp/vhost-user-blk_vhost.socket
(qemu) object_add memory-backend-memfd,id=mem,size=256M,share=on
(qemu) device_add vhost-user-blk-pci,id=blk0,chardev=char1
(qemu) block_resize blk0 512
Error: Cannot find device=blk0 nor node_name=

QEMU can't find the device although in the guest OS I can already
mount /dev/vda. And `info block` doesn't list the newly added
vhost-user-blk device,
(qemu) info block
disk (#block154): dpdk.img (raw)
    Attached to:      /machine/peripheral-anon/device[0]
    Cache mode:       writeback

floppy0: [not inserted]
    Attached to:      /machine/unattached/device[17]
    Removable device: not locked, tray closed

sd0: [not inserted]
    Removable device: not locked, tray close

It seems `info block` and `block_resize` only work with `drive_add`
which is not necessary for vhost-user-blk device. Should I let QEMU
support adding vhost-user backend device in the way similar to adding
NBD device(`drive_add -n buddy
file.driver=nbd,file.host=localhost,file.port=49153,file.export=disk,node-name=nbd_client1`),
i.e., a drive can be added via `drive_add -n buddy
file.driver=vhost-user,file.sock=/tmp/vhost-user-blk_vhost.socket,node-name=vhost_user_client1`?

Thank you!


On Thu, Nov 14, 2019 at 7:14 PM Stefan Hajnoczi <stefanha@redhat.com> wrote:
>
> On Wed, Nov 13, 2019 at 05:23:46PM +0800, Coiby Xu wrote:
> > I've implemented vhost-user-blk device backend by following
> > https://wiki.qemu.org/Google_Summer_of_Code_2019#vhost-user-blk_device_backend.
> > But I'm not sure what kind of tests I should write or to extend to
> > take advantage of implemented vhost-user-blk device backend. The
> > existing two tests related to vhost user are tests/vhost-user-bridge.c
> > and tests/vhost-user-test.c both of which act as vhost user server to
> > test QEMU's implementation of vhost user client. Am I supposed to
> > extend these two tests? Could you elaborate on the final step "Extend
> > QEMU's vhost-user tests to take advantage of your vhost-user-blk
> > device backend"?
>
> Hi Coiby,
> The following tests/virtio-blk-test.c test cases will also work with
> vhost-user-blk: basic, indirect, idx, nxvirtq.  The other test cases
> may require more work because they send QMP commands like block_resize
> or device_add virtio-blk-pci.
>
> In theory block_resize should work because the vhost-user-blk device
> backend can send a VIRTIO Configuration Space changed interrupt
> (VHOST_USER_SLAVE_CONFIG_CHANGE_MSG), but I haven't checked if this code
> path is fully implemented.
>
> In order to reuse existing test cases you could add new initialization
> code to virtio-blk-test.c that:
> 1. Starts the vhost-user-blk device backend
> 2. Adds a -device vhost-user-blk-pci connected to that device backend
>
> Please post your patches to qemu-devel even if you don't have test cases
> yet.  That way you can get review feedback earlier.
>
> Stefan



-- 
Best regards,
Coiby


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to extend QEMU's vhost-user tests after implementing vhost-user-blk device backend
  2019-12-11 15:25   ` Coiby Xu
@ 2019-12-13 10:58     ` Stefan Hajnoczi
  2020-01-04  6:00       ` Coiby Xu
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Hajnoczi @ 2019-12-13 10:58 UTC (permalink / raw)
  To: Coiby Xu; +Cc: Kevin Wolf, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1922 bytes --]

On Wed, Dec 11, 2019 at 11:25:32PM +0800, Coiby Xu wrote:
> I'm now writing the tests for vhost-user-blk device based on
> tests/virtio-blk-test.c. But block_resize command doesn't apply to
> vhost-user-blk device.
> 
> After launching vhost-user backend server, I type the following
> command to connect to it
> 
> (qemu) chardev-add socket,id=char1,path=/tmp/vhost-user-blk_vhost.socket
> (qemu) object_add memory-backend-memfd,id=mem,size=256M,share=on
> (qemu) device_add vhost-user-blk-pci,id=blk0,chardev=char1
> (qemu) block_resize blk0 512
> Error: Cannot find device=blk0 nor node_name=
> 
> QEMU can't find the device although in the guest OS I can already
> mount /dev/vda. And `info block` doesn't list the newly added
> vhost-user-blk device,
> (qemu) info block
> disk (#block154): dpdk.img (raw)
>     Attached to:      /machine/peripheral-anon/device[0]
>     Cache mode:       writeback
> 
> floppy0: [not inserted]
>     Attached to:      /machine/unattached/device[17]
>     Removable device: not locked, tray closed
> 
> sd0: [not inserted]
>     Removable device: not locked, tray close
> 
> It seems `info block` and `block_resize` only work with `drive_add`
> which is not necessary for vhost-user-blk device.

Yes, -device vhost-user-blk doesn't have a BlockDriverState (-drive or
-blockdev) because it communicates with the vhost-user device backend
over a character device instead.

> Should I let QEMU
> support adding vhost-user backend device in the way similar to adding
> NBD device(`drive_add -n buddy
> file.driver=nbd,file.host=localhost,file.port=49153,file.export=disk,node-name=nbd_client1`),
> i.e., a drive can be added via `drive_add -n buddy
> file.driver=vhost-user,file.sock=/tmp/vhost-user-blk_vhost.socket,node-name=vhost_user_client1`?

That is probably too much work.  It's fine to skip test cases that
resize the disk.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to extend QEMU's vhost-user tests after implementing vhost-user-blk device backend
  2019-12-13 10:58     ` Stefan Hajnoczi
@ 2020-01-04  6:00       ` Coiby Xu
  2020-01-08 16:56         ` Stefan Hajnoczi
  0 siblings, 1 reply; 6+ messages in thread
From: Coiby Xu @ 2020-01-04  6:00 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Kevin Wolf, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2602 bytes --]

Thank you for the advice! I've skipped test cases regarding resizing the
disk. The remaining tests are "indirect" and "basic". vhost-user-blk device
has now passed the "basic" test
(/x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/vhost-user-blk-pci/vhost-user-blk/vhost-user-blk-tests/basic)
as virtio-blk-deivce. But it fails the "indirect" test because
libvhost-user doesn't support VIRTIO_RING_F_INDIRECT_DESC (indirect buffer
descriptors),  Would you suggest me to improve libvhost-user to
support indirect buffer descriptors?

On Fri, Dec 13, 2019 at 6:58 PM Stefan Hajnoczi <stefanha@redhat.com> wrote:

> On Wed, Dec 11, 2019 at 11:25:32PM +0800, Coiby Xu wrote:
> > I'm now writing the tests for vhost-user-blk device based on
> > tests/virtio-blk-test.c. But block_resize command doesn't apply to
> > vhost-user-blk device.
> >
> > After launching vhost-user backend server, I type the following
> > command to connect to it
> >
> > (qemu) chardev-add socket,id=char1,path=/tmp/vhost-user-blk_vhost.socket
> > (qemu) object_add memory-backend-memfd,id=mem,size=256M,share=on
> > (qemu) device_add vhost-user-blk-pci,id=blk0,chardev=char1
> > (qemu) block_resize blk0 512
> > Error: Cannot find device=blk0 nor node_name=
> >
> > QEMU can't find the device although in the guest OS I can already
> > mount /dev/vda. And `info block` doesn't list the newly added
> > vhost-user-blk device,
> > (qemu) info block
> > disk (#block154): dpdk.img (raw)
> >     Attached to:      /machine/peripheral-anon/device[0]
> >     Cache mode:       writeback
> >
> > floppy0: [not inserted]
> >     Attached to:      /machine/unattached/device[17]
> >     Removable device: not locked, tray closed
> >
> > sd0: [not inserted]
> >     Removable device: not locked, tray close
> >
> > It seems `info block` and `block_resize` only work with `drive_add`
> > which is not necessary for vhost-user-blk device.
>
> Yes, -device vhost-user-blk doesn't have a BlockDriverState (-drive or
> -blockdev) because it communicates with the vhost-user device backend
> over a character device instead.
>
> > Should I let QEMU
> > support adding vhost-user backend device in the way similar to adding
> > NBD device(`drive_add -n buddy
> >
> file.driver=nbd,file.host=localhost,file.port=49153,file.export=disk,node-name=nbd_client1`),
> > i.e., a drive can be added via `drive_add -n buddy
> >
> file.driver=vhost-user,file.sock=/tmp/vhost-user-blk_vhost.socket,node-name=vhost_user_client1`?
>
> That is probably too much work.  It's fine to skip test cases that
> resize the disk.
>
> Stefan
>


-- 
*Best regards,*
*Coiby*

[-- Attachment #2: Type: text/html, Size: 3456 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to extend QEMU's vhost-user tests after implementing vhost-user-blk device backend
  2020-01-04  6:00       ` Coiby Xu
@ 2020-01-08 16:56         ` Stefan Hajnoczi
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2020-01-08 16:56 UTC (permalink / raw)
  To: Coiby Xu; +Cc: Kevin Wolf, qemu-devel, Stefan Hajnoczi

[-- Attachment #1: Type: text/plain, Size: 853 bytes --]

On Sat, Jan 04, 2020 at 02:00:02PM +0800, Coiby Xu wrote:
> Thank you for the advice! I've skipped test cases regarding resizing the
> disk. The remaining tests are "indirect" and "basic". vhost-user-blk device
> has now passed the "basic" test
> (/x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/vhost-user-blk-pci/vhost-user-blk/vhost-user-blk-tests/basic)
> as virtio-blk-deivce. But it fails the "indirect" test because
> libvhost-user doesn't support VIRTIO_RING_F_INDIRECT_DESC (indirect buffer
> descriptors),  Would you suggest me to improve libvhost-user to
> support indirect buffer descriptors?

libvhost-user supports VIRTIO_RING_F_INDIRECT_DESC.

Please add VIRTIO_RING_F_INDIRECT_DESC to
contrib/libvhost-user/libvhost-user.c:vu_get_features_exec() so that all
libvhost-user applications automatically get indirect descriptor support.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-01-08 16:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13  9:23 How to extend QEMU's vhost-user tests after implementing vhost-user-blk device backend Coiby Xu
2019-11-14 11:14 ` Stefan Hajnoczi
2019-12-11 15:25   ` Coiby Xu
2019-12-13 10:58     ` Stefan Hajnoczi
2020-01-04  6:00       ` Coiby Xu
2020-01-08 16:56         ` Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.