Skip to content
  • Michael S. Tsirkin's avatar
    vhost: fix barrier pairing · 0d499356
    Michael S. Tsirkin authored
    
    
    According to memory-barriers.txt, an smp memory barrier in guest
    should always be paired with an smp memory barrier in host,
    and I quote "a lack of appropriate pairing is almost certainly an
    error". In case of vhost, failure to flush out used index
    update before looking at the interrupt disable flag
    could result in missed interrupts, resulting in
    networking hang under stress.
    
    This might happen when flags read bypasses used index write.
    So we see interrupts disabled and do not interrupt, at the
    same time guest writes flags value to enable interrupt,
    reads an old used index value, thinks that
    used ring is empty and waits for interrupt.
    
    Note: the barrier we pair with here is in
    drivers/virtio/virtio_ring.c, function
    vring_enable_cb.
    
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    Acked-by: default avatarJuan Quintela <quintela@redhat.com>
    0d499356