[PATCH v6 0/6] virtio: cleanup vhost-user-generic and reduce c&p

Alex Bennée posted 6 patches 1 year ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20231106191515.2801863-1-alex.bennee@linaro.org
Maintainers: Mathieu Poirier <mathieu.poirier@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org>, Viresh Kumar <viresh.kumar@linaro.org>
There is a newer version of this series
docs/system/devices/vhost-user-rng.rst        |   2 +
docs/system/devices/vhost-user.rst            |  65 ++-
...{vhost-user-device.h => vhost-user-base.h} |  21 +-
include/hw/virtio/vhost-user-gpio.h           |  23 +-
include/hw/virtio/vhost-user-i2c.h            |  14 +-
include/hw/virtio/vhost-user-rng.h            |  11 +-
include/hw/virtio/vhost-user-snd.h            |  26 ++
hw/virtio/vhost-user-base.c                   | 345 +++++++++++++++
hw/virtio/vhost-user-device-pci.c             |  10 +-
hw/virtio/vhost-user-device.c                 | 337 +--------------
hw/virtio/vhost-user-gpio.c                   | 406 +-----------------
hw/virtio/vhost-user-i2c.c                    | 272 +-----------
hw/virtio/vhost-user-rng.c                    | 278 +-----------
hw/virtio/vhost-user-snd-pci.c                |  75 ++++
hw/virtio/vhost-user-snd.c                    |  67 +++
hw/virtio/Kconfig                             |   5 +
hw/virtio/meson.build                         |  23 +-
17 files changed, 690 insertions(+), 1290 deletions(-)
rename include/hw/virtio/{vhost-user-device.h => vhost-user-base.h} (71%)
create mode 100644 include/hw/virtio/vhost-user-snd.h
create mode 100644 hw/virtio/vhost-user-base.c
create mode 100644 hw/virtio/vhost-user-snd-pci.c
create mode 100644 hw/virtio/vhost-user-snd.c
[PATCH v6 0/6] virtio: cleanup vhost-user-generic and reduce c&p
Posted by Alex Bennée 1 year ago
A lot of our vhost-user stubs are large chunks of boilerplate that do
(mostly) the same thing. This series continues the cleanups by
splitting the vhost-user-base and vhost-user-generic implementations.
After adding a new vq_size property the rng, gpio and i2c vhost-user
devices become simple specialisations of the common base defining the
ID, number of queues and potentially the config handling.

I've also added Manos' vhost-user-sound while I was at it.

Changes
-------

v6
  - re-base to current master
  - make vhost-user-device abstract
  - mention abstractness in docs

v5
  - addressing comments and tags
  - improved the docs

v4
  - dropped the F_TRANSPORT work for another series
  - added vhost-user-sound

Alex Bennée (5):
  virtio: split into vhost-user-base and vhost-user-device
  hw/virtio: derive vhost-user-rng from vhost-user-base
  hw/virtio: derive vhost-user-gpio from vhost-user-base
  hw/virtio: derive vhost-user-i2c from vhost-user-base
  docs/system: add a basic enumeration of vhost-user devices

Manos Pitsidianakis (1):
  hw/virtio: add vhost-user-snd and virtio-snd-pci devices

 docs/system/devices/vhost-user-rng.rst        |   2 +
 docs/system/devices/vhost-user.rst            |  65 ++-
 ...{vhost-user-device.h => vhost-user-base.h} |  21 +-
 include/hw/virtio/vhost-user-gpio.h           |  23 +-
 include/hw/virtio/vhost-user-i2c.h            |  14 +-
 include/hw/virtio/vhost-user-rng.h            |  11 +-
 include/hw/virtio/vhost-user-snd.h            |  26 ++
 hw/virtio/vhost-user-base.c                   | 345 +++++++++++++++
 hw/virtio/vhost-user-device-pci.c             |  10 +-
 hw/virtio/vhost-user-device.c                 | 337 +--------------
 hw/virtio/vhost-user-gpio.c                   | 406 +-----------------
 hw/virtio/vhost-user-i2c.c                    | 272 +-----------
 hw/virtio/vhost-user-rng.c                    | 278 +-----------
 hw/virtio/vhost-user-snd-pci.c                |  75 ++++
 hw/virtio/vhost-user-snd.c                    |  67 +++
 hw/virtio/Kconfig                             |   5 +
 hw/virtio/meson.build                         |  23 +-
 17 files changed, 690 insertions(+), 1290 deletions(-)
 rename include/hw/virtio/{vhost-user-device.h => vhost-user-base.h} (71%)
 create mode 100644 include/hw/virtio/vhost-user-snd.h
 create mode 100644 hw/virtio/vhost-user-base.c
 create mode 100644 hw/virtio/vhost-user-snd-pci.c
 create mode 100644 hw/virtio/vhost-user-snd.c

-- 
2.39.2


Re: [PATCH v6 0/6] virtio: cleanup vhost-user-generic and reduce c&p
Posted by Michael S. Tsirkin 1 year ago
On Mon, Nov 06, 2023 at 07:15:09PM +0000, Alex Bennée wrote:
> A lot of our vhost-user stubs are large chunks of boilerplate that do
> (mostly) the same thing. This series continues the cleanups by
> splitting the vhost-user-base and vhost-user-generic implementations.
> After adding a new vq_size property the rng, gpio and i2c vhost-user
> devices become simple specialisations of the common base defining the
> ID, number of queues and potentially the config handling.
> 
> I've also added Manos' vhost-user-sound while I was at it.

Dropped due to CI failures. Pls make sure this passes gitlab CI.
Also pls ping me after release to help make sure it does not get lost.
Thanks!

> Changes
> -------
> 
> v6
>   - re-base to current master
>   - make vhost-user-device abstract
>   - mention abstractness in docs
> 
> v5
>   - addressing comments and tags
>   - improved the docs
> 
> v4
>   - dropped the F_TRANSPORT work for another series
>   - added vhost-user-sound
> 
> Alex Bennée (5):
>   virtio: split into vhost-user-base and vhost-user-device
>   hw/virtio: derive vhost-user-rng from vhost-user-base
>   hw/virtio: derive vhost-user-gpio from vhost-user-base
>   hw/virtio: derive vhost-user-i2c from vhost-user-base
>   docs/system: add a basic enumeration of vhost-user devices
> 
> Manos Pitsidianakis (1):
>   hw/virtio: add vhost-user-snd and virtio-snd-pci devices
> 
>  docs/system/devices/vhost-user-rng.rst        |   2 +
>  docs/system/devices/vhost-user.rst            |  65 ++-
>  ...{vhost-user-device.h => vhost-user-base.h} |  21 +-
>  include/hw/virtio/vhost-user-gpio.h           |  23 +-
>  include/hw/virtio/vhost-user-i2c.h            |  14 +-
>  include/hw/virtio/vhost-user-rng.h            |  11 +-
>  include/hw/virtio/vhost-user-snd.h            |  26 ++
>  hw/virtio/vhost-user-base.c                   | 345 +++++++++++++++
>  hw/virtio/vhost-user-device-pci.c             |  10 +-
>  hw/virtio/vhost-user-device.c                 | 337 +--------------
>  hw/virtio/vhost-user-gpio.c                   | 406 +-----------------
>  hw/virtio/vhost-user-i2c.c                    | 272 +-----------
>  hw/virtio/vhost-user-rng.c                    | 278 +-----------
>  hw/virtio/vhost-user-snd-pci.c                |  75 ++++
>  hw/virtio/vhost-user-snd.c                    |  67 +++
>  hw/virtio/Kconfig                             |   5 +
>  hw/virtio/meson.build                         |  23 +-
>  17 files changed, 690 insertions(+), 1290 deletions(-)
>  rename include/hw/virtio/{vhost-user-device.h => vhost-user-base.h} (71%)
>  create mode 100644 include/hw/virtio/vhost-user-snd.h
>  create mode 100644 hw/virtio/vhost-user-base.c
>  create mode 100644 hw/virtio/vhost-user-snd-pci.c
>  create mode 100644 hw/virtio/vhost-user-snd.c
> 
> -- 
> 2.39.2
Re: [PATCH v6 0/6] virtio: cleanup vhost-user-generic and reduce c&p
Posted by Alex Bennée 1 year ago
"Michael S. Tsirkin" <mst@redhat.com> writes:

> On Mon, Nov 06, 2023 at 07:15:09PM +0000, Alex Bennée wrote:
>> A lot of our vhost-user stubs are large chunks of boilerplate that do
>> (mostly) the same thing. This series continues the cleanups by
>> splitting the vhost-user-base and vhost-user-generic implementations.
>> After adding a new vq_size property the rng, gpio and i2c vhost-user
>> devices become simple specialisations of the common base defining the
>> ID, number of queues and potentially the config handling.
>> 
>> I've also added Manos' vhost-user-sound while I was at it.
>
> Dropped due to CI failures. Pls make sure this passes gitlab CI.
> Also pls ping me after release to help make sure it does not get lost.
> Thanks!

Your intuition about the async tear down was right (or at least avoids
the racey qos-test failure). I've added a final patch and sent :

  https://patchew.org/QEMU/20231107180752.3458672-1-alex.bennee@linaro.org/

It's running the CI as we speak:

  https://gitlab.com/stsquad/qemu/-/pipelines/1064197949

>
>> Changes
>> -------
>> 
>> v6
>>   - re-base to current master
>>   - make vhost-user-device abstract
>>   - mention abstractness in docs
>> 
>> v5
>>   - addressing comments and tags
>>   - improved the docs
>> 
>> v4
>>   - dropped the F_TRANSPORT work for another series
>>   - added vhost-user-sound
>> 
>> Alex Bennée (5):
>>   virtio: split into vhost-user-base and vhost-user-device
>>   hw/virtio: derive vhost-user-rng from vhost-user-base
>>   hw/virtio: derive vhost-user-gpio from vhost-user-base
>>   hw/virtio: derive vhost-user-i2c from vhost-user-base
>>   docs/system: add a basic enumeration of vhost-user devices
>> 
>> Manos Pitsidianakis (1):
>>   hw/virtio: add vhost-user-snd and virtio-snd-pci devices
>> 
>>  docs/system/devices/vhost-user-rng.rst        |   2 +
>>  docs/system/devices/vhost-user.rst            |  65 ++-
>>  ...{vhost-user-device.h => vhost-user-base.h} |  21 +-
>>  include/hw/virtio/vhost-user-gpio.h           |  23 +-
>>  include/hw/virtio/vhost-user-i2c.h            |  14 +-
>>  include/hw/virtio/vhost-user-rng.h            |  11 +-
>>  include/hw/virtio/vhost-user-snd.h            |  26 ++
>>  hw/virtio/vhost-user-base.c                   | 345 +++++++++++++++
>>  hw/virtio/vhost-user-device-pci.c             |  10 +-
>>  hw/virtio/vhost-user-device.c                 | 337 +--------------
>>  hw/virtio/vhost-user-gpio.c                   | 406 +-----------------
>>  hw/virtio/vhost-user-i2c.c                    | 272 +-----------
>>  hw/virtio/vhost-user-rng.c                    | 278 +-----------
>>  hw/virtio/vhost-user-snd-pci.c                |  75 ++++
>>  hw/virtio/vhost-user-snd.c                    |  67 +++
>>  hw/virtio/Kconfig                             |   5 +
>>  hw/virtio/meson.build                         |  23 +-
>>  17 files changed, 690 insertions(+), 1290 deletions(-)
>>  rename include/hw/virtio/{vhost-user-device.h => vhost-user-base.h} (71%)
>>  create mode 100644 include/hw/virtio/vhost-user-snd.h
>>  create mode 100644 hw/virtio/vhost-user-base.c
>>  create mode 100644 hw/virtio/vhost-user-snd-pci.c
>>  create mode 100644 hw/virtio/vhost-user-snd.c
>> 
>> -- 
>> 2.39.2

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro
Re: [PATCH v6 0/6] virtio: cleanup vhost-user-generic and reduce c&p
Posted by Michael S. Tsirkin 1 year ago
On Mon, Nov 06, 2023 at 07:15:09PM +0000, Alex Bennée wrote:
> A lot of our vhost-user stubs are large chunks of boilerplate that do
> (mostly) the same thing. This series continues the cleanups by
> splitting the vhost-user-base and vhost-user-generic implementations.
> After adding a new vq_size property the rng, gpio and i2c vhost-user
> devices become simple specialisations of the common base defining the
> ID, number of queues and potentially the config handling.
> 
> I've also added Manos' vhost-user-sound while I was at it.
> 


gpio tests seem to be failing under clang:

https://gitlab.com/mstredhat/qemu/-/jobs/5475281549




-- 
MST
Re: [PATCH v6 0/6] virtio: cleanup vhost-user-generic and reduce c&p
Posted by Michael S. Tsirkin 1 year ago
On Mon, Nov 06, 2023 at 07:15:09PM +0000, Alex Bennée wrote:
> A lot of our vhost-user stubs are large chunks of boilerplate that do
> (mostly) the same thing. This series continues the cleanups by
> splitting the vhost-user-base and vhost-user-generic implementations.
> After adding a new vq_size property the rng, gpio and i2c vhost-user
> devices become simple specialisations of the common base defining the
> ID, number of queues and potentially the config handling.
> 
> I've also added Manos' vhost-user-sound while I was at it.


Also some checkpatch warnings. Pls fix them too:

https://gitlab.com/mstredhat/qemu/-/jobs/5475281577


> Changes
> -------
> 
> v6
>   - re-base to current master
>   - make vhost-user-device abstract
>   - mention abstractness in docs
> 
> v5
>   - addressing comments and tags
>   - improved the docs
> 
> v4
>   - dropped the F_TRANSPORT work for another series
>   - added vhost-user-sound
> 
> Alex Bennée (5):
>   virtio: split into vhost-user-base and vhost-user-device
>   hw/virtio: derive vhost-user-rng from vhost-user-base
>   hw/virtio: derive vhost-user-gpio from vhost-user-base
>   hw/virtio: derive vhost-user-i2c from vhost-user-base
>   docs/system: add a basic enumeration of vhost-user devices
> 
> Manos Pitsidianakis (1):
>   hw/virtio: add vhost-user-snd and virtio-snd-pci devices
> 
>  docs/system/devices/vhost-user-rng.rst        |   2 +
>  docs/system/devices/vhost-user.rst            |  65 ++-
>  ...{vhost-user-device.h => vhost-user-base.h} |  21 +-
>  include/hw/virtio/vhost-user-gpio.h           |  23 +-
>  include/hw/virtio/vhost-user-i2c.h            |  14 +-
>  include/hw/virtio/vhost-user-rng.h            |  11 +-
>  include/hw/virtio/vhost-user-snd.h            |  26 ++
>  hw/virtio/vhost-user-base.c                   | 345 +++++++++++++++
>  hw/virtio/vhost-user-device-pci.c             |  10 +-
>  hw/virtio/vhost-user-device.c                 | 337 +--------------
>  hw/virtio/vhost-user-gpio.c                   | 406 +-----------------
>  hw/virtio/vhost-user-i2c.c                    | 272 +-----------
>  hw/virtio/vhost-user-rng.c                    | 278 +-----------
>  hw/virtio/vhost-user-snd-pci.c                |  75 ++++
>  hw/virtio/vhost-user-snd.c                    |  67 +++
>  hw/virtio/Kconfig                             |   5 +
>  hw/virtio/meson.build                         |  23 +-
>  17 files changed, 690 insertions(+), 1290 deletions(-)
>  rename include/hw/virtio/{vhost-user-device.h => vhost-user-base.h} (71%)
>  create mode 100644 include/hw/virtio/vhost-user-snd.h
>  create mode 100644 hw/virtio/vhost-user-base.c
>  create mode 100644 hw/virtio/vhost-user-snd-pci.c
>  create mode 100644 hw/virtio/vhost-user-snd.c
> 
> -- 
> 2.39.2
Re: [PATCH v6 0/6] virtio: cleanup vhost-user-generic and reduce c&p
Posted by Mark Cave-Ayland 1 year ago
On 06/11/2023 19:15, Alex Bennée wrote:

> A lot of our vhost-user stubs are large chunks of boilerplate that do
> (mostly) the same thing. This series continues the cleanups by
> splitting the vhost-user-base and vhost-user-generic implementations.
> After adding a new vq_size property the rng, gpio and i2c vhost-user
> devices become simple specialisations of the common base defining the
> ID, number of queues and potentially the config handling.
> 
> I've also added Manos' vhost-user-sound while I was at it.

Looks like patches 2-5 are still missing s/parent/parent_obj/ for the QOM classes 
that are derived from VHostUserBase?

> Changes
> -------
> 
> v6
>    - re-base to current master
>    - make vhost-user-device abstract
>    - mention abstractness in docs
> 
> v5
>    - addressing comments and tags
>    - improved the docs
> 
> v4
>    - dropped the F_TRANSPORT work for another series
>    - added vhost-user-sound
> 
> Alex Bennée (5):
>    virtio: split into vhost-user-base and vhost-user-device
>    hw/virtio: derive vhost-user-rng from vhost-user-base
>    hw/virtio: derive vhost-user-gpio from vhost-user-base
>    hw/virtio: derive vhost-user-i2c from vhost-user-base
>    docs/system: add a basic enumeration of vhost-user devices
> 
> Manos Pitsidianakis (1):
>    hw/virtio: add vhost-user-snd and virtio-snd-pci devices
> 
>   docs/system/devices/vhost-user-rng.rst        |   2 +
>   docs/system/devices/vhost-user.rst            |  65 ++-
>   ...{vhost-user-device.h => vhost-user-base.h} |  21 +-
>   include/hw/virtio/vhost-user-gpio.h           |  23 +-
>   include/hw/virtio/vhost-user-i2c.h            |  14 +-
>   include/hw/virtio/vhost-user-rng.h            |  11 +-
>   include/hw/virtio/vhost-user-snd.h            |  26 ++
>   hw/virtio/vhost-user-base.c                   | 345 +++++++++++++++
>   hw/virtio/vhost-user-device-pci.c             |  10 +-
>   hw/virtio/vhost-user-device.c                 | 337 +--------------
>   hw/virtio/vhost-user-gpio.c                   | 406 +-----------------
>   hw/virtio/vhost-user-i2c.c                    | 272 +-----------
>   hw/virtio/vhost-user-rng.c                    | 278 +-----------
>   hw/virtio/vhost-user-snd-pci.c                |  75 ++++
>   hw/virtio/vhost-user-snd.c                    |  67 +++
>   hw/virtio/Kconfig                             |   5 +
>   hw/virtio/meson.build                         |  23 +-
>   17 files changed, 690 insertions(+), 1290 deletions(-)
>   rename include/hw/virtio/{vhost-user-device.h => vhost-user-base.h} (71%)
>   create mode 100644 include/hw/virtio/vhost-user-snd.h
>   create mode 100644 hw/virtio/vhost-user-base.c
>   create mode 100644 hw/virtio/vhost-user-snd-pci.c
>   create mode 100644 hw/virtio/vhost-user-snd.c


ATB,

Mark.