[PATCH 00/14] tools/virtio: cleanups, fixes

Michael S. Tsirkin posted 14 patches 2 weeks ago
include/linux/virtio.h             |   2 +
include/linux/virtio_features.h    |   2 +
tools/virtio/Makefile              |   8 ++-
tools/virtio/linux/compiler.h      |   6 ++
tools/virtio/linux/cpumask.h       |   4 ++
tools/virtio/linux/device.h        |   8 +++
tools/virtio/linux/dma-mapping.h   |   4 ++
tools/virtio/linux/kernel.h        |  16 +++++
tools/virtio/linux/module.h        |   2 +
tools/virtio/linux/ucopysize.h     |  21 ++++++
tools/virtio/linux/virtio.h        |  73 +--------------------
tools/virtio/linux/virtio_config.h | 102 +----------------------------
tools/virtio/oot-stubs.h           |  10 +++
13 files changed, 82 insertions(+), 176 deletions(-)
create mode 100644 tools/virtio/linux/ucopysize.h
create mode 100644 tools/virtio/oot-stubs.h
[PATCH 00/14] tools/virtio: cleanups, fixes
Posted by Michael S. Tsirkin 2 weeks ago
Recent virtio changes brought about build errors for tools/virtio,
as usual. I did some refactoring to hopefully reduce maintainance
load going forward.

Adding stubs is tedious and seemed a perfect fit for cursor -
so I used it for that, then rewrote some commits and accepted
others.  commit logs I've rewritten.

Found and fixed a couple of minor bugs while doing this - that
part's all mine.

Michael S. Tsirkin (14):
  tools/virtio: fix up compiler.h stub
  virtio: make it self-contained
  tools/virtio: use kernel's virtio.h
  tools/virtio: add struct module forward declaration
  tools/virtio: stub DMA mapping functions
  tools/virtio: add dev_WARN_ONCE and is_vmalloc_addr stubs
  tools/virtio: add ucopysize.h stub
  tools/virtio: pass KCFLAGS to module build
  tools/virtio: add struct cpumask to cpumask.h
  tools/virtio: stub might_sleep and synchronize_rcu
  tools/virtio: switch to kernel's virtio_config.h
  virtio_features: make it self-contained
  tools/virtio: fix up oot build
  tools/virtio: add device, device_driver stubs

 include/linux/virtio.h             |   2 +
 include/linux/virtio_features.h    |   2 +
 tools/virtio/Makefile              |   8 ++-
 tools/virtio/linux/compiler.h      |   6 ++
 tools/virtio/linux/cpumask.h       |   4 ++
 tools/virtio/linux/device.h        |   8 +++
 tools/virtio/linux/dma-mapping.h   |   4 ++
 tools/virtio/linux/kernel.h        |  16 +++++
 tools/virtio/linux/module.h        |   2 +
 tools/virtio/linux/ucopysize.h     |  21 ++++++
 tools/virtio/linux/virtio.h        |  73 +--------------------
 tools/virtio/linux/virtio_config.h | 102 +----------------------------
 tools/virtio/oot-stubs.h           |  10 +++
 13 files changed, 82 insertions(+), 176 deletions(-)
 create mode 100644 tools/virtio/linux/ucopysize.h
 create mode 100644 tools/virtio/oot-stubs.h

-- 
MST
Re: [PATCH 00/14] tools/virtio: cleanups, fixes
Posted by Michael S. Tsirkin 1 week, 3 days ago
On Thu, Dec 04, 2025 at 01:46:01PM -0500, Michael S. Tsirkin wrote:
> Recent virtio changes brought about build errors for tools/virtio,
> as usual. I did some refactoring to hopefully reduce maintainance
> load going forward.
> 
> Adding stubs is tedious and seemed a perfect fit for cursor -
> so I used it for that, then rewrote some commits and accepted
> others.  commit logs I've rewritten.
> 
> Found and fixed a couple of minor bugs while doing this - that
> part's all mine.


Jason, any feedback?

> Michael S. Tsirkin (14):
>   tools/virtio: fix up compiler.h stub
>   virtio: make it self-contained
>   tools/virtio: use kernel's virtio.h
>   tools/virtio: add struct module forward declaration
>   tools/virtio: stub DMA mapping functions
>   tools/virtio: add dev_WARN_ONCE and is_vmalloc_addr stubs
>   tools/virtio: add ucopysize.h stub
>   tools/virtio: pass KCFLAGS to module build
>   tools/virtio: add struct cpumask to cpumask.h
>   tools/virtio: stub might_sleep and synchronize_rcu
>   tools/virtio: switch to kernel's virtio_config.h
>   virtio_features: make it self-contained
>   tools/virtio: fix up oot build
>   tools/virtio: add device, device_driver stubs
> 
>  include/linux/virtio.h             |   2 +
>  include/linux/virtio_features.h    |   2 +
>  tools/virtio/Makefile              |   8 ++-
>  tools/virtio/linux/compiler.h      |   6 ++
>  tools/virtio/linux/cpumask.h       |   4 ++
>  tools/virtio/linux/device.h        |   8 +++
>  tools/virtio/linux/dma-mapping.h   |   4 ++
>  tools/virtio/linux/kernel.h        |  16 +++++
>  tools/virtio/linux/module.h        |   2 +
>  tools/virtio/linux/ucopysize.h     |  21 ++++++
>  tools/virtio/linux/virtio.h        |  73 +--------------------
>  tools/virtio/linux/virtio_config.h | 102 +----------------------------
>  tools/virtio/oot-stubs.h           |  10 +++
>  13 files changed, 82 insertions(+), 176 deletions(-)
>  create mode 100644 tools/virtio/linux/ucopysize.h
>  create mode 100644 tools/virtio/oot-stubs.h
> 
> -- 
> MST
>
Re: [PATCH 00/14] tools/virtio: cleanups, fixes
Posted by Jason Wang 1 week, 2 days ago
On Tue, Dec 9, 2025 at 9:09 PM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Thu, Dec 04, 2025 at 01:46:01PM -0500, Michael S. Tsirkin wrote:
> > Recent virtio changes brought about build errors for tools/virtio,
> > as usual. I did some refactoring to hopefully reduce maintainance
> > load going forward.
> >
> > Adding stubs is tedious and seemed a perfect fit for cursor -
> > so I used it for that, then rewrote some commits and accepted
> > others.  commit logs I've rewritten.
> >
> > Found and fixed a couple of minor bugs while doing this - that
> > part's all mine.
>
>
> Jason, any feedback?

Looks good to me. But I wonder, it looks like synchronization will
become more and more a burden in the future, I wonder if it's time to
switch to using uAPI instead of trying to reuse kernel virtio core to
test vhost?

Thanks

>
> > Michael S. Tsirkin (14):
> >   tools/virtio: fix up compiler.h stub
> >   virtio: make it self-contained
> >   tools/virtio: use kernel's virtio.h
> >   tools/virtio: add struct module forward declaration
> >   tools/virtio: stub DMA mapping functions
> >   tools/virtio: add dev_WARN_ONCE and is_vmalloc_addr stubs
> >   tools/virtio: add ucopysize.h stub
> >   tools/virtio: pass KCFLAGS to module build
> >   tools/virtio: add struct cpumask to cpumask.h
> >   tools/virtio: stub might_sleep and synchronize_rcu
> >   tools/virtio: switch to kernel's virtio_config.h
> >   virtio_features: make it self-contained
> >   tools/virtio: fix up oot build
> >   tools/virtio: add device, device_driver stubs
> >
> >  include/linux/virtio.h             |   2 +
> >  include/linux/virtio_features.h    |   2 +
> >  tools/virtio/Makefile              |   8 ++-
> >  tools/virtio/linux/compiler.h      |   6 ++
> >  tools/virtio/linux/cpumask.h       |   4 ++
> >  tools/virtio/linux/device.h        |   8 +++
> >  tools/virtio/linux/dma-mapping.h   |   4 ++
> >  tools/virtio/linux/kernel.h        |  16 +++++
> >  tools/virtio/linux/module.h        |   2 +
> >  tools/virtio/linux/ucopysize.h     |  21 ++++++
> >  tools/virtio/linux/virtio.h        |  73 +--------------------
> >  tools/virtio/linux/virtio_config.h | 102 +----------------------------
> >  tools/virtio/oot-stubs.h           |  10 +++
> >  13 files changed, 82 insertions(+), 176 deletions(-)
> >  create mode 100644 tools/virtio/linux/ucopysize.h
> >  create mode 100644 tools/virtio/oot-stubs.h
> >
> > --
> > MST
> >
>
Re: [PATCH 00/14] tools/virtio: cleanups, fixes
Posted by Michael S. Tsirkin 1 week, 1 day ago
On Wed, Dec 10, 2025 at 02:24:02PM +0800, Jason Wang wrote:
> On Tue, Dec 9, 2025 at 9:09 PM Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > On Thu, Dec 04, 2025 at 01:46:01PM -0500, Michael S. Tsirkin wrote:
> > > Recent virtio changes brought about build errors for tools/virtio,
> > > as usual. I did some refactoring to hopefully reduce maintainance
> > > load going forward.
> > >
> > > Adding stubs is tedious and seemed a perfect fit for cursor -
> > > so I used it for that, then rewrote some commits and accepted
> > > others.  commit logs I've rewritten.
> > >
> > > Found and fixed a couple of minor bugs while doing this - that
> > > part's all mine.
> >
> >
> > Jason, any feedback?
> 
> Looks good to me.

Can I get an Ack then?

> But I wonder, it looks like synchronization will
> become more and more a burden in the future, I wonder if it's time to
> switch to using uAPI instead of trying to reuse kernel virtio core to
> test vhost?
> 
> Thanks
> 
> >
> > > Michael S. Tsirkin (14):
> > >   tools/virtio: fix up compiler.h stub
> > >   virtio: make it self-contained
> > >   tools/virtio: use kernel's virtio.h
> > >   tools/virtio: add struct module forward declaration
> > >   tools/virtio: stub DMA mapping functions
> > >   tools/virtio: add dev_WARN_ONCE and is_vmalloc_addr stubs
> > >   tools/virtio: add ucopysize.h stub
> > >   tools/virtio: pass KCFLAGS to module build
> > >   tools/virtio: add struct cpumask to cpumask.h
> > >   tools/virtio: stub might_sleep and synchronize_rcu
> > >   tools/virtio: switch to kernel's virtio_config.h
> > >   virtio_features: make it self-contained
> > >   tools/virtio: fix up oot build
> > >   tools/virtio: add device, device_driver stubs
> > >
> > >  include/linux/virtio.h             |   2 +
> > >  include/linux/virtio_features.h    |   2 +
> > >  tools/virtio/Makefile              |   8 ++-
> > >  tools/virtio/linux/compiler.h      |   6 ++
> > >  tools/virtio/linux/cpumask.h       |   4 ++
> > >  tools/virtio/linux/device.h        |   8 +++
> > >  tools/virtio/linux/dma-mapping.h   |   4 ++
> > >  tools/virtio/linux/kernel.h        |  16 +++++
> > >  tools/virtio/linux/module.h        |   2 +
> > >  tools/virtio/linux/ucopysize.h     |  21 ++++++
> > >  tools/virtio/linux/virtio.h        |  73 +--------------------
> > >  tools/virtio/linux/virtio_config.h | 102 +----------------------------
> > >  tools/virtio/oot-stubs.h           |  10 +++
> > >  13 files changed, 82 insertions(+), 176 deletions(-)
> > >  create mode 100644 tools/virtio/linux/ucopysize.h
> > >  create mode 100644 tools/virtio/oot-stubs.h
> > >
> > > --
> > > MST
> > >
> >

Re: [PATCH 00/14] tools/virtio: cleanups, fixes
Posted by Jason Wang 1 week, 1 day ago
On Thu, Dec 11, 2025 at 3:13 PM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Wed, Dec 10, 2025 at 02:24:02PM +0800, Jason Wang wrote:
> > On Tue, Dec 9, 2025 at 9:09 PM Michael S. Tsirkin <mst@redhat.com> wrote:
> > >
> > > On Thu, Dec 04, 2025 at 01:46:01PM -0500, Michael S. Tsirkin wrote:
> > > > Recent virtio changes brought about build errors for tools/virtio,
> > > > as usual. I did some refactoring to hopefully reduce maintainance
> > > > load going forward.
> > > >
> > > > Adding stubs is tedious and seemed a perfect fit for cursor -
> > > > so I used it for that, then rewrote some commits and accepted
> > > > others.  commit logs I've rewritten.
> > > >
> > > > Found and fixed a couple of minor bugs while doing this - that
> > > > part's all mine.
> > >
> > >
> > > Jason, any feedback?
> >
> > Looks good to me.
>
> Can I get an Ack then?
>

Acked-by: Jason Wang <jasowang@redhat.com>

Thanks
Re: [PATCH 00/14] tools/virtio: cleanups, fixes
Posted by Michael S. Tsirkin 1 week, 2 days ago
On Wed, Dec 10, 2025 at 02:24:02PM +0800, Jason Wang wrote:
> On Tue, Dec 9, 2025 at 9:09 PM Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > On Thu, Dec 04, 2025 at 01:46:01PM -0500, Michael S. Tsirkin wrote:
> > > Recent virtio changes brought about build errors for tools/virtio,
> > > as usual. I did some refactoring to hopefully reduce maintainance
> > > load going forward.
> > >
> > > Adding stubs is tedious and seemed a perfect fit for cursor -
> > > so I used it for that, then rewrote some commits and accepted
> > > others.  commit logs I've rewritten.
> > >
> > > Found and fixed a couple of minor bugs while doing this - that
> > > part's all mine.
> >
> >
> > Jason, any feedback?
> 
> Looks good to me. But I wonder, it looks like synchronization will
> become more and more a burden in the future, I wonder if it's time to
> switch to using uAPI instead of trying to reuse kernel virtio core to
> test vhost?
> 
> Thanks

Nothing prevents you from adding more tests, for sure.

UAPI - will likely not get us there. But if you have the energy to
add selftests, maybe.

> >
> > > Michael S. Tsirkin (14):
> > >   tools/virtio: fix up compiler.h stub
> > >   virtio: make it self-contained
> > >   tools/virtio: use kernel's virtio.h
> > >   tools/virtio: add struct module forward declaration
> > >   tools/virtio: stub DMA mapping functions
> > >   tools/virtio: add dev_WARN_ONCE and is_vmalloc_addr stubs
> > >   tools/virtio: add ucopysize.h stub
> > >   tools/virtio: pass KCFLAGS to module build
> > >   tools/virtio: add struct cpumask to cpumask.h
> > >   tools/virtio: stub might_sleep and synchronize_rcu
> > >   tools/virtio: switch to kernel's virtio_config.h
> > >   virtio_features: make it self-contained
> > >   tools/virtio: fix up oot build
> > >   tools/virtio: add device, device_driver stubs
> > >
> > >  include/linux/virtio.h             |   2 +
> > >  include/linux/virtio_features.h    |   2 +
> > >  tools/virtio/Makefile              |   8 ++-
> > >  tools/virtio/linux/compiler.h      |   6 ++
> > >  tools/virtio/linux/cpumask.h       |   4 ++
> > >  tools/virtio/linux/device.h        |   8 +++
> > >  tools/virtio/linux/dma-mapping.h   |   4 ++
> > >  tools/virtio/linux/kernel.h        |  16 +++++
> > >  tools/virtio/linux/module.h        |   2 +
> > >  tools/virtio/linux/ucopysize.h     |  21 ++++++
> > >  tools/virtio/linux/virtio.h        |  73 +--------------------
> > >  tools/virtio/linux/virtio_config.h | 102 +----------------------------
> > >  tools/virtio/oot-stubs.h           |  10 +++
> > >  13 files changed, 82 insertions(+), 176 deletions(-)
> > >  create mode 100644 tools/virtio/linux/ucopysize.h
> > >  create mode 100644 tools/virtio/oot-stubs.h
> > >
> > > --
> > > MST
> > >
> >