Re: [PATCH 06/13] DMAENGINE: driver for the ARM PL080/PL081 PrimeCells

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linus Walleij
Date: Thursday, December 23, 2010 - 1:17 am

2010/12/23 Dan Williams <dan.j.williams@intel.com>:

Yeah, my bad. I'll get better at this... :-(
(I blame it partially on inaccessible hardware, sob sob. I do like to
run lockdep.)


Isn't it really as simple as to release the spinlock during callbacks?
That lock is only intended to protect the plchan variables, not to block
anyone from queueing new stuff during the callback (as happens now).

It can release that lock, make a callback where a new descriptor
gets queued, and then take it again and start looking at the queue,
at which point it discovers the new desc and process it.

So something like this:


From: Linus Walleij <linus.walleij@stericsson.com>
Date: Thu, 23 Dec 2010 09:06:14 +0100
Subject: [PATCH] dma: release pl08x channel lock during callback

The spinlock is not really safeguarding any resources during the
callback, so let's release it before that and take it back
afterwards so as to avoid deadlocks.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
---
 drivers/dma/amba-pl08x.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index b605cc9..7879a22 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -1651,8 +1651,11 @@ static void pl08x_tasklet(unsigned long data)
 		/*
 		 * Callback to signal completion
 		 */
-		if (callback)
-			callback(callback_param);
+		if (callback) {
+                        spin_unlock(&plchan->lock);
+                        callback(callback_param);
+                        spin_lock(&plchan->lock);
+                }

 		/*
 		 * Device callbacks should NOT clear
-- 
1.7.2.3

Yours,
Linus Walleij
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 06/13] DMAENGINE: driver for the ARM PL080/PL08 ..., Maurus Cuelenaere, (Tue Jun 15, 4:17 am)
Re: [PATCH 06/13] DMAENGINE: driver for the ARM PL080/PL08 ..., Maurus Cuelenaere, (Tue Jun 15, 5:04 am)
Re: [PATCH 06/13] DMAENGINE: driver for the ARM PL080/PL08 ..., Russell King - ARM Linux, (Tue Dec 21, 11:20 am)
Re: [PATCH 06/13] DMAENGINE: driver for the ARM PL080/PL08 ..., Russell King - ARM Linux, (Tue Dec 21, 3:25 pm)
Re: [PATCH 06/13] DMAENGINE: driver for the ARM PL080/PL08 ..., Russell King - ARM Linux, (Wed Dec 22, 5:22 am)
Re: [PATCH 06/13] DMAENGINE: driver for the ARM PL080/PL08 ..., Russell King - ARM Linux, (Wed Dec 22, 5:29 am)
Re: [PATCH 06/13] DMAENGINE: driver for the ARM PL080/PL08 ..., Russell King - ARM Linux, (Wed Dec 22, 4:54 pm)
Re: [PATCH 06/13] DMAENGINE: driver for the ARM PL080/PL08 ..., Russell King - ARM Linux, (Wed Dec 22, 5:10 pm)
Re: [PATCH 06/13] DMAENGINE: driver for the ARM PL080/PL08 ..., Linus Walleij, (Thu Dec 23, 1:17 am)
Re: [PATCH 06/13] DMAENGINE: driver for the ARM PL080/PL08 ..., Russell King - ARM Linux, (Thu Dec 23, 2:18 am)
Re: [PATCH 06/13] DMAENGINE: driver for the ARM PL080/PL08 ..., Russell King - ARM Linux, (Thu Dec 23, 5:30 am)
Re: [PATCH 06/13] DMAENGINE: driver for the ARM PL080/PL08 ..., Russell King - ARM Linux, (Fri Dec 31, 2:50 pm)
Re: [PATCH 06/13] DMAENGINE: driver for the ARM PL080/PL08 ..., Russell King - ARM Linux, (Sat Jan 1, 8:15 am)
Re: [PATCH 06/13] DMAENGINE: driver for the ARM PL080/PL08 ..., Russell King - ARM Linux, (Sat Jan 1, 8:36 am)
Re: [PATCH 06/13] DMAENGINE: driver for the ARM PL080/PL08 ..., Russell King - ARM Linux, (Sun Jan 2, 4:22 am)
Re: [PATCH 06/13] DMAENGINE: driver for the ARM PL080/PL08 ..., Russell King - ARM Linux, (Mon Jan 3, 4:14 am)
Re: [PATCH 06/13] DMAENGINE: driver for the ARM PL080/PL08 ..., Russell King - ARM Linux, (Mon Jan 3, 8:19 am)