]> git.ipfire.org Git - thirdparty/qemu.git/commit
virtio: Re-enable notifications after drain
authorHanna Czenczek <hreitz@redhat.com>
Fri, 2 Feb 2024 15:31:57 +0000 (16:31 +0100)
committerKevin Wolf <kwolf@redhat.com>
Wed, 7 Feb 2024 20:51:03 +0000 (21:51 +0100)
commit5bdbaebcce18fe6a627cafad2043ec08f3de5744
tree912c7defc6b67a91882f4739fd256353e34c3fe9
parentc42c3833e0cfdf2b80fb3ca410acfd392b6874ab
virtio: Re-enable notifications after drain

During drain, we do not care about virtqueue notifications, which is why
we remove the handlers on it.  When removing those handlers, whether vq
notifications are enabled or not depends on whether we were in polling
mode or not; if not, they are enabled (by default); if so, they have
been disabled by the io_poll_start callback.

Because we do not care about those notifications after removing the
handlers, this is fine.  However, we have to explicitly ensure they are
enabled when re-attaching the handlers, so we will resume receiving
notifications.  We do this in virtio_queue_aio_attach_host_notifier*().
If such a function is called while we are in a polling section,
attaching the notifiers will then invoke the io_poll_start callback,
re-disabling notifications.

Because we will always miss virtqueue updates in the drained section, we
also need to poll the virtqueue once after attaching the notifiers.

Buglink: https://issues.redhat.com/browse/RHEL-3934
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
Message-ID: <20240202153158.788922-3-hreitz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
hw/virtio/virtio.c
include/block/aio.h