From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755390Ab3LRRdF (ORCPT ); Wed, 18 Dec 2013 12:33:05 -0500 Received: from mga01.intel.com ([192.55.52.88]:5856 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753242Ab3LRRdB (ORCPT ); Wed, 18 Dec 2013 12:33:01 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,508,1384329600"; d="scan'208";a="452117158" Date: Wed, 18 Dec 2013 22:01:01 +0530 From: Vinod Koul To: Will Deacon Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Andriy Shevchenko , Dan Williams Subject: Re: [PATCH v2] dma: pl330: ensure DMA descriptors are zero-initialised Message-ID: <20131218163101.GN16227@intel.com> References: <1386007290-13987-1-git-send-email-will.deacon@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1386007290-13987-1-git-send-email-will.deacon@arm.com> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 02, 2013 at 06:01:30PM +0000, Will Deacon wrote: > I see the following splat with 3.13-rc1 when attempting to perform DMA: > > [ 253.004516] Alignment trap: not handling instruction e1902f9f at [] > [ 253.004583] Unhandled fault: alignment exception (0x221) at 0xdfdfdfd7 > [ 253.004646] Internal error: : 221 [#1] PREEMPT SMP ARM > [ 253.004691] Modules linked in: dmatest(+) [last unloaded: dmatest] > [ 253.004798] CPU: 0 PID: 671 Comm: kthreadd Not tainted 3.13.0-rc1+ #2 > [ 253.004864] task: df9b0900 ti: df03e000 task.ti: df03e000 > [ 253.004937] PC is at dmaengine_unmap_put+0x14/0x34 > [ 253.005010] LR is at pl330_tasklet+0x3c8/0x550 > [ 253.005087] pc : [] lr : [] psr: a00e0193 > [ 253.005087] sp : df03fe48 ip : 00000000 fp : df03bf18 > [ 253.005178] r10: bf00e108 r9 : 00000001 r8 : 00000000 > [ 253.005245] r7 : df837040 r6 : dfb41800 r5 : df837048 r4 : df837000 > [ 253.005316] r3 : dfdfdfcf r2 : dfb41f80 r1 : df837048 r0 : dfdfdfd7 > [ 253.005384] Flags: NzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel > [ 253.005459] Control: 30c5387d Table: 9fb9ba80 DAC: fffffffd > [ 253.005520] Process kthreadd (pid: 671, stack limit = 0xdf03e248) > > This is due to desc->txd.unmap containing garbage (uninitialised memory). > > Rather than add another dummy initialisation to _init_desc, instead > ensure that the descriptors are zero-initialised during allocation and > remove the dummy, per-field initialisation. > > Cc: Andriy Shevchenko > Cc: Vinod Koul > Cc: Dan Williams > Acked-by: Jassi Brar > Signed-off-by: Will Deacon Acked-by: Vinod Koul -- ~Vinod > --- > drivers/dma/pl330.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c > index 98641eaca080..769f865b71db 100644 > --- a/drivers/dma/pl330.c > +++ b/drivers/dma/pl330.c > @@ -2492,12 +2492,9 @@ static dma_cookie_t pl330_tx_submit(struct dma_async_tx_descriptor *tx) > > static inline void _init_desc(struct dma_pl330_desc *desc) > { > - desc->pchan = NULL; > desc->req.x = &desc->px; > desc->req.token = desc; > desc->rqcfg.swap = SWAP_NO; > - desc->rqcfg.privileged = 0; > - desc->rqcfg.insnaccess = 0; > desc->rqcfg.scctl = SCCTRL0; > desc->rqcfg.dcctl = DCCTRL0; > desc->req.cfg = &desc->rqcfg; > @@ -2517,7 +2514,7 @@ static int add_desc(struct dma_pl330_dmac *pdmac, gfp_t flg, int count) > if (!pdmac) > return 0; > > - desc = kmalloc(count * sizeof(*desc), flg); > + desc = kcalloc(count, sizeof(*desc), flg); > if (!desc) > return 0; > > -- > 1.8.2.2 > --