Message ID | 20220811153739.3079672-1-fanjinhao21s@ict.ac.cn (mailing list archive) |
---|---|
Headers | show |
Series | hw/nvme: add irqfd support | expand |
at 11:37 PM, Jinhao Fan <fanjinhao21s@ict.ac.cn> wrote: > This patch series changes qemu-nvme's interrupt emulation to use event > notifiers, which can ensure thread-safe interrupt delivery when iothread > is used. In the first two patches, I convert qemu-nvme's IO emulation > logic to send irq via eventfd, so that the actual assertion and > deassertion is always done in the main loop thread with BQL held. In the > third patch, support is added to send irq via KVM irqfd, bypassing > qemu's MSI-x emulation. In the last patch, I add MSI-x mask handlers > when irqfd is enabled so that qemu-nvme knows which vector is masked > even when qemu's MSI-x emulation is bypassed. > > Jinhao Fan (4): > hw/nvme: avoid unnecessary call to irq (de)assertion functions > hw/nvme: add option to (de)assert irq with eventfd > hw/nvme: use irqfd to send interrupts > hw/nvme: add MSI-x mask handlers for irqfd > > hw/nvme/ctrl.c | 251 +++++++++++++++++++++++++++++++++++++++---- > hw/nvme/nvme.h | 7 ++ > hw/nvme/trace-events | 3 + > 3 files changed, 243 insertions(+), 18 deletions(-) > > -- > 2.25.1 Ping~ Thanks!
On Aug 11 23:37, Jinhao Fan wrote: > This patch series changes qemu-nvme's interrupt emulation to use event > notifiers, which can ensure thread-safe interrupt delivery when iothread > is used. In the first two patches, I convert qemu-nvme's IO emulation > logic to send irq via eventfd, so that the actual assertion and > deassertion is always done in the main loop thread with BQL held. In the > third patch, support is added to send irq via KVM irqfd, bypassing > qemu's MSI-x emulation. In the last patch, I add MSI-x mask handlers > when irqfd is enabled so that qemu-nvme knows which vector is masked > even when qemu's MSI-x emulation is bypassed. > > Jinhao Fan (4): > hw/nvme: avoid unnecessary call to irq (de)assertion functions > hw/nvme: add option to (de)assert irq with eventfd > hw/nvme: use irqfd to send interrupts > hw/nvme: add MSI-x mask handlers for irqfd > > hw/nvme/ctrl.c | 251 +++++++++++++++++++++++++++++++++++++++---- > hw/nvme/nvme.h | 7 ++ > hw/nvme/trace-events | 3 + > 3 files changed, 243 insertions(+), 18 deletions(-) > > -- > 2.25.1 > Hi Jinhao, This series all looks pretty good to me. And, incidentally, it is also super cool work :) It can use a bit of clean up (the code duplication mentioned previously by both Stefan and me) - but all the logic seems sound to me and my testing is happy. Following up on my suggestion to drop the MSI-X mask/unmasking, I gave the logic a thorough look it looks sound to me. I'm gonna see what I can come up with for qtest. I suggest you just keep going on iothread support. Please post a v2 (all 4 patches) with suggested cleanups and we take it from there.