From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NRcc1-0005p0-UP for qemu-devel@nongnu.org; Sun, 03 Jan 2010 21:24:05 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NRcbw-0005nk-Qk for qemu-devel@nongnu.org; Sun, 03 Jan 2010 21:24:05 -0500 Received: from [199.232.76.173] (port=53659 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NRcbw-0005nf-Ls for qemu-devel@nongnu.org; Sun, 03 Jan 2010 21:24:00 -0500 Received: from ozlabs.org ([203.10.76.45]:58713) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NRcbw-0007KA-3y for qemu-devel@nongnu.org; Sun, 03 Jan 2010 21:24:00 -0500 From: Rusty Russell Date: Mon, 4 Jan 2010 12:37:18 +1030 References: <20091208161818.GA32188@redhat.com> <200912231704.19449.rusty@rustcorp.com.au> <20091223163600.GD6588@redhat.com> In-Reply-To: <20091223163600.GD6588@redhat.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201001041237.19177.rusty@rustcorp.com.au> Subject: [Qemu-devel] Re: [PATCH-RFC 0/3] qemu: memory barriers in virtio List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org, Paul Brook On Thu, 24 Dec 2009 03:06:00 am Michael S. Tsirkin wrote: > On Wed, Dec 23, 2009 at 05:04:19PM +1030, Rusty Russell wrote: > > It's possible, but I don't know of any missing cases. Certainly *lguest* i > > is missing barriers, since it's UP, but the core virtio should have them. > > Something that Paul Brook pointed out, is that > using a 16 bit value in C like we do in guest, e.g. with > ring->avail.idx > might in theory result in two single byte reads. > > If this happens, guest will see a wrong index value. In the Linux kernel we make atomicity assumptions about fundamental types. (Specifically pointers). QEMU may not want to rely on such assumptions however, and make them explicit. I have sympathy with Paul here. Cheers, Rusty.