mbox series

[v2,0/6] aio-posix: split poll check from ready handler

Message ID 20211202153402.604951-1-stefanha@redhat.com (mailing list archive)
Headers show
Series aio-posix: split poll check from ready handler | expand

Message

Stefan Hajnoczi Dec. 2, 2021, 3:33 p.m. UTC
v2:
- Cleaned up unused return values in nvme and virtio-blk [Stefano]
- Documented try_poll_mode() ready_list argument [Stefano]
- Unified virtio-blk/scsi dataplane and non-dataplane virtqueue handlers [Stefano]

The first patch improves AioContext's adaptive polling execution time
measurement. This can result in better performance because the algorithm makes
better decisions about when to poll versus when to fall back to file descriptor
monitoring.

The remaining patches unify the virtio-blk and virtio-scsi dataplane and
non-dataplane virtqueue handlers. This became possible because the dataplane
handler function now has the same function signature as the non-dataplane
handler function. Stefano Garzarella prompted me to make this refactoring.

Stefan Hajnoczi (6):
  aio-posix: split poll check from ready handler
  virtio: get rid of VirtIOHandleAIOOutput
  virtio-blk: drop unused virtio_blk_handle_vq() return value
  virtio-scsi: prepare virtio_scsi_handle_cmd for dataplane
  virtio: use ->handle_output() instead of ->handle_aio_output()
  virtio: unify dataplane and non-dataplane ->handle_output()

 include/block/aio.h             |  4 +-
 include/hw/virtio/virtio-blk.h  |  2 +-
 include/hw/virtio/virtio.h      |  5 +-
 util/aio-posix.h                |  1 +
 block/curl.c                    | 11 ++--
 block/io_uring.c                | 19 ++++---
 block/iscsi.c                   |  4 +-
 block/linux-aio.c               | 16 +++---
 block/nfs.c                     |  6 +--
 block/nvme.c                    | 51 ++++++++++++-------
 block/ssh.c                     |  4 +-
 block/win32-aio.c               |  4 +-
 hw/block/dataplane/virtio-blk.c | 16 +-----
 hw/block/virtio-blk.c           | 14 ++----
 hw/scsi/virtio-scsi-dataplane.c | 60 +++-------------------
 hw/scsi/virtio-scsi.c           |  2 +-
 hw/virtio/virtio.c              | 73 +++++++++------------------
 hw/xen/xen-bus.c                |  6 +--
 io/channel-command.c            |  6 ++-
 io/channel-file.c               |  3 +-
 io/channel-socket.c             |  3 +-
 migration/rdma.c                |  8 +--
 tests/unit/test-aio.c           |  4 +-
 util/aio-posix.c                | 89 +++++++++++++++++++++++++--------
 util/aio-win32.c                |  4 +-
 util/async.c                    | 10 +++-
 util/main-loop.c                |  4 +-
 util/qemu-coroutine-io.c        |  5 +-
 util/vhost-user-server.c        | 11 ++--
 29 files changed, 217 insertions(+), 228 deletions(-)

Comments

Richard W.M. Jones Dec. 2, 2021, 3:49 p.m. UTC | #1
Not sure if this is related, but builds are failing with:

FAILED: libblockdev.fa.p/block_export_fuse.c.o 
cc -m64 -mcx16 -Ilibblockdev.fa.p -I. -I.. -Iqapi -Itrace -Iui -Iui/shader -I/usr/include/fuse3 -I/usr/include/p11-kit-1 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-4 -fdiagnostics-color=auto -Wall -Winvalid-pch -std=gnu11 -O2 -g -isystem /home/rjones/d/qemu/linux-headers -isystem linux-headers -iquote . -iquote /home/rjones/d/qemu -iquote /home/rjones/d/qemu/include -iquote /home/rjones/d/qemu/disas/libvixl -iquote /home/rjones/d/qemu/tcg/i386 -pthread -DSTAP_SDT_V2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi -fstack-protector-strong -fPIE -MD -MQ libblockdev.fa.p/block_export_fuse.c.o -MF libblockdev.fa.p/block_export_fuse.c.o.d -o libblockdev.fa.p/block_export_fuse.c.o -c ../block/export/fuse.c
../block/export/fuse.c: In function ‘setup_fuse_export’:
../block/export/fuse.c:226:59: warning: passing argument 7 of ‘aio_set_fd_handler’ from incompatible pointer type [-Wincompatible-pointer-types]
  226 |                        read_from_fuse_export, NULL, NULL, exp);
      |                                                           ^~~
      |                                                           |
      |                                                           FuseExport *
In file included from ../block/export/fuse.c:22:
/home/rjones/d/qemu/include/block/aio.h:472:36: note: expected ‘void (*)(void *)’ but argument is of type ‘FuseExport *’
  472 |                         IOHandler *io_poll_ready,
      |                         ~~~~~~~~~~~^~~~~~~~~~~~~
../block/export/fuse.c:224:5: error: too few arguments to function ‘aio_set_fd_handler’
  224 |     aio_set_fd_handler(exp->common.ctx,
      |     ^~~~~~~~~~~~~~~~~~
In file included from ../block/export/fuse.c:22:
/home/rjones/d/qemu/include/block/aio.h:466:6: note: declared here
  466 | void aio_set_fd_handler(AioContext *ctx,
      |      ^~~~~~~~~~~~~~~~~~
../block/export/fuse.c: In function ‘fuse_export_shutdown’:
../block/export/fuse.c:268:13: error: too few arguments to function ‘aio_set_fd_handler’
  268 |             aio_set_fd_handler(exp->common.ctx,
      |             ^~~~~~~~~~~~~~~~~~
In file included from ../block/export/fuse.c:22:
/home/rjones/d/qemu/include/block/aio.h:466:6: note: declared here
  466 | void aio_set_fd_handler(AioContext *ctx,
      |      ^~~~~~~~~~~~~~~~~~

Rich.
Stefan Hajnoczi Dec. 2, 2021, 3:55 p.m. UTC | #2
On Thu, Dec 02, 2021 at 03:49:08PM +0000, Richard W.M. Jones wrote:
> 
> Not sure if this is related, but builds are failing with:
> 
> FAILED: libblockdev.fa.p/block_export_fuse.c.o 
> cc -m64 -mcx16 -Ilibblockdev.fa.p -I. -I.. -Iqapi -Itrace -Iui -Iui/shader -I/usr/include/fuse3 -I/usr/include/p11-kit-1 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-4 -fdiagnostics-color=auto -Wall -Winvalid-pch -std=gnu11 -O2 -g -isystem /home/rjones/d/qemu/linux-headers -isystem linux-headers -iquote . -iquote /home/rjones/d/qemu -iquote /home/rjones/d/qemu/include -iquote /home/rjones/d/qemu/disas/libvixl -iquote /home/rjones/d/qemu/tcg/i386 -pthread -DSTAP_SDT_V2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi -fstack-protector-strong -fPIE -MD -MQ libblockdev.fa.p/block_export_fuse.c.o -MF libblockdev.fa.p/block_export_fuse.c.o.d -o libblockdev.fa.p/block_export_fuse.c.o -c ../block/export/fuse.c
> ../block/export/fuse.c: In function ‘setup_fuse_export’:
> ../block/export/fuse.c:226:59: warning: passing argument 7 of ‘aio_set_fd_handler’ from incompatible pointer type [-Wincompatible-pointer-types]
>   226 |                        read_from_fuse_export, NULL, NULL, exp);
>       |                                                           ^~~
>       |                                                           |
>       |                                                           FuseExport *
> In file included from ../block/export/fuse.c:22:
> /home/rjones/d/qemu/include/block/aio.h:472:36: note: expected ‘void (*)(void *)’ but argument is of type ‘FuseExport *’
>   472 |                         IOHandler *io_poll_ready,
>       |                         ~~~~~~~~~~~^~~~~~~~~~~~~
> ../block/export/fuse.c:224:5: error: too few arguments to function ‘aio_set_fd_handler’
>   224 |     aio_set_fd_handler(exp->common.ctx,
>       |     ^~~~~~~~~~~~~~~~~~
> In file included from ../block/export/fuse.c:22:
> /home/rjones/d/qemu/include/block/aio.h:466:6: note: declared here
>   466 | void aio_set_fd_handler(AioContext *ctx,
>       |      ^~~~~~~~~~~~~~~~~~
> ../block/export/fuse.c: In function ‘fuse_export_shutdown’:
> ../block/export/fuse.c:268:13: error: too few arguments to function ‘aio_set_fd_handler’
>   268 |             aio_set_fd_handler(exp->common.ctx,
>       |             ^~~~~~~~~~~~~~~~~~
> In file included from ../block/export/fuse.c:22:
> /home/rjones/d/qemu/include/block/aio.h:466:6: note: declared here
>   466 | void aio_set_fd_handler(AioContext *ctx,
>       |      ^~~~~~~~~~~~~~~~~~

Yes, thanks!

Stefan