google / alioth

Experimental KVM-based type-2 hypervisor in Rust implemented from scratch.
Apache License 2.0
164 stars 10 forks source link

fix(virtio): monitor the waker with IORING_OP_POLL_ADD #150

Closed Lencerf closed 2 months ago

Lencerf commented 2 months ago

With IORING_POLL_ADD_MULTI, we do not need to re-add the waker to the ring.

Commit 0c4fc4e3ba8e also used IORING_OP_POLL_ADD for ioeventfds, which was problematic because POLL_ADD does not clear the internal counter of an eventfd when it creates a cqe. So once an ioeventfd is re-added to the ring, it immediately generates a new cqe, despite that there is no new MMIO yet. This causes the event loop thread to spin.