linux-kernel-test/drivers/dma
Russell King - ARM Linux 858c21c0f3 ARM: PL08x: move callback outside spinlock'd region
Calling the callback handler with spinlocks in the tasklet held leads
to deadlock when dmaengine functions are called:

BUG: spinlock lockup on CPU#0, sh/417, c1870a08
Backtrace:
...
[<c017b408>] (do_raw_spin_lock+0x0/0x154) from [<c02c4b98>] (_raw_spin_lock_irqsave+0x54/0x60)
[<c02c4b44>] (_raw_spin_lock_irqsave+0x0/0x60) from [<c01f5828>] (pl08x_prep_channel_resources+0x718/0x8b4)
[<c01f5110>] (pl08x_prep_channel_resources+0x0/0x8b4) from [<c01f5bb4>] (pl08x_prep_slave_sg+0x120/0x19c)
[<c01f5a94>] (pl08x_prep_slave_sg+0x0/0x19c) from [<c01be7a0>] (pl011_dma_tx_refill+0x164/0x224)
[<c01be63c>] (pl011_dma_tx_refill+0x0/0x224) from [<c01bf1c8>] (pl011_dma_tx_callback+0x7c/0xc4)
[<c01bf14c>] (pl011_dma_tx_callback+0x0/0xc4) from [<c01f4d34>] (pl08x_tasklet+0x60/0x368)
[<c01f4cd4>] (pl08x_tasklet+0x0/0x368) from [<c004d978>] (tasklet_action+0xa0/0x100)

Dan quoted the documentation:
> 2/ Completion callback routines cannot submit new operations.  This
>    results in recursion in the synchronous case and spin_locks being
>    acquired twice in the asynchronous case.

but then followed up to say:
> I should clarify, this is the async_memcpy() api requirement which is
> not used outside of md/raid5.  DMA drivers can and do allow new
> submissions from callbacks, and the ones that do so properly move the
> callback outside of the driver lock.

So let's fix it by moving the callback out of the spinlocked region.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-01-04 19:16:13 -08:00
..
ioat ioat2: fix performance regression 2010-10-13 15:43:10 -07:00
ipu DMAENGINE: extend the control command to include an arg 2010-05-17 16:30:42 -07:00
ppc4xx of/device: Replace struct of_device with struct platform_device 2010-08-06 09:25:50 -06:00
amba-pl08x.c ARM: PL08x: move callback outside spinlock'd region 2011-01-04 19:16:13 -08:00
at_hdmac_regs.h at_hdmac: implement a private tx_list 2009-09-08 17:53:03 -07:00
at_hdmac.c Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx 2010-08-09 21:00:07 -07:00
coh901318_lli.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
coh901318_lli.h tree-wide: Assorted spelling fixes 2010-02-09 11:13:56 +01:00
coh901318.c Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx 2010-10-27 19:04:36 -07:00
dmaengine.c async_tx: make async_tx channel switching opt-in 2010-10-07 17:08:32 -07:00
dmatest.c dma: dmatest: fix potential sign bug 2010-08-04 14:27:47 -07:00
dw_dmac_regs.h dw_dmac: implement a private tx_list 2009-09-08 17:53:02 -07:00
dw_dmac.c DMAENGINE: extend the control command to include an arg 2010-05-17 16:30:42 -07:00
fsldma.c fsldma: improved DMA_SLAVE support 2010-10-07 14:41:41 -07:00
fsldma.h fsldma: major cleanups and fixes 2010-02-02 14:51:42 -07:00
imx-dma.c dma: imx-dma: fix signedness bug 2010-10-22 11:08:27 -07:00
imx-sdma.c dmaengine: Add Freescale i.MX SDMA support 2010-10-05 15:49:26 -07:00
intel_mid_dma_regs.h intel_mid_dma: change the slave interface 2010-10-07 15:03:44 -07:00
intel_mid_dma.c intel_mid_dma: change the slave interface 2010-10-07 15:03:44 -07:00
iop-adma.c Merge branch 'ioat' into dmaengine 2010-05-17 16:30:58 -07:00
iovlock.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
Kconfig drivers/dma/Kconfig: add part number for Topcliff. 2010-10-29 14:14:02 -07:00
Makefile Merge branches 'dma40', 'pl08x', 'fsldma', 'imx' and 'intel-mid' into dmaengine 2010-10-07 15:19:01 -07:00
mpc512x_dma.c of/device: Replace struct of_device with struct platform_device 2010-08-06 09:25:50 -06:00
mv_xor.c dmaengine: fix interrupt clearing for mv_xor 2010-09-23 14:14:22 -07:00
mv_xor.h mv_xor: implement a private tx_list 2009-09-08 17:53:03 -07:00
pch_dma.c NULL-terminate all pci_device_id tables 2010-10-27 20:33:05 +10:30
pl330.c DMA: PL330: Add dma api driver 2010-05-23 20:28:19 -07:00
shdma.c dma/shdma: move dereference below the NULL check 2010-09-22 15:29:17 -07:00
shdma.h dmaengine: shdma: Introduce include/linux/sh_dma.h 2010-03-23 17:20:06 +09:00
ste_dma40_ll.c ste_dma40: remove enum for endianess 2010-10-19 15:17:07 -07:00
ste_dma40_ll.h ste_dma40: move mode_opt to separate config 2010-10-19 15:17:07 -07:00
ste_dma40.c Merge branch 'dma40' into dmaengine 2010-10-19 15:34:26 -07:00
timb_dma.c dma/timberdale: simplify conditional 2010-10-19 15:20:11 -07:00
txx9dmac.c Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx 2010-05-21 17:05:46 -07:00
txx9dmac.h txx9dmac: implement a private tx_list 2009-09-08 17:53:03 -07:00