Received: from eggs.gnu.org ([208.118.235.92]:50106) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T6d6H-0006z3-L6 for qemu-devel@nongnu.org; Wed, 29 Aug 2012 03:54:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T6d6B-0003JW-AV for qemu-devel@nongnu.org; Wed, 29 Aug 2012 03:54:09 -0400 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:45839) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T6d6B-0003IT-2I for qemu-devel@nongnu.org; Wed, 29 Aug 2012 03:54:03 -0400 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 29 Aug 2012 08:54:01 +0100 Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by b06cxnps4076.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q7T7rnpo27066522 for ; Wed, 29 Aug 2012 07:53:49 GMT Received: from d06av11.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q7T7rtUB016130 for ; Wed, 29 Aug 2012 01:53:55 -0600 Date: Wed, 29 Aug 2012 08:53:53 +0100 From: Stefan Hajnoczi Message-ID: <20120829075353.GA26390@stefanha-thinkpad.localdomain> References: <1346159067-28734-1-git-send-email-stefanha@linux.vnet.ibm.com> <503CC6BC.2030101@redhat.com> <503CD463.80009@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <503CD463.80009@redhat.com> Subject: Re: [Qemu-devel] [PATCH for-1.2] qed: refuse unaligned zero writes with a backing file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , Stefan Hajnoczi , Anthony Liguori , qemu-devel@nongnu.org On Tue, Aug 28, 2012 at 04:23:31PM +0200, Paolo Bonzini wrote: > Il 28/08/2012 15:37, Stefan Hajnoczi ha scritto: > >> > The "right fix" would not be much more complex though, something like this, right? > >> > (untested). > > Yes but it's more complicated. To do a really good job we should > > slice off the first/last clusters if they are unaligned, handle them > > like regular allocating writes, and handle the middle of the request > > as a zero write. > > > > I decided to do the simplest implementation since this scenario only > > occurs in test cases, not real guests. > > Yes, I was curious because it reminded me of the patch I did to write > zeroes when I was playing with discard to avoid the large bounce buffer > in qed_aio_write_inplace. That patch takes care of processing clusters > one by one (though that means one L2 write for each and every cluster, > not just the first and last). > > It probably causes a performance hit, but anyway I attach it for > completeness. Thanks for sharing. I think this patch could be used as the basis for something that handles the first and last clusters one-at-a-time and does the middle clusters in a single L2 update. I'm not going to implement that right now because I prefer the simple solution unless this code path becomes more used. Stefan