From patchwork Tue Jun 19 16:57:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Gong X-Patchwork-Id: 10473979 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B4B096029B for ; Tue, 19 Jun 2018 10:06:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2900289F6 for ; Tue, 19 Jun 2018 10:06:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A408B28A43; Tue, 19 Jun 2018 10:06:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DATE_IN_FUTURE_06_12,DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 33DE9289F6 for ; Tue, 19 Jun 2018 10:06:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XwbKlSoWBs6gPPNfXYWFuyO2GjI/MX2G7jL578O6KFw=; b=OE8FFSjUtqet90 DY8TljSFFwdie7ELk3ptv1M5p2HefRl59SrIXJCoirTQohV1GyCjNLgeILuLgxlwRGgjl+CmgxGS9 D+He0coV7jjA1DfQtBWpqh0Qqo3auIjBoviI2AVhMBPie9q9q4DyxguZNxHPmtaO3HodzLD+jb42n 9PU/czCT6zqOvBlPLsCR9LMeS5o9hzs7itynvvgeI6cxXDBTUe7f75GIS9seA+TQFgRCjqyHLP2ar 6ydNMud99BZj5k8J/x11r4SgUcYTjj0bGB4pXWKP14tNNCTppQk2QpJYEDrUzcgcTsidIecvfVZh7 4Da5E9QMi5vEAl83fJqg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVDWc-0003sd-3D; Tue, 19 Jun 2018 10:06:10 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVDVw-0003Qu-7H for linux-arm-kernel@bombadil.infradead.org; Tue, 19 Jun 2018 10:05:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=PpbCtIlhOduohHM0lr5Cs/2jY4uvyDpyo/o6FLvHZwM=; b=GLa4qNiiPPKkPezbRsGMXlxSZ RGUw02XzYQsYQ4gZ5Qu7kd3wcijUVQScmtd9ODtGlJWZV8fc07OwvWfq6IqWNr+Q9ngY7vVpOlN+v cDhe3+NzrP+tHLge5lb+7WqAlNkefeYa5IqUXIYDpXpl5FsKf32QXV2nh9dJ2AhwQT3ncjpciLi3T zjeLOKXj+NoLM7e2SgyhtjNBnJVBgbH3JryxiabX1YvDdmYDTLkfpVla1r+3uygz5aarsTOqQ54+Y kH1rznvwO7SbE6IpYwjB1R5PmqJNSf2p48p0IU9yVTFV3/izT5Zj0vCegThDnd82MNq4R24XdBBqU enPjRimFw==; Received: from mail-he1eur01on0082.outbound.protection.outlook.com ([104.47.0.82] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVCUD-0006YT-NI for linux-arm-kernel@lists.infradead.org; Tue, 19 Jun 2018 08:59:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PpbCtIlhOduohHM0lr5Cs/2jY4uvyDpyo/o6FLvHZwM=; b=Y9JWOhcTArxeMw6xiluD8XBVqcF9RKpwaxo6dLpC6Jn/cY7eFw3zsaQDzyiJTu0SsbN1Rf1Mj/GppTcOrfmEPzuyufx1nZH35YwM+TgtUXHcb+pG8DBDNme3szTeDn4XsRHHwhiB/cU7yjhqsf0WH2fM4KU8HhfpLooHTcQc2Ao= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yibin.gong@nxp.com; Received: from robin-OptiPlex-790.ap.freescale.net (119.31.174.66) by VI1PR04MB3231.eurprd04.prod.outlook.com (2603:10a6:802:6::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.19; Tue, 19 Jun 2018 08:58:16 +0000 From: Robin Gong To: vkoul@kernel.org, s.hauer@pengutronix.de, l.stach@pengutronix.de, dan.j.williams@intel.com, gregkh@linuxfoundation.org, jslaby@suse.com Subject: [PATCH v5 7/7] dmaengine: imx-sdma: alloclate bd memory from dma pool Date: Wed, 20 Jun 2018 00:57:04 +0800 Message-Id: <1529427424-12321-8-git-send-email-yibin.gong@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529427424-12321-1-git-send-email-yibin.gong@nxp.com> References: <1529427424-12321-1-git-send-email-yibin.gong@nxp.com> MIME-Version: 1.0 X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: HK0PR03CA0073.apcprd03.prod.outlook.com (2603:1096:203:72::13) To VI1PR04MB3231.eurprd04.prod.outlook.com (2603:10a6:802:6::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c7783f25-4c9a-4f5b-af53-08d5d5c2ce21 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(711020)(48565401081)(2017052603328)(7153060)(7193020); SRVR:VI1PR04MB3231; X-Microsoft-Exchange-Diagnostics: 1; VI1PR04MB3231; 3:flmssNHmeVTTv/1XHQzCTvso2ZTxBPsFX9ZXeAbq6tBmtPZjlCEhK0skIxQUDQTUj5vZu0IvVA7ZiIndLi1GVLMDOM62s06FPDk6RKTKYUPYsQ722t0QV5HL/JWvJgmFKVmNITIlEdmCzHMwJrXKtc834zHSjlcSIbx9aTuLlNIZQwda+noXCWXEjZI776a5iElmAWunATy+Avh2Sj57L8Z6ZSFtThR/0cf0g3I7U4QwH8C12dQLE0wOgynMcN9L; 25:/6+YjmK2ctI/LrKfXRmEHqoBxkYjTX0+bph/vqAuxnGcZQbbI7by3elwWSwZOPLi0DLbakcPwVNRXafIMCD0Kt6vrUFa1wA9E5gFVE8UFkT0Xjmm7qRVBN2hNg9HEPZZ7MCeyvyGHPU7saxMrMdRiJ+36AXVvM1t6R5XBpkBrVrgBR8QzljmpDuxcr+pOQTRrvCOsrEPLurU2Y220/vQGSp2JPF/1ymwnycyhJ+PyBGbPR3YdwHhfkc/pQPr95k4i1IW+c1AEcjWLQzZmTp03aymbFPq2+urKWqEqQi5TBxBdnTsiiyxCvkq7ZpbQ9zn5sqW2pKkvpGSAK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/B4kWFoKwRTruyRoN4XA3wdnfm3BavmT3CMAOaNB2yFLsEHsiVLQhf4U5KGemOIMls4et2NNh5ofD X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3231254)(944501410)(52105095)(3002001)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:VI1PR04MB3231; BCL:0; PCL:0; RULEID:; SRVR:VI1PR04MB3231; X-Forefront-PRVS: 07083FF734 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(39380400002)(346002)(376002)(396003)(366004)(199004)(189003)(53936002)(6512007)(5660300001)(478600001)(386003)(6506007)(59450400001)(26005)(52116002)(4326008)(25786009)(97736004)(51416003)(45080400002)(76176011)(68736007)(47776003)(86362001)(66066001)(575784001)(7416002)(6666003)(105586002)(36756003)(50466002)(6486002)(48376002)(106356001)(316002)(11346002)(446003)(476003)(186003)(16526019)(2616005)(956004)(486006)(81156014)(8936002)(2906002)(3846002)(305945005)(6116002)(50226002)(7736002)(8676002)(16586007)(81166006); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB3231; H:robin-OptiPlex-790.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR04MB3231; 23:DR0imgYRqxkZzOBiEO3vuFnJ/UkJnX3kVQKLGKGq4?= =?us-ascii?Q?DmuFzmdGtcSBGD17MUHQ7UzGllda4lGkaqQU1ILZA4dpp005TY9xzqCuKEs/?= =?us-ascii?Q?qlmglw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mzR+Ubq9YivL6ybZrtublogL/nrOKgDS0V5dFl8lF44jjljEctr93t4N2bTcXJcXEPpVxo8tkCJq+MJ4ltK7uYfK90V3nJ3YrAAAAK7NO1SvmqpG224UGCmu0unk5W5EMnucly8lVXJhceQ==; 5:Ba2DOwzM6bdBvXNKMpyOeIZMU3EfGj2p8AeumEA7kYJJoSnnPveVFmjXLLEFC89Bxn+caSEKcYYhFwjQQzNvZ5RyG2FWqKHIZYpJmQVWRZcFc6lyKO6ptsNCua/QGCesaW5p4FprIJN6z0sVU12kY2JQhOfVrDM+Yaooa8bNd64=; 24:0foX4qLj5LngceU2v7nmdGPvHysHaI6zYg/nKf8zdlyCXi62a+mDVNgTEda4c8T71kgPAuLDozc3rnS7q3FHkHewW+NVmCU4Rr4eM/qBxrc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR04MB3231; 7:1qyl52bRlMcm4ByXcYGIMICypuYdWvi/sybg69Vka3J67Fc96oQ/SLX1JvMR9zpRsRfgOL/zLT/IpUEwmomm4NtSpnfCWeGg8xycFaLaRjU3Y4ftQTOAGNnlaY9w2jux+Lbbggn73UkrsGP7WjiW44L6zCM2QFrHYc1ssESoBIZ9ecwRAD6uszijpMElsM3LGcMPlTy1Cm4H6RTiCRMhyoX0DPjGKTMxujh4BW6Qd+iYdfNscFeColYklLzrm16J X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2018 08:58:16.7705 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c7783f25-4c9a-4f5b-af53-08d5d5c2ce21 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB3231 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180619_045937_816287_8E8AE987 X-CRM114-Status: GOOD ( 14.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dmaengine@vger.kernel.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP dma_terminate_all maybe called in interrupt context which means WARN_ON() will be triggered as below when bd memory freed. Allocat bd memory from dma pool instead. [ 29.161079] WARNING: CPU: 1 PID: 533 at ./include/linux/dma-mapping.h:541 sdma_free_bd+0xa4/0xb4 [ 29.169883] Modules linked in: [ 29.172990] CPU: 1 PID: 533 Comm: mpegaudioparse0 Not tainted 4.18.0-rc1-next-20180618-00009-gf79f22c #20 [ 29.182597] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) [ 29.189163] Backtrace: [ 29.191685] [] (dump_backtrace) from [] (show_stack+0x18/0x1c) [ 29.199306] r7:00000000 r6:600f0093 r5:00000000 r4:c107db7c [ 29.205029] [] (show_stack) from [] (dump_stack+0xb4/0xe8) [ 29.212312] [] (dump_stack) from [] (__warn+0x104/0x130) [ 29.219411] r9:ec3e817c r8:0000021d r7:00000009 r6:c0d1d440 r5:00000000 r4:00000000 [ 29.227204] [] (__warn) from [] (warn_slowpath_null+0x44/0x50) [ 29.234821] r8:ed129dc4 r7:c0b01978 r6:c04d4e90 r5:0000021d r4:c0d1d440 [ 29.241574] [] (warn_slowpath_null) from [] (sdma_free_bd+0xa4/0xb4) [ 29.249706] r6:4c001000 r5:f082e000 r4:00000024 [ 29.254376] [] (sdma_free_bd) from [] (sdma_desc_free+0x14/0x20) [ 29.262163] r7:ec3e8110 r6:00000100 r5:00000200 r4:ecf89a00 [ 29.267873] [] (sdma_desc_free) from [] (vchan_dma_desc_free_list+0xa4/0xac) [ 29.276697] r5:00000200 r4:ed129d9c [ 29.280326] [] (vchan_dma_desc_free_list) from [] (sdma_disable_channel_with_delay+0x14c/0x188) [ 29.290808] r9:ecae560c r8:ec3e815c r7:00000000 r6:c1008908 r5:ed129dc4 r4:ec3e8110 [ 29.298605] [] (sdma_disable_channel_with_delay) from [] (snd_dmaengine_pcm_trigger+0x90/0x1b0) [ 29.309087] r8:ecae5000 r7:ec940800 r6:ed31bd80 r5:ecadb200 r4:ec26a700 [ 29.315855] [] (snd_dmaengine_pcm_trigger) from [] (soc_pcm_trigger+0xb4/0x130) [ 29.324953] r8:ecae5000 r7:ec940800 r6:00000000 r5:ecadb200 r4:ec26a700 [ 29.331716] [] (soc_pcm_trigger) from [] (snd_pcm_do_stop+0x58/0x5c) [ 29.339859] r9:ecaed5a8 r8:ed31bdc0 r7:00000000 r6:00000001 r5:ecadb200 r4:c0b9c4d0 [ 29.347652] [] (snd_pcm_do_stop) from [] (snd_pcm_action_single+0x40/0x80) [ 29.356315] [] (snd_pcm_action_single) from [] (snd_pcm_action+0xf4/0xfc) [ 29.364883] r7:00000001 r6:c0b9c4d0 r5:ecadb2d4 r4:ecadb200 [ 29.370593] [] (snd_pcm_action) from [] (snd_pcm_drop+0x58/0x9c) Signed-off-by: Robin Gong --- drivers/dma/imx-sdma.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index f8becaf..7dab7e9 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -343,6 +344,7 @@ struct sdma_channel { u32 shp_addr, per_addr; enum dma_status status; struct imx_dma_data data; + struct dma_pool *bd_pool; }; #define IMX_DMA_SG_LOOP BIT(0) @@ -1153,11 +1155,10 @@ static int sdma_request_channel0(struct sdma_engine *sdma) static int sdma_alloc_bd(struct sdma_desc *desc) { - u32 bd_size = desc->num_bd * sizeof(struct sdma_buffer_descriptor); int ret = 0; - desc->bd = dma_zalloc_coherent(NULL, bd_size, &desc->bd_phys, - GFP_ATOMIC); + desc->bd = dma_pool_alloc(desc->sdmac->bd_pool, GFP_ATOMIC, + &desc->bd_phys); if (!desc->bd) { ret = -ENOMEM; goto out; @@ -1168,9 +1169,7 @@ static int sdma_alloc_bd(struct sdma_desc *desc) static void sdma_free_bd(struct sdma_desc *desc) { - u32 bd_size = desc->num_bd * sizeof(struct sdma_buffer_descriptor); - - dma_free_coherent(NULL, bd_size, desc->bd, desc->bd_phys); + dma_pool_free(desc->sdmac->bd_pool, desc->bd, desc->bd_phys); } static void sdma_desc_free(struct virt_dma_desc *vd) @@ -1218,6 +1217,10 @@ static int sdma_alloc_chan_resources(struct dma_chan *chan) if (ret) goto disable_clk_ahb; + sdmac->bd_pool = dma_pool_create("bd_pool", chan->device->dev, + sizeof(struct sdma_buffer_descriptor), + 32, 0); + return 0; disable_clk_ahb: @@ -1246,6 +1249,9 @@ static void sdma_free_chan_resources(struct dma_chan *chan) clk_disable(sdma->clk_ipg); clk_disable(sdma->clk_ahb); + + dma_pool_destroy(sdmac->bd_pool); + sdmac->bd_pool = NULL; } static struct sdma_desc *sdma_transfer_init(struct sdma_channel *sdmac,