From patchwork Wed Nov 16 09:20:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9431161 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 2F08160471 for ; Wed, 16 Nov 2016 09:23:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15D4328EBE for ; Wed, 16 Nov 2016 09:23:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05BDE28EC2; Wed, 16 Nov 2016 09:23:01 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6377F28EBE for ; Wed, 16 Nov 2016 09:23:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c6wOl-0003Qn-MQ; Wed, 16 Nov 2016 09:20:55 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c6wOg-000398-Tt for linux-arm-kernel@lists.infradead.org; Wed, 16 Nov 2016 09:20:52 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OGQ00D299Y2LR00@mailout1.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 16 Nov 2016 09:20:26 +0000 (GMT) Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20161116092026eucas1p1343a8c7a4794e63ab980b1748e7025b8~HfJ9QC66G1512015120eucas1p1h; Wed, 16 Nov 2016 09:20:26 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges4.samsung.com (EUCPMTA) with SMTP id 37.07.28332.9D42C285; Wed, 16 Nov 2016 09:20:26 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20161116092025eucas1p2ebaf3ead7de79130ca2656d532284e5b~HfJ8otS8o1796217962eucas1p2R; Wed, 16 Nov 2016 09:20:25 +0000 (GMT) X-AuditID: cbfec7f4-f791c6d000006eac-92-582c24d968bd Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 22.9C.07726.FD42C285; Wed, 16 Nov 2016 09:20:31 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OGQ00HAA9XYQM30@eusync2.samsung.com>; Wed, 16 Nov 2016 09:20:25 +0000 (GMT) From: Marek Szyprowski To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM64: dma-mapping: preallocate DMA-debug hash tables in core_initcall Date: Wed, 16 Nov 2016 10:20:13 +0100 Message-id: <1479288013-30945-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrLIsWRmVeSWpSXmKPExsWy7djP87q3VHQiDPY3MVtsnLGe1eL9sh5G i02Pr7FarD1yl91ixuSXbBYvP55gcWDzWDNvDaPH5iX1Hn1bVjEGMEdx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D1mByliFnjIKPFp/jKwhLBApMT23gusIDaLgKrEpc4FQEUcHLwC HhL3j+RAbJOTOHlsMusERu4FjAyrGEVSS4tz03OLDfWKE3OLS/PS9ZLzczcxAsNv27Gfm3cw XtoYfIhRgINRiYd3gbp2hBBrYllxZe4hRgkOZiUR3uuCOhFCvCmJlVWpRfnxRaU5qcWHGE2B dk9klhJNzgfGRl5JvKGJobmloZGxhYW5kZGSOG/JhyvhQgLpiSWp2ampBalFMH1MHJxSDYwL /G9/tTap7iny6NRRXMM1R6j6gf56h9TTKiYKG77OXRlW63tmnYbc0pvVn03Ld0VpZBit1Jfy LopuFhfNehbWdfmGlqf8ZKv/DjZcvVUF201frXiqFHA1rsLrB99zl6YVPvk9+l7CwvsvVxof nV3zj1EjJYBx16x5O3LC5kWqlpz193t4XImlOCPRUIu5qDgRAKOTjWVVAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20161116092025eucas1p2ebaf3ead7de79130ca2656d532284e5b X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRs=?= =?UTF-8?B?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRtT?= =?UTF-8?B?YW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20161116092025eucas1p2ebaf3ead7de79130ca2656d532284e5b X-RootMTR: 20161116092025eucas1p2ebaf3ead7de79130ca2656d532284e5b References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161116_012051_210225_0A17E33F X-CRM114-Status: GOOD ( 14.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Catalin Marinas , Bartlomiej Zolnierkiewicz , Will Deacon , Seung-Woo Kim , Marek Szyprowski MIME-Version: 1.0 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 fs_initcall is definitely too late to initialize DMA-debug hash tables, because some drivers might get probed and use DMA mapping framework already in core_initcall. Late initialization of DMA-debug results in false warning about accessing memory, that was not allocated. This issue has been observed on ARM 32bit, but the same driver can be used also on ARM64. This patch moves initialization of DMA-debug to core_initcall. This is safe from the initialization perspective. dma_debug_do_init() internally calls debugfs functions and debugfs also gets initialised at core_initcall(), and that is earlier than arch code in the link order, so it will get initialized just before the DMA-debug. Reported-by: Seung-Woo Kim Signed-off-by: Marek Szyprowski Acked-by: Robin Murphy --- For more details on this issue, see the patch for ARM 32bit arch: https://www.spinics.net/lists/arm-kernel/msg542721.html https://www.spinics.net/lists/arm-kernel/msg542782.html --- arch/arm64/mm/dma-mapping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index 3f74d0d..8653426 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c @@ -538,7 +538,7 @@ static int __init dma_debug_do_init(void) dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES); return 0; } -fs_initcall(dma_debug_do_init); +core_initcall(dma_debug_do_init); #ifdef CONFIG_IOMMU_DMA