qemu-devel
[Top][All Lists]
Advanced

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

Re: [RFC] hw/nvme: Use irqfd to send interrupts


From: Stefan Hajnoczi
Subject: Re: [RFC] hw/nvme: Use irqfd to send interrupts
Date: Thu, 28 Jul 2022 11:38:46 -0400



On Thu, Jul 28, 2022, 11:34 Jinhao Fan <fanjinhao21s@ict.ac.cn> wrote:
at 11:18 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote:

> I think that is incorrect. QEMU has guest notifier emulation for the
> non-KVM (and non-MSI-X PCI) cases. When there is no irqfd support
> available, QEMU sets up a regular eventfd and calls
> virtio_queue_guest_notifier_read() when it becomes readable.

Thanks Stefan. I finally understand why there is a `with_irqfd` parameter
for virtio_queue_set_guest_notifier_fd_handler.

But if `with_irqfd` is false, it seems OK to directly call virtio_irq(). Why
still bother using an eventfd? Is it for interrupt batching?

virtio_irq() is not thread safe so it cannot be called directly from the IOThread. Bouncing through the eventfd ensures that the virtio_irq() call happens in the QEMU main loop thread with the BQL held.

It may be cheaper to use a BH instead of an eventfd when irqfd is not available, but this is a slow path anyway. We might as well reuse the eventfd code that's already there.

StefanĀ 

reply via email to

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