From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [Qemu-devel] [RFC] Replace posix-aio with custom thread pool Date: Fri, 12 Dec 2008 12:17:58 -0600 Message-ID: <4942AAD6.1090408@codemonkey.ws> References: <493FFAB6.2000106@codemonkey.ws> <493FFC8E.9080802@redhat.com> <49400F69.8080707@codemonkey.ws> <20081210190810.GG18814@random.random> <20081212142435.GL6809@random.random> <494276CD.6060904@codemonkey.ws> <20081212154418.GM6809@random.random> <49429629.20309@codemonkey.ws> <20081212170916.GO6809@random.random> <49429EA3.8070008@codemonkey.ws> <20081212175213.GP6809@random.random> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Gerd Hoffmann , qemu-devel@nongnu.org, kvm-devel To: Andrea Arcangeli Return-path: Received: from mail-qy0-f11.google.com ([209.85.221.11]:57187 "EHLO mail-qy0-f11.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757876AbYLLSSE (ORCPT ); Fri, 12 Dec 2008 13:18:04 -0500 Received: by qyk4 with SMTP id 4so1768297qyk.13 for ; Fri, 12 Dec 2008 10:18:03 -0800 (PST) In-Reply-To: <20081212175213.GP6809@random.random> Sender: kvm-owner@vger.kernel.org List-ID: Andrea Arcangeli wrote: > On Fri, Dec 12, 2008 at 11:25:55AM -0600, Anthony Liguori wrote: > >> Hrm, that's more complex than I was expecting. I was thinking the bdrv aio >> infrastructure would always take an iovec. Any details about the >> underlying host's ability to handle the iovec would be insulated. >> > > You can't remove the restart memory-capped mechanism from the dma api, > we've to handle dma to non-ram that potentially requires to copy the > whole buffer so we're forced to have a safe linearization at the dma > api layer. So it's not necessary to reinvent the same > restart-partial-transfer logic in the aio layer too. Just set the > define and teach the aio logic to use pread/pwrite if iovcnt == 1 and > you're done ;). > > So what I'm suggesting is simpler than what you were expecting, not > more complex. It would be more complex to replicate the restart-bounce > logic in the aio layer too. > > Old drivers using bdrv_aio_read/write will keep working, new drivers > using dma api can also use bdrv_aio_readv/writev and the linearization > will happen inside the dma api if aio misses preadv/pwritev support. > You assume that anything using bdrv_aio_readv/writev will be going through a DMA API. This isn't a safe assumption. Furthermore, you need some way to communicate the fact that you cannot handle iovcnt > 1 iovecs in a performant/safe way. Regards, Anthony Liguori