From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=47189 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJ43z-000802-4A for qemu-devel@nongnu.org; Mon, 31 May 2010 08:25:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJ43y-0004wa-2r for qemu-devel@nongnu.org; Mon, 31 May 2010 08:25:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2390) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJ43x-0004wI-Rf for qemu-devel@nongnu.org; Mon, 31 May 2010 08:25:50 -0400 Date: Mon, 31 May 2010 15:20:56 +0300 From: "Michael S. Tsirkin" Message-ID: <20100531122055.GB1704@redhat.com> References: <201005311716.43573.rusty@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201005311716.43573.rusty@rustcorp.com.au> Subject: [Qemu-devel] Re: [PATCHv2-RFC 0/2] 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 Mon, May 31, 2010 at 05:16:42PM +0930, Rusty Russell wrote: > On Thu, 27 May 2010 05:20:35 am Michael S. Tsirkin wrote: > > Here's a rewrite of the original patch with a new layout. > > I haven't tested it yet so no idea how this performs, but > > I think this addresses the cache bounce issue raised by Avi. > > Posting for early flames/comments. > > Sorry, not without some evidence that it'll actually reduce cacheline > bouncing. I *think* it will, but it's not obvious: the host may keep > looking at avail_idx as we're updating last_seen. Or does qemu always > look at both together anyway? > Can someone convince me this is a win? > Rusty. What really happens is host looks at flags and last_seen together. And flags happens to be in the same cache line with avail idx. So to get an obvious win, we should put flags and last_seen in a separate cache line from avail, which us easy - just add some padding. And I'll relax the requirement from guest to only require it to update last_seen when interrupts are enabled. This way flags and last_seen are written together and read together. Makes sense? -- MST