[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC 0/3] aio-posix: call ->poll_end() when removing AioHandler
From: |
Fiona Ebner |
Subject: |
Re: [RFC 0/3] aio-posix: call ->poll_end() when removing AioHandler |
Date: |
Mon, 18 Dec 2023 13:41:38 +0100 |
User-agent: |
Mozilla Thunderbird |
Am 14.12.23 um 20:53 schrieb Stefan Hajnoczi:
>
> I will still try the other approach that Hanna and Paolo have suggested.
> It seems more palatable. I will send a v2.
>
FYI, what I already tried downstream (for VirtIO SCSI):
> diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
> index 9c751bf296..a6449b04d0 100644
> --- a/hw/scsi/virtio-scsi.c
> +++ b/hw/scsi/virtio-scsi.c
> @@ -1166,6 +1166,8 @@ static void virtio_scsi_drained_end(SCSIBus *bus)
>
> for (uint32_t i = 0; i < total_queues; i++) {
> VirtQueue *vq = virtio_get_queue(vdev, i);
> + virtio_queue_set_notification(vq, 1);
> + virtio_queue_notify(vdev, i);
> virtio_queue_aio_attach_host_notifier(vq, s->ctx);
> }
> }
But this introduces an issue where e.g. a 'backup' QMP command would put
the iothread into a bad state. After the command, whenever the guest
issues IO, the thread will temporarily spike to using 100% CPU. Using
QMP stop+cont is a way to make it go back to normal.
I think it's because of nested drains, because when additionally
checking that the drain count is zero and only executing the loop then,
that issue doesn't seem to manifest, i.e.:
> diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
> index 9c751bf296..d22c586b38 100644
> --- a/hw/scsi/virtio-scsi.c
> +++ b/hw/scsi/virtio-scsi.c
> @@ -1164,9 +1164,13 @@ static void virtio_scsi_drained_end(SCSIBus *bus)
> return;
> }
>
> - for (uint32_t i = 0; i < total_queues; i++) {
> - VirtQueue *vq = virtio_get_queue(vdev, i);
> - virtio_queue_aio_attach_host_notifier(vq, s->ctx);
> + if (s->bus.drain_count == 0) {
> + for (uint32_t i = 0; i < total_queues; i++) {
> + VirtQueue *vq = virtio_get_queue(vdev, i);
> + virtio_queue_set_notification(vq, 1);
> + virtio_queue_notify(vdev, i);
> + virtio_queue_aio_attach_host_notifier(vq, s->ctx);
> + }
> }
> }
>
Best Regards,
Fiona
- [RFC 3/3] aio-posix: call ->poll_end() when removing AioHandler, (continued)
Re: [RFC 0/3] aio-posix: call ->poll_end() when removing AioHandler, Stefan Hajnoczi, 2023/12/13
Re: [RFC 0/3] aio-posix: call ->poll_end() when removing AioHandler, Paolo Bonzini, 2023/12/13
Re: [RFC 0/3] aio-posix: call ->poll_end() when removing AioHandler, Fiona Ebner, 2023/12/14