Re: [PATCH 02/13] dmaengine: remove dependency on async_tx

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Dan Williams
Date: Monday, November 17, 2008 - 4:44 pm

Thanks for the review.

On Fri, 2008-11-14 at 23:02 -0700, Andrew Morton wrote:

Noted... and a few more:

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index dae88f2..d5d60de 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -344,9 +344,9 @@ static struct dma_chan *nth_chan(enum dma_transaction_type cap, int n)
  * dma_channel_rebalance - redistribute the available channels
  *
  * Optimize for cpu isolation (each cpu gets a dedicated channel for an
- * operation type) in the SMP case,  and opertaion isolation (avoid
- * multi-tasking channels) in the uniprocessor case.  Must be called
- * under dma_list_mutex.
+ * operation type) in the SMP case,  and operation isolation (avoid
+ * multi-tasking channels) in the non-SMP case.  Must be called under
+ * dma_list_mutex.
  */
 static void dma_channel_rebalance(void)
 {
@@ -632,7 +632,7 @@ err_out:
 EXPORT_SYMBOL(dma_async_device_register);
 
 /**
- * dma_async_device_unregister - unregisters DMA devices
+ * dma_async_device_unregister - unregister a DMA device
  * @device: &dma_device
  *
  * This routine is called by dma driver exit routines, dmaengine holds module
@@ -804,7 +804,7 @@ void dma_async_tx_descriptor_init(struct dma_async_tx_descriptor *tx,
 }
 EXPORT_SYMBOL(dma_async_tx_descriptor_init);
 
-/* dma_wait_for_async_tx - spin wait for a transcation to complete
+/* dma_wait_for_async_tx - spin wait for a transaction to complete
  * @tx: transaction to wait on
  */
 enum dma_status



This routine was created to cover cases where the backing device driver
did not support "interrupt" descriptors for notification of operation
completion.  All drivers should be fixed up now so how about the
following:

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index d5d60de..dce6d00 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -805,7 +805,13 @@ void dma_async_tx_descriptor_init(struct dma_async_tx_descriptor *tx,
 EXPORT_SYMBOL(dma_async_tx_descriptor_init);
 
 /* dma_wait_for_async_tx - spin wait for a transaction to complete
- * @tx: transaction to wait on
+ * @tx: in-flight transaction to wait on
+ *
+ * This routine assumes that tx was obtained from a call to async_memcpy,
+ * async_xor, async_memset, etc which ensures that tx is "in-flight" (prepped
+ * and submitted).  Walking the parent chain is only meant to cover for DMA
+ * drivers that do not implement the DMA_INTERRUPT capability and may race with
+ * the driver's descriptor cleanup routine.
  */
 enum dma_status
 dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
@@ -817,6 +823,9 @@ dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
 	if (!tx)
 		return DMA_SUCCESS;
 
+	WARN_ONCE(tx->parent, "%s: speculatively walking dependency chain for"
+		  " %s\n", __func__, dev_name(&tx->chan->dev));
+
 	/* poll through the dependency chain, return when tx is complete */
 	do {
 		iter = tx;


Regards,
Dan

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/13] dmaengine redux, Dan Williams, (Fri Nov 14, 2:34 pm)
[PATCH 02/13] dmaengine: remove dependency on async_tx, Dan Williams, (Fri Nov 14, 2:34 pm)
[PATCH 06/13] net_dma: convert to dma_find_channel, Dan Williams, (Fri Nov 14, 2:34 pm)
[PATCH 08/13] dmatest: convert to dma_request_channel, Dan Williams, (Fri Nov 14, 2:34 pm)
[PATCH 12/13] dmaengine: remove 'bigref' infrastructure, Dan Williams, (Fri Nov 14, 2:35 pm)
[PATCH 13/13] dmaengine: kill enum dma_state_client, Dan Williams, (Fri Nov 14, 2:35 pm)
Re: [PATCH 02/13] dmaengine: remove dependency on async_tx, Andrew Morton, (Fri Nov 14, 11:02 pm)
Re: [PATCH 08/13] dmatest: convert to dma_request_channel, Andrew Morton, (Fri Nov 14, 11:17 pm)
Re: [PATCH 02/13] dmaengine: remove dependency on async_tx, Dan Williams, (Mon Nov 17, 4:44 pm)
Re: [PATCH 08/13] dmatest: convert to dma_request_channel, Dan Williams, (Tue Nov 18, 11:24 am)
Re: [PATCH 08/13] dmatest: convert to dma_request_channel, Andrew Morton, (Tue Nov 18, 1:58 pm)
Re: [PATCH 07/13] dmaengine: introduce dma_request_channel ..., Guennadi Liakhovetski, (Tue Dec 2, 8:52 am)
Re: [PATCH 07/13] dmaengine: introduce dma_request_channel ..., Guennadi Liakhovetski, (Tue Dec 2, 10:27 am)
Re: [PATCH 07/13] dmaengine: introduce dma_request_channel ..., Guennadi Liakhovetski, (Tue Dec 2, 2:28 pm)
Re: [PATCH 03/13] dmaengine: up-level reference counting t ..., Guennadi Liakhovetski, (Thu Dec 4, 9:56 am)
Re: [PATCH 03/13] dmaengine: up-level reference counting t ..., Guennadi Liakhovetski, (Thu Dec 4, 12:28 pm)
RE: [PATCH 00/13] dmaengine redux, Sosnowski, Maciej, (Fri Dec 12, 7:27 am)
RE: [PATCH 03/13] dmaengine: up-level reference counting t ..., Sosnowski, Maciej, (Fri Dec 12, 7:28 am)
RE: [PATCH 07/13] dmaengine: introduce dma_request_channel ..., Sosnowski, Maciej, (Fri Dec 12, 7:29 am)
RE: [PATCH 11/13] dmaengine: kill struct dma_client and su ..., Sosnowski, Maciej, (Fri Dec 12, 7:29 am)
RE: [PATCH 03/13] dmaengine: up-level reference counting t ..., Sosnowski, Maciej, (Thu Dec 18, 7:26 am)
RE: [PATCH 07/13] dmaengine: introduce dma_request_channel ..., Sosnowski, Maciej, (Thu Dec 18, 7:33 am)
RE: [PATCH 11/13] dmaengine: kill struct dma_client and su ..., Sosnowski, Maciej, (Thu Dec 18, 7:34 am)
Re: [PATCH 07/13] dmaengine: introduce dma_request_channel ..., Guennadi Liakhovetski, (Fri Jan 30, 4:27 pm)