From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lrr0C-0000Ov-JB for qemu-devel@nongnu.org; Thu, 09 Apr 2009 05:56:56 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lrr08-0000MP-LM for qemu-devel@nongnu.org; Thu, 09 Apr 2009 05:56:56 -0400 Received: from [199.232.76.173] (port=36384 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lrr08-0000MF-4w for qemu-devel@nongnu.org; Thu, 09 Apr 2009 05:56:52 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:30693) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Lrr07-0007kE-E2 for qemu-devel@nongnu.org; Thu, 09 Apr 2009 05:56:51 -0400 Received: from [10.80.225.184] ([10.80.225.184]) by smtp01.ad.xensource.com (8.13.1/8.13.1) with ESMTP id n399ulwK001030 for ; Thu, 9 Apr 2009 02:56:47 -0700 Message-ID: <49DDC66F.2000404@eu.citrix.com> Date: Thu, 09 Apr 2009 10:57:03 +0100 From: Stefano Stabellini MIME-Version: 1.0 Subject: Re: [Qemu-devel] buffer alignment for block backends References: <49DCA80A.1020808@eu.citrix.com> <49DCF2C0.9070704@codemonkey.ws> In-Reply-To: <49DCF2C0.9070704@codemonkey.ws> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "qemu-devel@nongnu.org" Anthony Liguori wrote: >> If you do not want to do that, another possible solution is to create a >> new function called "qemu_blockalign" that would be implemented as >> qemu_memalign(512, size); > > This is fine, but this is purely an optimization, it cannot be relied > upon in the general case. well, there aren't many places that allocate buffers for the block backends, I can count only the following for dma operations: - block.c:bdrv_aio_rw_vector and this one for other ide read and write operations: - ide.c:ide_init2 I think it would be important at least for dma operations. >> so we don't have to write 512 bytes everywhere >> but only in one place, thus making life easier to people like me that >> have to change the value for a special case. >> >> Thanks in advance for your sympathy :) >> > > Why does your backend requirement page alignment and who's notion of page? > my backend (block-vbd) needs page aligned buffers because blkfront needs page aligned buffers. I could allocate a new page aligned buffer every time and the memcpy but it is just a waste. The notion of page is the host notion of page (minios in this case).