at 1:11 AM, Klaus Jensen <i...@irrelevant.dk> wrote: > On Jul 5 22:24, Jinhao Fan wrote: >> Add property "ioeventfd" which is enabled by default. When this is >> enabled, updates on the doorbell registers will cause KVM to signal >> an event to the QEMU main loop to handle the doorbell updates. >> Therefore, instead of letting the vcpu thread run both guest VM and >> IO emulation, we now use the main loop thread to do IO emulation and >> thus the vcpu thread has more cycles for the guest VM. > > This is not entirely accurate. > > Yes, the ioeventfd causes the doorbell write to be handled by the main > iothread, but previously we did not do any substantial device emulation > in the vcpu thread either. That is the reason why we only handle the > bare minimum of the doorbell write and then defer any work until the > timer fires on the main iothread. > > But with this patch we just go ahead and do the work (nvme_process_sq) > immediately since we are already in the main iothread. >
Thanks for pointing this out. I previously thought the timers are fired in the vcpu threads. I misunderstood why this optimization works but accidentally got the code right.