Rusty Russell
2011-Dec-23  05:16 UTC
[RESENDx2] [PULL] virtio: fix barriers for virtio-mmio
This one as a signed tag on github, in case the inline patch was
the reason you dropped this.
virtio-mmio in new 3.2, and they found a corruption bug.  Please apply.
 * [new tag]         rusty at rustcorp.com.au -> rusty at rustcorp.com.au
The following changes since commit b3b1b70e62a603f473619dbebc3b3d23f535e6f8:
  Merge branch 'usb-linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb (2011-12-22 12:59:47
-0800)
are available in the git repository at:
  git://github.com/rustyrussell/linux.git master
Rusty Russell (1):
      virtio: harsher barriers for virtio-mmio.
 drivers/lguest/lguest_device.c |    8 +++++---
 drivers/s390/kvm/kvm_virtio.c  |    2 +-
 drivers/virtio/virtio_mmio.c   |    7 ++++---
 drivers/virtio/virtio_pci.c    |    4 ++--
 drivers/virtio/virtio_ring.c   |   34 +++++++++++++++++++++-------------
 include/linux/virtio_ring.h    |    1 +
 tools/virtio/linux/virtio.h    |    1 +
 tools/virtio/virtio_test.c     |    3 ++-
 8 files changed, 37 insertions(+), 23 deletions(-)
commit ef3a731beb9a030e552945a734dc898b5525e2f7
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Fri Dec 23 15:07:56 2011 +1030
    virtio: harsher barriers for virtio-mmio.
    
    We were cheating with our barriers; using the smp ones rather than the
    real device ones.  That was fine, until virtio-mmio came along, which
    could be talking to a real device (a non-SMP CPU).
    
    Unfortunately, just putting back the real barriers (reverting
    d57ed95d) causes a performance regression on virtio-pci.  In
    particular, Amos reports netbench's TCP_RR over virtio_net CPU
    utilization increased up to 35% while throughput went down by up to
    14%.
    
    By comparison, this branch is in the noise.
    
    Reference: https://lkml.org/lkml/2011/12/11/22
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
 drivers/lguest/lguest_device.c |    8 +++++---
 drivers/s390/kvm/kvm_virtio.c  |    2 +-
 drivers/virtio/virtio_mmio.c   |    7 ++++---
 drivers/virtio/virtio_pci.c    |    4 ++--
 drivers/virtio/virtio_ring.c   |   34 +++++++++++++++++++++-------------
 include/linux/virtio_ring.h    |    1 +
 tools/virtio/linux/virtio.h    |    1 +
 tools/virtio/virtio_test.c     |    3 ++-
 8 files changed, 37 insertions(+), 23 deletions(-)
Linus Torvalds
2011-Dec-23  09:31 UTC
[RESENDx2] [PULL] virtio: fix barriers for virtio-mmio
On Thu, Dec 22, 2011 at 9:16 PM, Rusty Russell <rusty at rustcorp.com.au> wrote:> This one as a signed tag on github, in case the inline patch was > the reason you dropped this.No, and please why do you make your tag-names be your email address? That's just odd. It seems to be related to some broken SCM system that thinks that tag-names are global and somehow different from branch-names. No, the reason I didn't pull was that the games with the barriers just threw me off. They seem hacky and disgusting beyond words. And afaik there are no actual *devices* that implement virtio-mmu, and the commit that adds the mmu thing talks about qemu interfaces to. So it's still just virtual, which makes the whole thing just masturbatory, afaik. There's nothing out-of-order in virtual mmio. So the whole thing looks confused. There's never any reason to actually use the expensive sfence/rfences at all. Afaik you still just want smp_*mb() for all cases. Linus