1. 24 9月, 2011 4 次提交
    • D
      Barriers in qemu-barrier.h should not be x86 specific · e2251708
      David Gibson 提交于
      qemu-barrier.h contains a few macros implementing memory barrier
      primitives used in several places throughout qemu.  However, apart
      from the compiler-only barrier, the defined wmb() is correct only for
      x86, or platforms which are similarly strongly ordered.
      
      This patch addresses the FIXME about this by making the wmb() macro
      arch dependent.  On x86, it remains a compiler barrier only, but with
      a comment explaining in more detail the conditions under which this is
      correct.  On weakly-ordered powerpc, an "eieio" instruction is used,
      again with explanation of the conditions under which it is sufficient.
      
      On other platforms, we use the __sync_synchronize() primitive,
      available in sufficiently recent gcc (4.2 and after?).  This should
      implement a full barrier which will be sufficient on all platforms,
      although it may be overkill in some cases.  Other platforms can add
      optimized versions in future if it's worth it for them.
      
      Without proper memory barriers, it is easy to reproduce ordering
      problems with virtio on powerpc; specifically, the QEMU puts new
      element into the "used" ring and then updates the ring free-running
      counter.  Without a barrier between these under the right
      circumstances, the guest linux driver can receive an interrupt, read
      the counter change but find the ring element to be handled still has
      an old value, leading to an "id %u is not a head!\n" error message.
      Similar problems are likely to be possible with kvm on other weakly
      ordered platforms.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      e2251708
    • D
      virtio: Use global memory barrier macros · b90d2f35
      David Gibson 提交于
      The virtio code uses wmb() macros in several places, as required by the
      SMP-aware virtio protocol.  However the wmb() macro is locally defined
      to be a compiler barrier only.  This is probably sufficient on x86
      due to its strong storage ordering model, but it certainly isn't on other
      platforms, such as ppc.
      
      In any case, qemu already has some globally defined memory barrier macros
      in qemu-barrier.h.  This patch, therefore converts virtio.c to use those
      barrier macros.  The macros in qemu-barrier.h are also wrong (or at least,
      safe for x86 only) but this way at least there's only one place to fix
      them.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      b90d2f35
    • S
      Fix and clean code which tests the gcc version · 87751797
      Stefan Weil 提交于
      The code which tests whether gcc supports warn_unused_result was wrong.
      Remove the wrong test from configure and replace it by code using
      macro QEMU_GNUC_PREREQ in compiler.h.
      Signed-off-by: NStefan Weil <weil@mail.berlios.de>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      87751797
    • S
      Move macro QEMU_GNUC_PREREQ to compiler.h · f8b72754
      Stefan Weil 提交于
      The macro is compiler specific and does not depend on the operating system.
      
      Move macro QEMU_GNUC_PREREQ from osdep.h to compiler.h
      and use it to simplify existing code.
      
      host-utils.h uses this macro, so it now needs compiler.h
      instead of osdep.h.
      Signed-off-by: NStefan Weil <weil@mail.berlios.de>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      f8b72754
  2. 23 9月, 2011 11 次提交
  3. 22 9月, 2011 5 次提交
  4. 21 9月, 2011 20 次提交