From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Dan Williams" Subject: Re: [md-accel PATCH 16/19] dmaengine: driver for the iop32x, iop33x, and iop13xx raid engines Date: Thu, 30 Aug 2007 13:41:18 -0700 Message-ID: References: <20070627014823.18962.96398.stgit@dwillia2-linux.ch.intel.com> <20070627015155.18962.88413.stgit@dwillia2-linux.ch.intel.com> <0C7297FA1D2D244A9C7F6959C0BF1E52025B10E4@azsmsx413.amr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Disposition: inline Sender: linux-raid-owner@vger.kernel.org To: saeed bishara Cc: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, neilb@suse.de, "Nelson, Shannon" List-Id: linux-raid.ids On 8/30/07, saeed bishara wrote: > you are right, I've another question regarding the function > dma_wait_for_async_tx from async_tx.c, here is the body of the code: > /* poll through the dependency chain, return when tx is complete */ > 1. do { > 2. iter = tx; > 3. while (iter->cookie == -EBUSY) > 4. iter = iter->parent; > 5. > 6. status = dma_sync_wait(iter->chan, iter->cookie); > 7. } while (status == DMA_IN_PROGRESS || (iter != tx)); > > assume that: > - The interrupt capability is not provided. > - Request A was sent to chan 0 > - Request B that depends on A is sent to chan 1 > - Request C that depends on B is send to chan 2. > - Also, assume that when C is handled by async_tx_submit(), B is still > not queued to the dmaengine (cookie equals to -EBUSY). > > In this case, dma_wait_for_async_tx will be called for C, now, it > looks for me that the do while will loop forever, even when A gets > completed. this is because the iter will point to B after line 4, thus > the iter != tx (C) will always become true. > You are right. There are no drivers in the tree that can hit this, but it needs to be fixed up. I'll submit the following change: diff --git a/crypto/async_tx/async_tx.c b/crypto/async_tx/async_tx.c index 0350071..bc18cbb 100644 --- a/crypto/async_tx/async_tx.c +++ b/crypto/async_tx/async_tx.c @@ -80,6 +80,7 @@ dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx) { enum dma_status status; struct dma_async_tx_descriptor *iter; + struct dma_async_tx_descriptor *parent; if (!tx) return DMA_SUCCESS; @@ -87,8 +88,15 @@ dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx) /* poll through the dependency chain, return when tx is complete */ do { iter = tx; - while (iter->cookie == -EBUSY) - iter = iter->parent; + + /* find the root of the unsubmitted dependency chain */ + while (iter->cookie == -EBUSY) { + parent = iter->parent; + if (parent && parent->cookie == -EBUSY) + iter = iter->parent; + else + break; + } > saeed Regards, Dan