[PATCH v2 0/3] virtio: Re-enable notifications after drain

Hanna Czenczek posted 3 patches 9 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240202153158.788922-1-hreitz@redhat.com
Maintainers: Stefan Hajnoczi <stefanha@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <fam@euphon.net>
include/block/aio.h   |  7 ++++++-
hw/block/virtio-blk.c | 21 ++++++++++-----------
hw/scsi/virtio-scsi.c |  7 ++++++-
hw/virtio/virtio.c    | 42 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 64 insertions(+), 13 deletions(-)
[PATCH v2 0/3] virtio: Re-enable notifications after drain
Posted by Hanna Czenczek 9 months, 3 weeks ago
v1:

https://lists.nongnu.org/archive/html/qemu-block/2024-01/msg00336.html


Hi,

This is basically the same series as v1: When using
aio_set_event_notifier_poll(), the io_poll_end() callback is only
invoked when polling ends, not when the notifier is being removed while
in a polling section.  This can leave the virtqueue notifier disabled
during drained sections, which however is not a bad thing.  We just need
to ensure they are re-enabled after the drain, and kick the virtqueue
once to pick up all the requests that came in during the drained
section.

Patch 1 is a technically unrelated fix, but addresses a problem that
became visible with patch 2 applied.

Patch 3 is a small (optional) clean-up patch.


v2:
- Changed the title of this series and patch 2 (was: "Keep notifications
  disabled durin drain"): Keeping the notifier disabled was something
  the initial RFC did, this version (v1 too) just ensures the notifier
  is enabled after the drain, regardless of its state before.

- Use event_notifier_set() instead of virtio_queue_notify() in patch 2

- Added patch 3


Hanna Czenczek (3):
  virtio-scsi: Attach event vq notifier with no_poll
  virtio: Re-enable notifications after drain
  virtio-blk: Use ioeventfd_attach in start_ioeventfd

 include/block/aio.h   |  7 ++++++-
 hw/block/virtio-blk.c | 21 ++++++++++-----------
 hw/scsi/virtio-scsi.c |  7 ++++++-
 hw/virtio/virtio.c    | 42 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 64 insertions(+), 13 deletions(-)

-- 
2.43.0
Re: [PATCH v2 0/3] virtio: Re-enable notifications after drain
Posted by Kevin Wolf 9 months, 3 weeks ago
Am 02.02.2024 um 16:31 hat Hanna Czenczek geschrieben:
> Hanna Czenczek (3):
>   virtio-scsi: Attach event vq notifier with no_poll
>   virtio: Re-enable notifications after drain
>   virtio-blk: Use ioeventfd_attach in start_ioeventfd
> 
>  include/block/aio.h   |  7 ++++++-
>  hw/block/virtio-blk.c | 21 ++++++++++-----------
>  hw/scsi/virtio-scsi.c |  7 ++++++-
>  hw/virtio/virtio.c    | 42 ++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 64 insertions(+), 13 deletions(-)

Thanks, applied to the block branch.

Kevin
Re: [PATCH v2 0/3] virtio: Re-enable notifications after drain
Posted by Stefan Hajnoczi 9 months, 3 weeks ago
On Fri, Feb 02, 2024 at 04:31:55PM +0100, Hanna Czenczek wrote:
> v1:
> 
> https://lists.nongnu.org/archive/html/qemu-block/2024-01/msg00336.html
> 
> 
> Hi,
> 
> This is basically the same series as v1: When using
> aio_set_event_notifier_poll(), the io_poll_end() callback is only
> invoked when polling ends, not when the notifier is being removed while
> in a polling section.  This can leave the virtqueue notifier disabled
> during drained sections, which however is not a bad thing.  We just need
> to ensure they are re-enabled after the drain, and kick the virtqueue
> once to pick up all the requests that came in during the drained
> section.
> 
> Patch 1 is a technically unrelated fix, but addresses a problem that
> became visible with patch 2 applied.
> 
> Patch 3 is a small (optional) clean-up patch.
> 
> 
> v2:
> - Changed the title of this series and patch 2 (was: "Keep notifications
>   disabled durin drain"): Keeping the notifier disabled was something
>   the initial RFC did, this version (v1 too) just ensures the notifier
>   is enabled after the drain, regardless of its state before.
> 
> - Use event_notifier_set() instead of virtio_queue_notify() in patch 2
> 
> - Added patch 3
> 
> 
> Hanna Czenczek (3):
>   virtio-scsi: Attach event vq notifier with no_poll
>   virtio: Re-enable notifications after drain
>   virtio-blk: Use ioeventfd_attach in start_ioeventfd
> 
>  include/block/aio.h   |  7 ++++++-
>  hw/block/virtio-blk.c | 21 ++++++++++-----------
>  hw/scsi/virtio-scsi.c |  7 ++++++-
>  hw/virtio/virtio.c    | 42 ++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 64 insertions(+), 13 deletions(-)
> 
> -- 
> 2.43.0
> 

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>