Re: [PATCH 04/13] dmaengine: centralize channel allocation, introduce dma_find_channel

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

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

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 644a8c8..ebbfe2d 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -218,7 +218,8 @@ EXPORT_SYMBOL(dma_sync_wait);
 static dma_cap_mask_t dma_cap_mask_all;
 
 /**
- * dma_chan_tbl_ent - tracks channel allocations per core/opertion
+ * dma_chan_tbl_ent - tracks channel allocations per core/operation
+ * @chan - associated channel for this entry
  */
 struct dma_chan_tbl_ent {
 	struct dma_chan *chan;


@@ -247,7 +247,7 @@ static int __init dma_channel_table_init(void)
 	for_each_dma_cap_mask(cap, dma_cap_mask_all) {
 		channel_table[cap] = alloc_percpu(struct dma_chan_tbl_ent);
 		if (!channel_table[cap]) {
-			err = 1;
+			err = -ENOMEM;
 			break;
 		}
 	}


There is locking when we call into the driver.  dmaengine is using the
cpuid as a load balancing hint and nothing more.  We loosely try to
maintain cpu-channel affinity, but if preemption occasionally jumbles
these associations clients can tolerate it.  dma_find_channel is called
relatively frequently so these misassociations should be short-lived


@@ -313,7 +313,8 @@ EXPORT_SYMBOL(dma_issue_pending_all);
  * @n: nth channel desired
  *
  * Defaults to returning the channel with the desired capability and the
- * lowest reference count when 'n' cannot be satisfied
+ * lowest reference count when 'n' cannot be satisfied.  Must be called
+ * under dma_list_mutex.
  */
 static struct dma_chan *nth_chan(enum dma_transaction_type cap, int n)
 {


...nobody has missed it from the NET_DMA case so far, but yes, at some
future date.

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 04/13] dmaengine: centralize channel allocation ..., Dan Williams, (Mon Nov 17, 10:59 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)