]> 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)
committerMichael Tokarev <mjt@tls.msk.ru>
Mon, 12 Feb 2024 16:26:03 +0000 (19:26 +0300)
commit00e50cb42941decc79b61be27a14d009f4d96695
treeaa91ffa830b11178240a25dec2fa461c09388ada
parentfeb2073c866fb2cd600c6783f196139120ff2f9e
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>
(cherry picked from commit 5bdbaebcce18fe6a627cafad2043ec08f3de5744)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/virtio/virtio.c
include/block/aio.h