From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OBDmW-0006fA-IN for qemu-devel@nongnu.org; Sun, 09 May 2010 17:11:24 -0400 Received: from [140.186.70.92] (port=55220 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OBDmT-0006en-WD for qemu-devel@nongnu.org; Sun, 09 May 2010 17:11:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OBDmS-0001GO-IQ for qemu-devel@nongnu.org; Sun, 09 May 2010 17:11:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16058) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OBDmS-0001GH-AE for qemu-devel@nongnu.org; Sun, 09 May 2010 17:11:20 -0400 Date: Mon, 10 May 2010 00:06:52 +0300 From: "Michael S. Tsirkin" Message-ID: <20100509210652.GB21338@redhat.com> References: <20100505205814.GA7090@redhat.com> <201005061201.35223.rusty@rustcorp.com.au> <20100506061945.GA8363@redhat.com> <201005071303.29129.rusty@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201005071303.29129.rusty@rustcorp.com.au> Subject: [Qemu-devel] Re: [PATCH RFC] virtio: put last seen used index into ring itself List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Rusty Russell Cc: qemu-devel@nongnu.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org On Fri, May 07, 2010 at 01:03:28PM +0930, Rusty Russell wrote: > On Thu, 6 May 2010 03:49:46 pm Michael S. Tsirkin wrote: > > Now, I also added an mb() in guest between read and write so > > that last used index write can not get ahead of used index read. > > It does feel good to have it there, but I can not say why > > it's helpful. Works fine without it, but then these > > subtle races might be hard to trigger. What do you think? > > I couldn't see that in the patch? I don't think it's necessary > though, since the write of depends last_used depends on the read of > used (and no platform we care about would reorder such a thing). Well, there's no data dependency, is there? > I'm reasonably happy, but we should write some convenient test for > missing interrupts. > > I'm thinking of a sender which does a loop: blasts 1MB of UDP packets, > then prints the time and sleep(1). The receiver would print the time > every 1MB of received data. The two times should almost exactly correspond. > > Assuming that the network doesn't overflow and lose stuff, this should > identify any missing wakeup/interrupts (depending on direction used). > > Cheers, > Rusty.