de37310dd07e2820111bd6618ea60e6e11836912
[openwrt/staging/ldir.git] /
1 From 46c343673c6eae7909f644f9b67101ce14309670 Mon Sep 17 00:00:00 2001
2 From: Robin Gong <yibin.gong@nxp.com>
3 Date: Tue, 19 Sep 2017 11:36:58 +0800
4 Subject: [PATCH] MLK-16482: dma: fsl-edma-v3: Fix RCU issue while playing
5 Audio
6
7 That's caused by commit 593034f1b908 ("MLK-16437: dma: fsl-edma-v3:
8 fix kernel crash while edma interrupt trigger after channel disabled").
9 Because fsl_chan->vchan.lock will be hold always and trigger RCU report
10 as below:
11
12 1571.3 Playing WAVE '/mnt/nfs/vte_mx82/../test_stream/esai_stream/48k16bit-six.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Channels 6
13 1571.5 [ 4642.698771] INFO: rcu_preempt detected stalls on CPUs/tasks:
14 1571.6 [ 4642.704443] 0-...: (1 GPs behind) idle=2c5/140000000000000/0 softirq=155373/155374 fqs=2541
15 1571.7 [ 4642.712967] (detected by 2, t=5252 jiffies, g=104259, c=104258, q=22)
16 1571.8 [ 4642.719501] Task dump for CPU 0:
17 1571.9 [ 4642.722724] aplay R running task 0 15723 15721 0x00000202
18 1571.10 [ 4642.729786] Call trace:
19 1571.11 [ 4642.732239] [<ffff0000080855e4>] __switch_to+0x8c/0xa0
20 1571.12 [ 4642.737379] [<ffff0000084e3a48>] dma_chan_put+0x70/0xa0
21 1571.13 [ 4642.742603] [<ffff0000084e3aac>] dma_release_channel+0x34/0xa0
22 1571.14 [ 4642.748435] [<ffff000008972240>] fsl_asrc_dma_hw_free+0x38/0x50
23 1571.15 [ 4642.754358] [<ffff000008960568>] soc_pcm_hw_free+0x110/0x1a8
24 1571.16 [ 4642.760013] [<ffff000008963bcc>] dpcm_fe_dai_hw_free+0x6c/0xe0
25 1571.17 [ 4642.765844] [<ffff000008948ae8>] snd_pcm_common_ioctl1+0xb40/0xce0
26 1571.18 [ 4642.772028] [<ffff000008948e64>] snd_pcm_playback_ioctl1+0x1dc/0x310
27 1571.19 [ 4642.778378] [<ffff000008948fc0>] snd_pcm_playback_ioctl+0x28/0x40
28 1571.20 [ 4642.784470] [<ffff0000081ee0a4>] do_vfs_ioctl+0xa4/0x748
29 1571.21 [ 4642.789784] [<ffff0000081ee7d4>] SyS_ioctl+0x8c/0xa0
30 1571.22 [ 4642.794745] [<ffff000008082f4c>] __sys_trace_return+0x0/0x4
31 1571.23 [ 4705.718740] INFO: rcu_preempt detected stalls on CPUs/tasks:
32 1571.24 [ 4705.724420] 0-...: (1 GPs behind) idle=2c5/140000000000000/0 softirq=155373/155374 fqs=10407
33 1571.25 [ 4705.733030] (detected by 1, t=21010 jiffies, g=104259, c=104258, q=119)
34
35 Signed-off-by: Robin Gong <yibin.gong@nxp.com>
36 Reported-by: Jason Liu <jason.hui.liu@nxp.com>
37 Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
38 Fixes: 593034f1b908 ("MLK-16437: dma: fsl-edma-v3: fix kernel crash
39 while edma interrupt trigger after channel disabled").
40
41 (cherry picked from commit e62e8707154f47e168fcfd148e97be4e2f991898)
42 ---
43 drivers/dma/fsl-edma-v3.c | 4 ++--
44 1 file changed, 2 insertions(+), 2 deletions(-)
45
46 --- a/drivers/dma/fsl-edma-v3.c
47 +++ b/drivers/dma/fsl-edma-v3.c
48 @@ -692,7 +692,7 @@ static irqreturn_t fsl_edma3_tx_handler(
49
50 /* Ignore this interrupt since channel has been disabled already */
51 if (!fsl_chan->edesc)
52 - return IRQ_HANDLED;
53 + goto irq_handled;
54
55 if (!fsl_chan->edesc->iscyclic) {
56 fsl_edma3_get_realcnt(fsl_chan);
57 @@ -706,7 +706,7 @@ static irqreturn_t fsl_edma3_tx_handler(
58
59 if (!fsl_chan->edesc)
60 fsl_edma3_xfer_desc(fsl_chan);
61 -
62 +irq_handled:
63 spin_unlock(&fsl_chan->vchan.lock);
64
65 return IRQ_HANDLED;