Skip to content

Commit

Permalink
virtq: Use hardware memory barrier in "call"
Browse files Browse the repository at this point in the history
This fixes a subtle bug where the guest can become stuck due to
missing an interrupt. This happens with e.g. Linux kernel guests that
use interrupts and not e.g. DPDK guests that are polling.

See details on snabb-devel:
https://groups.google.com/d/msg/snabb-devel/8oGjqlSkiqw/4Yi9CVEdjD0J
  • Loading branch information
lukego committed Apr 9, 2015
1 parent 49dbb39 commit c33cdd8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/virtio/virtq.lua
Expand Up @@ -101,9 +101,10 @@ end
-- Prepared argument for writing a 1 to an eventfd.
local eventfd_one = ffi.new("uint64_t[1]", {1})
function VirtioVirtq:signal_used()
function VirtioVirtq:signal_used ()
if self.virtq.used.idx ~= self.used then
self.virtq.used.idx = self.used
C.full_memory_barrier()
if band(self.virtq.avail.flags, C.VRING_F_NO_INTERRUPT) == 0 then
C.write(self.callfd, eventfd_one, 8)
end
Expand Down

0 comments on commit c33cdd8

Please sign in to comment.