Hi All,
On 2017-01-10 06:36, Vinod Koul wrote:
On Mon, Jan 09, 2017 at 11:01:29AM +0100, Iago Abal wrote:
With the help of a static bug finder (EBA -
http://www.iagoabal.eu/eba/) I have found a potential double-lock in
drivers/dma/pl330.c. This happens due to a recursive spin_lock_irqsave
on `pch->lock'.
If this is indeed a bug, I will be happy to help with a patch.
The trace is as follows:
1. Function `pl330_free_chan_resources' takes the lock for the first
time in line 2236:
// https://github.com/torvalds/linux/blob/v4.10-rc2/drivers/dma/pl330.c#L2236
spin_lock_irqsave(&pch->lock, flags);
2. Call to function `pl330_release_channel' immediately after;
3. Call to function `dma_pl330_rqcb' in line 1753;
4. Assuming that pch->thread->req[i].desc->pchan == pch, then function
`dma_pl330_rqcb' takes the lock again in line 1505:
// https://github.com/torvalds/linux/blob/v4.10-rc2/drivers/dma/pl330.c#L1505
spin_lock_irqsave(&pch->lock, flags);
Yeah at first looks, it seems to be true, but then folks should have seen
this
Adding folks working on pl330
Right, this is a bug. Thanks for finding this issue!
The simplest way of fixing this issue is changing alloc/free_chan_resources
functions to directly use pl330->lock instead of pch->lock and removing
locking
from pl330_request_channel/pl330_release_channel functions.
Please send a patch, so I will rebase my pending changes related to
runtime PM on
top of it.
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html