From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KZge0-0003FT-8B for qemu-devel@nongnu.org; Sun, 31 Aug 2008 02:42:40 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KZgdx-0003Dr-Bv for qemu-devel@nongnu.org; Sun, 31 Aug 2008 02:42:39 -0400 Received: from [199.232.76.173] (port=48502 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KZgdx-0003Dn-5x for qemu-devel@nongnu.org; Sun, 31 Aug 2008 02:42:37 -0400 Received: from mx20.gnu.org ([199.232.41.8]:21418) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KZgdw-0004C7-OC for qemu-devel@nongnu.org; Sun, 31 Aug 2008 02:42:36 -0400 Received: from il.qumranet.com ([212.179.150.194]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KZgdu-00082H-I2 for qemu-devel@nongnu.org; Sun, 31 Aug 2008 02:42:34 -0400 Received: from gleb-debian.qumranet.com (gleb-debian.qumranet.com.qumranet.com [172.16.15.143]) by il.qumranet.com (Postfix) with ESMTP id 56F5C250EDA for ; Sun, 31 Aug 2008 09:42:31 +0300 (IDT) Date: Sun, 31 Aug 2008 09:42:31 +0300 From: Gleb Natapov Subject: Re: [Qemu-devel] [PATCH] [ide] Check that asynchronous (DMA) submission succeeds Message-ID: <20080831064231.GB6192@minantech.com> References: <18614.55228.190438.575778@mariner.uk.xensource.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18614.55228.190438.575778@mariner.uk.xensource.com> 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 On Thu, Aug 28, 2008 at 05:52:12PM +0100, Ian Jackson wrote: > Check that asynchronous (DMA) submission succeeds > > If it does not, abort the command immediately rather than dropping > it on the floor. > > Signed-off-by: Ian Jackson > --- > hw/ide.c | 9 +++++++++ > 1 files changed, 9 insertions(+), 0 deletions(-) > > diff --git a/hw/ide.c b/hw/ide.c > index 1e60591..9b95c35 100644 > --- a/hw/ide.c > +++ b/hw/ide.c > @@ -737,6 +737,13 @@ static inline void ide_abort_command(IDEState *s) > s->status = READY_STAT | ERR_STAT; > s->error = ABRT_ERR; > } > +static inline void ide_dma_submit_check(IDEState *s, > + BlockDriverCompletionFunc *dma_cb, BMDMAState *bm) > +{ > + if (bm->aiocb) > + return; > + dma_cb(bm, -1); > +} > Currently neither ide_read_dma_cb() nor ide_write_dma_cb() checks ret value. Was the error handling in a different patch that I've missed? > static inline void ide_set_irq(IDEState *s) > { > @@ -933,6 +940,7 @@ static void ide_read_dma_cb(void *opaque, int ret) > #endif > bm->aiocb = bdrv_aio_read(s->bs, sector_num, s->io_buffer, n, > ide_read_dma_cb, bm); > + ide_dma_submit_check(s, ide_read_dma_cb, bm); > } > > static void ide_sector_read_dma(IDEState *s) > @@ -1035,6 +1043,7 @@ static void ide_write_dma_cb(void *opaque, int ret) > #endif > bm->aiocb = bdrv_aio_write(s->bs, sector_num, s->io_buffer, n, > ide_write_dma_cb, bm); > + ide_dma_submit_check(s, ide_write_dma_cb, bm); > } > > static void ide_sector_write_dma(IDEState *s) > -- > 1.4.4.4 > > -- Gleb.