From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:33304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrWLI-00080b-Ka for qemu-devel@nongnu.org; Thu, 11 Aug 2011 10:34:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QrWLE-00084V-4l for qemu-devel@nongnu.org; Thu, 11 Aug 2011 10:34:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:23429) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrWLD-00084L-Mf for qemu-devel@nongnu.org; Thu, 11 Aug 2011 10:34:36 -0400 Message-ID: <4E43E928.8060208@redhat.com> Date: Thu, 11 Aug 2011 16:37:28 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <1312478089-806-1-git-send-email-pbonzini@redhat.com> <1312478089-806-6-git-send-email-pbonzini@redhat.com> <20110811075836.GB29542@stefanha-thinkpad.localdomain> <4E43C6CE.9070008@redhat.com> <4E43E619.601@redhat.com> In-Reply-To: <4E43E619.601@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 05/10] dma-helpers: add dma_buf_read and dma_buf_write List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Stefan Hajnoczi , qemu-devel@nongnu.org Am 11.08.2011 16:24, schrieb Paolo Bonzini: > On 08/11/2011 03:29 PM, Stefan Hajnoczi wrote: >>>> >>>> What do you think about passing the residual bytes for short transfers? >>>> Should I look into updating BlockDriverCompletionFunc, or is the approach >>>> of patch 2 okay? If I have an excuse to learn more about Coccinelle, that >>>> can be fun.:) >> The bdrv_aio_readv() and bdrv_aio_writev() functions don't have the >> concept of residual bytes. They only work on fully completed I/O >> operations. If there is an error they pass -errno. > > But if a transfer was split due to failure of cpu_physical_memory_map, > and only the second part fails, you can have a short transfer and you > need to pass residual bytes back. The only way out of this is to make a > bounce buffer as big as all the unmappable parts of the S/G list, which > is undesirable of course. So the residual bytes are a general DMA > concept, not specific to SCSI. > >> Therefore I don't think BlockDriverCompletionFunc is the right type >> to add residual bytes to. > > Right, I would rather update BlockDriverCompletionFunc to pass the AIOCB > as a third parameter, and store the residual bytes in the DMAAIOCB (with > a getter that the completion function can use). Isn't the DMAAIOCB already passed as opaque to the callback? Kevin