From patchwork Mon Oct 29 09:59:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 1662681 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 329393FDDA for ; Mon, 29 Oct 2012 10:02:50 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TSm9R-0004bA-Nw; Mon, 29 Oct 2012 10:00:57 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TSm96-0004TJ-Uz for linux-arm-kernel@lists.infradead.org; Mon, 29 Oct 2012 10:00:39 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MCN00MJVFRCRUN0@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 29 Oct 2012 19:00:30 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-13-508e53beca57 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 1E.8C.01231.EB35E805; Mon, 29 Oct 2012 19:00:30 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MCN00FROFS3UC00@mmp2.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 29 Oct 2012 19:00:30 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 1/4] DMA: PL330: fix locking in pl330_free_chan_resources() Date: Mon, 29 Oct 2012 10:59:53 +0100 Message-id: <1351504796-24788-2-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1351504796-24788-1-git-send-email-b.zolnierkie@samsung.com> References: <1351504796-24788-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPJMWRmVeSWpSXmKPExsVy+t9jQd19wX0BBt+fcltsenyN1YHRY/OS +gDGKC6blNSczLLUIn27BK6M/Xt5C3bKVPw++JitgXGGZBcjB4eEgInEgqs+XYycQKaYxIV7 69m6GLk4hASmM0pcmLaNEaRGSGAzk8QlQ5AaNgEriYntqxhBbBGBbIkf3yazgNQzCyxkkni1 5yw7SEJYwFti5fZjYDaLgKrEg5YuNhCbV8BD4uaEM6wQy+Qlnt7vA4tzCnhKnJ64ihnEFgKq +fdpP/sERt4FjAyrGEVTC5ILipPScw31ihNzi0vz0vWS83M3MYK9/UxqB+PKBotDjAIcjEo8 vI1vegOEWBPLiitzDzFKcDArifAu5QYK8aYkVlalFuXHF5XmpBYfYpTmYFES5232SAkQEkhP LEnNTk0tSC2CyTJxcEo1MBp/nf9SRm3l7IVBRtZTHsdee9IbcJ4rIPvYmcYT6Q3WDtU3/O9F O+98oL41dRH/UXZO24OmAvPPdAgUWy34OMly6n9GwbWPfBJs9v3aM3FibZNWZOa6yFW6VYEP 2Dk5t1foPExKthPXXbDGjJdhzWyddy1bt6lsP/X4fY9yvOGGfPPtgtqbVimxFGckGmoxFxUn AgAZwy2p8gEAAA== X-Spam-Note: CRM114 invocation failed X-Spam-Score: -4.6 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.24 listed in list.dnswl.org] 3.0 KHOP_BIG_TO_CC Sent to 10+ recipients instaed of Bcc or a list -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Vinod Koul , kgene.kim@samsung.com, pawel.moll@arm.com, Bartlomiej Zolnierkiewicz , vinod.koul@intel.com, t.figa@samsung.com, jassisinghbrar@gmail.com, rob.herring@calxeda.com, kyungmin.park@samsung.com, dinguyen@altera.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org tasklet_kill() may sleep so call it before taking pch->lock. Fixes following lockup: [ 345.470000] BUG: scheduling while atomic: cat/2383/0x00000002 [ 345.470000] Modules linked in: [ 345.470000] [] (unwind_backtrace+0x0/0xfc) from [] (__schedule_bug+0x4c/0x58) [ 345.470000] [] (__schedule_bug+0x4c/0x58) from [] (__schedule+0x690/0x6e0) [ 345.470000] [] (__schedule+0x690/0x6e0) from [] (sys_sched_yield+0x70/0x78) [ 345.470000] [] (sys_sched_yield+0x70/0x78) from [] (tasklet_kill+0x34/0x8c) [ 345.470000] [] (tasklet_kill+0x34/0x8c) from [] (pl330_free_chan_resources+0x24/0x88) [ 345.470000] [] (pl330_free_chan_resources+0x24/0x88) from [] (dma_chan_put+0x4c/0x50) [ 345.470000] [] (dma_chan_put+0x4c/0x50) from [] (dma_release_channel+0x28/0x98) [...] [ 368.335000] BUG: spinlock lockup suspected on CPU#0, swapper/0/0 [ 368.340000] lock: 0xe52aa04c, .magic: dead4ead, .owner: cat/2383, .owner_cpu: 1 [ 368.350000] [] (unwind_backtrace+0x0/0xfc) from [] (do_raw_spin_lock+0x194/0x204) [ 368.360000] [] (do_raw_spin_lock+0x194/0x204) from [] (_raw_spin_lock_irqsave+0x20/0x28) [ 368.365000] [] (_raw_spin_lock_irqsave+0x20/0x28) from [] (pl330_tasklet+0x2c/0x5a8) [ 368.375000] [] (pl330_tasklet+0x2c/0x5a8) from [] (tasklet_action+0xfc/0x114) [ 368.385000] [] (tasklet_action+0xfc/0x114) from [] (__do_softirq+0xe4/0x19c) [ 368.395000] [] (__do_softirq+0xe4/0x19c) from [] (irq_exit+0x98/0x9c) [ 368.405000] [] (irq_exit+0x98/0x9c) from [] (handle_IPI+0x124/0x16c) [ 368.410000] [] (handle_IPI+0x124/0x16c) from [] (gic_handle_irq+0x64/0x68) [ 368.420000] [] (gic_handle_irq+0x64/0x68) from [] (__irq_svc+0x40/0x70) [ 368.430000] Exception stack(0xc04a3f00 to 0xc04a3f48) [ 368.435000] 3f00: c04a3f48 00000000 6f9e23e8 00000050 c07492c8 c04a3f48 00000000 c04ccc88 [ 368.440000] 3f20: 6f9dbac3 00000050 6f9e23e8 00000050 3b9aca00 c04a3f48 c005cfa4 c02946d4 [ 368.450000] 3f40: 60000013 ffffffff [ 368.455000] [] (__irq_svc+0x40/0x70) from [] (cpuidle_wrap_enter+0x4c/0xa0) [ 368.460000] [] (cpuidle_wrap_enter+0x4c/0xa0) from [] (cpuidle_enter_state+0x18/0x68) [ 368.470000] [] (cpuidle_enter_state+0x18/0x68) from [] (cpuidle_idle_call+0xac/0xe0) [ 368.480000] [] (cpuidle_idle_call+0xac/0xe0) from [] (cpu_idle+0xac/0xf0) [ 368.490000] [] (cpu_idle+0xac/0xf0) from [] (start_kernel+0x28c/0x294) Cc: Jassi Brar Cc: Vinod Koul Cc: Tomasz Figa Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Kyungmin Park Acked-by: Jassi Brar --- drivers/dma/pl330.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 665668b..db7574b 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -2459,10 +2459,10 @@ static void pl330_free_chan_resources(struct dma_chan *chan) struct dma_pl330_chan *pch = to_pchan(chan); unsigned long flags; - spin_lock_irqsave(&pch->lock, flags); - tasklet_kill(&pch->task); + spin_lock_irqsave(&pch->lock, flags); + pl330_release_channel(pch->pl330_chid); pch->pl330_chid = NULL;