linux/drivers/dma
Hongbo Zhang 43452fadd6 dmaengine: Freescale: change descriptor release process for supporting async_tx
Fix the potential risk when enable config NET_DMA and ASYNC_TX. Async_tx is
lack of support in current release process of dma descriptor, all descriptors
will be released whatever is acked or no-acked by async_tx, so there is a
potential race condition when dma engine is uesd by others clients (e.g. when
enable NET_DMA to offload TCP).

In our case, a race condition which is raised when use both of talitos and
dmaengine to offload xor is because napi scheduler will sync all pending
requests in dma channels, it affects the process of raid operations due to
ack_tx is not checked in fsl dma. The no-acked descriptor is freed which is
submitted just now, as a dependent tx, this freed descriptor trigger
BUG_ON(async_tx_test_ack(depend_tx)) in async_tx_submit().

TASK = ee1a94a0[1390] 'md0_raid5' THREAD: ecf40000 CPU: 0
GPR00: 00000001 ecf41ca0 ee44/921a94a0 0000003f 00000001 c00593e4 00000000 00000001
GPR08: 00000000 a7a7a7a7 00000001 045/920000002 42028042 100a38d4 ed576d98 00000000
GPR16: ed5a11b0 00000000 2b162000 00000200 046/920000000 2d555000 ed3015e8 c15a7aa0
GPR24: 00000000 c155fc40 00000000 ecb63220 ecf41d28 e47/92f640bb0 ef640c30 ecf41ca0
NIP [c02b048c] async_tx_submit+0x6c/0x2b4
LR [c02b068c] async_tx_submit+0x26c/0x2b4
Call Trace:
[ecf41ca0] [c02b068c] async_tx_submit+0x26c/0x2b448/92 (unreliable)
[ecf41cd0] [c02b0a4c] async_memcpy+0x240/0x25c
[ecf41d20] [c0421064] async_copy_data+0xa0/0x17c
[ecf41d70] [c0421cf4] __raid_run_ops+0x874/0xe10
[ecf41df0] [c0426ee4] handle_stripe+0x820/0x25e8
[ecf41e90] [c0429080] raid5d+0x3d4/0x5b4
[ecf41f40] [c04329b8] md_thread+0x138/0x16c
[ecf41f90] [c008277c] kthread+0x8c/0x90
[ecf41ff0] [c0011630] kernel_thread+0x4c/0x68

Another modification in this patch is the change of completed descriptors,
there is a potential risk which caused by exception interrupt, all descriptors
in ld_running list are seemed completed when an interrupt raised, it works fine
under normal condition, but if there is an exception occured, it cannot work as
our excepted. Hardware should not be depend on s/w list, the right way is to
read current descriptor address register to find the last completed descriptor.
If an interrupt is raised by an error, all descriptors in ld_running should not
be seemed finished, or these unfinished descriptors in ld_running will be
released wrongly.

A simple way to reproduce:
Enable dmatest first, then insert some bad descriptors which can trigger
Programming Error interrupts before the good descriptors. Last, the good
descriptors will be freed before they are processsed because of the exception
intrerrupt.

Note: the bad descriptors are only for simulating an exception interrupt.  This
case can illustrate the potential risk in current fsl-dma very well.

Signed-off-by: Hongbo Zhang <hongbo.zhang@freescale.com>
Signed-off-by: Qiang Liu <qiang.liu@freescale.com>
Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2014-07-14 21:32:18 +05:30
..
bestcomm drivers: clean-up prom.h implicit includes 2013-10-09 20:04:04 -05:00
dw Merge branch 'topic/dw' into for-linus 2014-06-09 21:55:40 +05:30
ioat ioat: fix tasklet tear down 2014-02-25 09:44:20 -08:00
ipu dmaengine: ipu: fix warnings from 64-bit dma_addr_t printouts 2013-11-13 14:10:48 +05:30
ppc4xx Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma 2014-01-29 20:27:23 -08:00
sh dmaengine: sh: don't use dynamic static allocation 2014-06-03 11:35:33 +05:30
xilinx dma: Add Xilinx AXI Video Direct Memory Access Engine driver support 2014-04-30 10:44:13 +05:30
acpi-dma.c acpi-dma: convert to return error code when asked for channel 2014-02-11 23:30:50 +05:30
amba-pl08x.c dma: pl08x: Export pl08x_filter_id 2014-01-28 08:45:54 +05:30
at_hdmac_regs.h dmaengine: at_hdmac: remove unused function 2013-12-12 22:43:41 -08:00
at_hdmac.c dmaengine: at_hdmac: use tasklet_kill in teardown 2014-03-17 18:33:43 +05:30
bcm2835-dma.c dmaengine: Add DMA_PRIVATE to BCM2835 driver 2014-01-20 12:31:50 +05:30
coh901318_lli.c Merge branch 'next' of git://git.infradead.org/users/vkoul/slave-dma 2013-02-26 09:24:48 -08:00
coh901318.c dmaengine: coh901318: use DMA_COMPLETE for dma completion status 2013-10-25 11:15:56 +05:30
coh901318.h dma: coh901318: merge header files 2013-01-07 17:36:37 +01:00
cppi41.c dma: cppi41: handle 0-length packets 2014-07-01 12:15:48 +05:30
dma-jz4740.c dmaengine: jz4740: use DMA_COMPLETE for dma completion status 2013-10-25 11:15:58 +05:30
dmaengine.c dmaengine: fix dmaengine_unmap failure 2014-05-21 14:02:37 -07:00
dmaengine.h
dmatest.c Add new line to test result strings produced in verbose mode 2014-03-26 11:41:45 +05:30
edma.c dmaengine: edma: update DMA memcpy to use new param element 2014-04-30 10:36:57 +05:30
ep93xx_dma.c dmaengine: remove DMA unmap from drivers 2013-11-14 11:04:38 -08:00
fsl-edma.c dma: fix eDMA driver as a subsys_initcall 2014-04-16 12:03:47 +05:30
fsldma.c dmaengine: Freescale: change descriptor release process for supporting async_tx 2014-07-14 21:32:18 +05:30
fsldma.h dmaengine: Freescale: change descriptor release process for supporting async_tx 2014-07-14 21:32:18 +05:30
imx-dma.c dma: imx-dma: Add missing module owner field 2014-03-06 20:51:09 +05:30
imx-sdma.c Update imx-sdma cyclic handling to report residue 2014-07-01 12:23:42 +05:30
intel_mid_dma_regs.h
intel_mid_dma.c dmaengine: intel_mid_dma: use DMA_COMPLETE for dma completion status 2013-10-25 11:16:04 +05:30
iop-adma.c Merge commit 'dmaengine-3.13-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/dmaengine 2013-11-16 12:02:36 +05:30
iovlock.c
k3dma.c dmaengine: k3dma: fix sparse warnings 2014-01-20 13:53:20 +05:30
Kconfig Merge branch 'topic/xilinx' into for-linus 2014-06-09 21:56:29 +05:30
Makefile dma: Add Xilinx AXI Video Direct Memory Access Engine driver support 2014-04-30 10:44:13 +05:30
mmp_pdma.c dma: mmp_pdma: add support for residue reporting 2014-05-07 12:33:40 +05:30
mmp_tdma.c dma: mmp_tdma: move to generic device tree binding 2014-03-06 14:49:54 +05:30
moxart-dma.c dmaengine: Add MOXA ART DMA engine driver 2014-01-20 12:32:46 +05:30
mpc512x_dma.c dmaengine: mpc512x: add support for peripheral transfers 2014-05-22 10:37:01 +05:30
mv_xor.c dma: mv_xor: Flush descriptors before activating a channel 2014-05-21 14:02:35 -07:00
mv_xor.h dma: mv_xor: Fix mis-usage of mmio 'base' and 'high_base' registers 2013-11-14 11:04:42 -08:00
mxs-dma.c dma: mxs-dma: Use semaphores for cyclic DMA 2013-11-13 15:38:31 +05:30
of-dma.c dma: add channel request API that supports deferred probe 2013-12-10 17:46:48 +05:30
omap-dma.c Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma 2014-04-10 08:55:08 -07:00
pch_dma.c dmaengine: pch: fix compilation for alpha target 2014-05-22 18:50:49 +05:30
pl330.c Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma 2014-01-29 20:27:23 -08:00
qcom_bam_dma.c dmaengine: add Qualcomm BAM dma driver 2014-04-05 20:44:26 +05:30
s3c24xx-dma.c dmaengine: s3c24xx-dma: Add cyclic transfer support 2014-06-01 22:22:51 +05:30
sa11x0-dma.c dmaengine: sa11x0: remove broken #ifdef 2014-05-21 11:40:49 +05:30
sirf-dma.c dmaengine: sirf: off by one in of_dma_sirfsoc_xlate() 2014-04-16 11:59:24 +05:30
ste_dma40_ll.c dmaengine: ste_dma40_ll: Replace meaningless register set with comment 2013-06-04 11:12:10 +02:00
ste_dma40_ll.h dmaengine: ste_dma40: Remove unnecessary call to d40_phy_cfg() 2013-05-23 21:13:19 +02:00
ste_dma40.c dma: ste_dma40: Convert to the late system PM callbacks 2014-05-07 15:32:07 +05:30
tegra20-apb-dma.c Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma 2014-01-29 20:27:23 -08:00
timb_dma.c dmaengine: remove DMA unmap from drivers 2013-11-14 11:04:38 -08:00
TODO
txx9dmac.c dma: fix build warnings in txx9 2013-12-12 22:43:41 -08:00
txx9dmac.h
virt-dma.c
virt-dma.h dma: fix vchan_cookie_complete() debug print 2014-01-26 17:33:45 +05:30