qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <dwg@au1.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: aliguori@us.ibm.com, "Michael S. Tsirkin" <mst@redhat.com>,
	aik@ozlabs.ru, rusty@rustcorp.com.au, agraf@suse.de,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] virtio: Make memory barriers be memory barriers
Date: Fri, 2 Sep 2011 10:11:28 +1000	[thread overview]
Message-ID: <20110902001128.GN11906@yookeroo.fritz.box> (raw)
In-Reply-To: <4E5FAF6A.70205@redhat.com>

On Thu, Sep 01, 2011 at 06:14:34PM +0200, Paolo Bonzini wrote:
> On 09/01/2011 05:30 PM, Michael S. Tsirkin wrote:
> >>>  The virtio code already has memory barrier wmb() macros in the code.
> >>>  However they are was defined as no-ops.  The comment claims that real
> >>>  barriers are not necessary because the code does not run concurrent.
> >>>  However, with kvm and io-thread enabled, this is not true and this qemu
> >>>  code can indeed run concurrently with the guest kernel.  This does not
> >>>  cause problems on x86 due to it's strongly ordered storage model, but it
> >>>  causes a race leading to virtio errors on POWER which has a relaxed storage
> >>>  ordering model.
> >
> >Why not limit the change to ppc then?
> 
> Because the bug is masked by the x86 memory model, but it is still
> there even there conceptually.  It is not really true that x86 does
> not need memory barriers, though it doesn't in this case:
> 
> http://bartoszmilewski.wordpress.com/2008/11/05/who-ordered-memory-fences-on-an-x86/

Not to mention that pcc is not the only non-x86 architecture.  I don't
know all their storage models off hand, but the point is that there is
a required order to these writes, so there should be a memory barrier.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

  parent reply	other threads:[~2011-09-02  0:40 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-01  6:09 [Qemu-devel] [PATCH] virtio: Make memory barriers be memory barriers David Gibson
2011-09-01  6:47 ` Paolo Bonzini
2011-09-02  0:08   ` David Gibson
2011-09-02  6:49     ` Paolo Bonzini
2011-09-03 11:53       ` Blue Swirl
2011-09-01  7:37 ` Sasha Levin
2011-09-01  7:38   ` Sasha Levin
2011-09-01  7:56   ` Paolo Bonzini
2011-09-02  0:09     ` David Gibson
2011-09-01 15:30 ` Michael S. Tsirkin
2011-09-01 16:14   ` Paolo Bonzini
2011-09-01 16:34     ` Michael S. Tsirkin
2011-09-01 20:31       ` Paolo Bonzini
2011-09-02 15:45         ` Michael S. Tsirkin
2011-09-03 14:46           ` David Gibson
2011-09-04  9:16             ` Michael S. Tsirkin
2011-09-05  4:43               ` David Gibson
2011-09-05  9:19                 ` Michael S. Tsirkin
2011-09-06  3:12                   ` David Gibson
2011-09-06  6:55                     ` Paolo Bonzini
2011-09-06  9:02                       ` David Gibson
2011-09-06  9:28                       ` Avi Kivity
2011-09-06  9:35                         ` Michael S. Tsirkin
2011-09-06  9:38                         ` Paolo Bonzini
2011-09-05  7:41               ` Paolo Bonzini
2011-09-05  8:06                 ` Michael S. Tsirkin
2011-09-05  9:42                   ` Paolo Bonzini
2011-09-03 16:19           ` Paolo Bonzini
2011-09-04  8:47             ` Michael S. Tsirkin
2011-09-02  0:11     ` David Gibson [this message]
2011-09-02  6:11       ` Paolo Bonzini
2011-09-02 15:57         ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110902001128.GN11906@yookeroo.fritz.box \
    --to=dwg@au1.ibm.com \
    --cc=agraf@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=aliguori@us.ibm.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).