qemu-stable
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] virtio-blk: avoid using ioeventfd state in irqfd conditional


From: Kevin Wolf
Subject: Re: [PATCH] virtio-blk: avoid using ioeventfd state in irqfd conditional
Date: Wed, 7 Feb 2024 22:00:12 +0100

Am 22.01.2024 um 18:26 hat Stefan Hajnoczi geschrieben:
> Requests that complete in an IOThread use irqfd to notify the guest
> while requests that complete in the main loop thread use the traditional
> qdev irq code path. The reason for this conditional is that the irq code
> path requires the BQL:
> 
>   if (s->ioeventfd_started && !s->ioeventfd_disabled) {
>       virtio_notify_irqfd(vdev, req->vq);
>   } else {
>       virtio_notify(vdev, req->vq);
>   }
> 
> There is a corner case where the conditional invokes the irq code path
> instead of the irqfd code path:
> 
>   static void virtio_blk_stop_ioeventfd(VirtIODevice *vdev)
>   {
>       ...
>       /*
>        * Set ->ioeventfd_started to false before draining so that host 
> notifiers
>        * are not detached/attached anymore.
>        */
>       s->ioeventfd_started = false;
> 
>       /* Wait for virtio_blk_dma_restart_bh() and in flight I/O to complete */
>       blk_drain(s->conf.conf.blk);
> 
> During blk_drain() the conditional produces the wrong result because
> ioeventfd_started is false.
> 
> Use qemu_in_iothread() instead of checking the ioeventfd state.
> 
> Buglink: https://issues.redhat.com/browse/RHEL-15394
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

Thanks, applied to the block branch.

Kevin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]