[RFC PATCH 0/6] virtio_test: add support for vhost-vdpa

Stefano Garzarella posted 6 patches 3 years, 9 months ago
tools/virtio/linux/kernel.h           |   2 +-
tools/virtio/linux/virtio.h           |   2 +
tools/virtio/linux/vringh.h           |   1 +
drivers/vdpa/vdpa_sim/vdpa_sim_test.c | 203 ++++++++++++++++++++++++++
tools/virtio/vdpa_test/vdpa_test.c    |   1 +
tools/virtio/virtio_test.c            | 131 ++++++++++++++---
tools/virtio/Makefile                 |  32 +++-
tools/virtio/vdpa_test/Makefile       |   3 +
tools/virtio/vhost_test/Makefile      |   2 +-
9 files changed, 350 insertions(+), 27 deletions(-)
create mode 100644 drivers/vdpa/vdpa_sim/vdpa_sim_test.c
create mode 100644 tools/virtio/vdpa_test/vdpa_test.c
create mode 100644 tools/virtio/vdpa_test/Makefile
[RFC PATCH 0/6] virtio_test: add support for vhost-vdpa
Posted by Stefano Garzarella 3 years, 9 months ago
The first 3 patches fix various problems I have encountered with
virtio_test (they may go without this series, but I included to allow you
to test the series).

Patch 4 is in preparation of patch 5, moving the feature negotiation when
we initialize the device.

Patch 5 add the support of vhost-vdpa in virtio_test

Patch 6 add vdpa_test.ko based on vdpa_sim_test.c, so we can reuse most of
the code coming from the vdpa_sim framework.

I tested in this way:

  $ modprobe vdpa_sim
  $ modprobe vhost-vdpa

  # load the vdpasim_test device
  $ insmod vdpa_test.ko

  # create a new vdpasim_test device
  $ vdpa dev add mgmtdev vdpasim_test name dev0

  # run the test using the /dev/vhost-vdpa-0 device
  $ ./virtio_test --vdpa /dev/vhost-vdpa-0
  spurious wakeups: 0x0 started=0x100000 completed=0x100000

Comments and suggestions are welcome :-)

Thanks,
Stefano

Stefano Garzarella (6):
  tools/virtio: fix build
  vhost_test: add $(srctree) on the included path
  virtio_test: call __virtio_unbreak_device
  tools/virtio: move feature negotiation in vdev_info_init()
  virtio_test: support vhost-vdpa device
  vdpasim: add vdpa_sim_test module

 tools/virtio/linux/kernel.h           |   2 +-
 tools/virtio/linux/virtio.h           |   2 +
 tools/virtio/linux/vringh.h           |   1 +
 drivers/vdpa/vdpa_sim/vdpa_sim_test.c | 203 ++++++++++++++++++++++++++
 tools/virtio/vdpa_test/vdpa_test.c    |   1 +
 tools/virtio/virtio_test.c            | 131 ++++++++++++++---
 tools/virtio/Makefile                 |  32 +++-
 tools/virtio/vdpa_test/Makefile       |   3 +
 tools/virtio/vhost_test/Makefile      |   2 +-
 9 files changed, 350 insertions(+), 27 deletions(-)
 create mode 100644 drivers/vdpa/vdpa_sim/vdpa_sim_test.c
 create mode 100644 tools/virtio/vdpa_test/vdpa_test.c
 create mode 100644 tools/virtio/vdpa_test/Makefile

-- 
2.36.1
Re: [RFC PATCH 0/6] virtio_test: add support for vhost-vdpa
Posted by Jason Wang 3 years, 9 months ago
在 2022/7/5 01:16, Stefano Garzarella 写道:
> The first 3 patches fix various problems I have encountered with
> virtio_test (they may go without this series, but I included to allow you
> to test the series).
>
> Patch 4 is in preparation of patch 5, moving the feature negotiation when
> we initialize the device.
>
> Patch 5 add the support of vhost-vdpa in virtio_test
>
> Patch 6 add vdpa_test.ko based on vdpa_sim_test.c, so we can reuse most of
> the code coming from the vdpa_sim framework.
>
> I tested in this way:
>
>    $ modprobe vdpa_sim
>    $ modprobe vhost-vdpa
>
>    # load the vdpasim_test device
>    $ insmod vdpa_test.ko
>
>    # create a new vdpasim_test device
>    $ vdpa dev add mgmtdev vdpasim_test name dev0


I wonder what's the benefit of using a dedicated test device other than 
networking? (already a loopback device anyhow).

Thanks


>
>    # run the test using the /dev/vhost-vdpa-0 device
>    $ ./virtio_test --vdpa /dev/vhost-vdpa-0
>    spurious wakeups: 0x0 started=0x100000 completed=0x100000
>
> Comments and suggestions are welcome :-)
>
> Thanks,
> Stefano
>
> Stefano Garzarella (6):
>    tools/virtio: fix build
>    vhost_test: add $(srctree) on the included path
>    virtio_test: call __virtio_unbreak_device
>    tools/virtio: move feature negotiation in vdev_info_init()
>    virtio_test: support vhost-vdpa device
>    vdpasim: add vdpa_sim_test module
>
>   tools/virtio/linux/kernel.h           |   2 +-
>   tools/virtio/linux/virtio.h           |   2 +
>   tools/virtio/linux/vringh.h           |   1 +
>   drivers/vdpa/vdpa_sim/vdpa_sim_test.c | 203 ++++++++++++++++++++++++++
>   tools/virtio/vdpa_test/vdpa_test.c    |   1 +
>   tools/virtio/virtio_test.c            | 131 ++++++++++++++---
>   tools/virtio/Makefile                 |  32 +++-
>   tools/virtio/vdpa_test/Makefile       |   3 +
>   tools/virtio/vhost_test/Makefile      |   2 +-
>   9 files changed, 350 insertions(+), 27 deletions(-)
>   create mode 100644 drivers/vdpa/vdpa_sim/vdpa_sim_test.c
>   create mode 100644 tools/virtio/vdpa_test/vdpa_test.c
>   create mode 100644 tools/virtio/vdpa_test/Makefile
>

Re: [RFC PATCH 0/6] virtio_test: add support for vhost-vdpa
Posted by Stefano Garzarella 3 years, 9 months ago
On Tue, Jul 12, 2022 at 04:34:11PM +0800, Jason Wang wrote:
>
>在 2022/7/5 01:16, Stefano Garzarella 写道:
>>The first 3 patches fix various problems I have encountered with
>>virtio_test (they may go without this series, but I included to allow you
>>to test the series).
>>
>>Patch 4 is in preparation of patch 5, moving the feature negotiation when
>>we initialize the device.
>>
>>Patch 5 add the support of vhost-vdpa in virtio_test
>>
>>Patch 6 add vdpa_test.ko based on vdpa_sim_test.c, so we can reuse most of
>>the code coming from the vdpa_sim framework.
>>
>>I tested in this way:
>>
>>   $ modprobe vdpa_sim
>>   $ modprobe vhost-vdpa
>>
>>   # load the vdpasim_test device
>>   $ insmod vdpa_test.ko
>>
>>   # create a new vdpasim_test device
>>   $ vdpa dev add mgmtdev vdpasim_test name dev0
>
>
>I wonder what's the benefit of using a dedicated test device other 
>than networking? (already a loopback device anyhow).
>

The main advantage I was thinking is that we can extend it at will to 
try to cover as much as possible all the paths that maybe with net we 
can't (indirect, reset, etc.).

Plus it should be easier to test vhost-vdpa this way without using QEMU.

Do you think this is redundant?

Thanks,
Stefano

Re: [RFC PATCH 0/6] virtio_test: add support for vhost-vdpa
Posted by Jason Wang 3 years, 9 months ago
On Tue, Jul 12, 2022 at 4:46 PM Stefano Garzarella <sgarzare@redhat.com> wrote:
>
> On Tue, Jul 12, 2022 at 04:34:11PM +0800, Jason Wang wrote:
> >
> >在 2022/7/5 01:16, Stefano Garzarella 写道:
> >>The first 3 patches fix various problems I have encountered with
> >>virtio_test (they may go without this series, but I included to allow you
> >>to test the series).
> >>
> >>Patch 4 is in preparation of patch 5, moving the feature negotiation when
> >>we initialize the device.
> >>
> >>Patch 5 add the support of vhost-vdpa in virtio_test
> >>
> >>Patch 6 add vdpa_test.ko based on vdpa_sim_test.c, so we can reuse most of
> >>the code coming from the vdpa_sim framework.
> >>
> >>I tested in this way:
> >>
> >>   $ modprobe vdpa_sim
> >>   $ modprobe vhost-vdpa
> >>
> >>   # load the vdpasim_test device
> >>   $ insmod vdpa_test.ko
> >>
> >>   # create a new vdpasim_test device
> >>   $ vdpa dev add mgmtdev vdpasim_test name dev0
> >
> >
> >I wonder what's the benefit of using a dedicated test device other
> >than networking? (already a loopback device anyhow).
> >
>
> The main advantage I was thinking is that we can extend it at will to
> try to cover as much as possible all the paths that maybe with net we
> can't (indirect, reset, etc.).
>
> Plus it should be easier to test vhost-vdpa this way without using QEMU.
>
> Do you think this is redundant?

It's probably fine and it might be better to describe the reason in
the changelog.

THanks

>
> Thanks,
> Stefano
>
Re: [RFC PATCH 0/6] virtio_test: add support for vhost-vdpa
Posted by Stefano Garzarella 3 years, 9 months ago
On Tue, Jul 12, 2022 at 04:47:10PM +0800, Jason Wang wrote:
>On Tue, Jul 12, 2022 at 4:46 PM Stefano Garzarella <sgarzare@redhat.com> wrote:
>>
>> On Tue, Jul 12, 2022 at 04:34:11PM +0800, Jason Wang wrote:
>> >
>> >在 2022/7/5 01:16, Stefano Garzarella 写道:
>> >>The first 3 patches fix various problems I have encountered with
>> >>virtio_test (they may go without this series, but I included to allow you
>> >>to test the series).
>> >>
>> >>Patch 4 is in preparation of patch 5, moving the feature negotiation when
>> >>we initialize the device.
>> >>
>> >>Patch 5 add the support of vhost-vdpa in virtio_test
>> >>
>> >>Patch 6 add vdpa_test.ko based on vdpa_sim_test.c, so we can reuse most of
>> >>the code coming from the vdpa_sim framework.
>> >>
>> >>I tested in this way:
>> >>
>> >>   $ modprobe vdpa_sim
>> >>   $ modprobe vhost-vdpa
>> >>
>> >>   # load the vdpasim_test device
>> >>   $ insmod vdpa_test.ko
>> >>
>> >>   # create a new vdpasim_test device
>> >>   $ vdpa dev add mgmtdev vdpasim_test name dev0
>> >
>> >
>> >I wonder what's the benefit of using a dedicated test device other
>> >than networking? (already a loopback device anyhow).
>> >
>>
>> The main advantage I was thinking is that we can extend it at will to
>> try to cover as much as possible all the paths that maybe with net we
>> can't (indirect, reset, etc.).
>>
>> Plus it should be easier to test vhost-vdpa this way without using QEMU.
>>
>> Do you think this is redundant?
>
>It's probably fine and it might be better to describe the reason in
>the changelog.

Okay, I'll do in the next version!

Thanks,
Stefano