]> git.baikalelectronics.ru Git - kernel.git/commit
dmaengine: pl330: fix descriptor allocation fail
authorAlexander Kochetkov <al.kochet@gmail.com>
Wed, 4 Oct 2017 11:37:23 +0000 (14:37 +0300)
committerVinod Koul <vinod.koul@intel.com>
Fri, 20 Oct 2017 06:16:45 +0000 (11:46 +0530)
commit3c0320c8cd0c46824ab7f72f67ffdc2c3dea175e
tree62d76603c0ce97d6d1b1cdfeb07fc5aa066cd733
parent384fde7ed224f283f11ef2a592b05d4a29492aa8
dmaengine: pl330: fix descriptor allocation fail

If two concurrent threads call pl330_get_desc() when DMAC descriptor
pool is empty it is possible that allocation for one of threads will fail
with message:

kernel: dma-pl330 20078000.dma-controller: pl330_get_desc:2469 ALERT!

Here how that can happen. Thread A calls pl330_get_desc() to get
descriptor. If DMAC descriptor pool is empty pl330_get_desc() allocates
new descriptor on shared pool using add_desc() and then get newly
allocated descriptor using pluck_desc(). At the same time thread B calls
pluck_desc() and take newly allocated descriptor. In that case descriptor
allocation for thread A will fail.

Using on-stack pool for new descriptor allow avoid the issue described.
The patch modify pl330_get_desc() to use on-stack pool for allocation
new descriptors.

Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/pl330.c