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: 82464 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp50088qge; Wed, 16 Nov 2016 01:22:32 -0800 (PST) X-Received: by 10.99.99.195 with SMTP id x186mr6223060pgb.100.1479288152219; Wed, 16 Nov 2016 01:22:32 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id a65si30982842pfb.18.2016.11.16.01.22.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Nov 2016 01:22:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org 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 i02Pr7FarD1yl91ixuSXbBYvP55gcWDzWDNvDaPH5iX1Hn1bVjEGMEdx2aSk5mSWpRbp2yVw ZdzZ0cZe8Iq7omftZeYGxk6uLkZODgkBE4k3O16yQNhiEhfurWfrYuTiEBJ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EVSS4tz03OLDfWKE3OLS/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-Spam-Score: -8.3 (--------) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-8.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [210.118.77.11 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [210.118.77.11 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.4 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] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 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+patch=linaro.org@lists.infradead.org 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 --- 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(-) -- 1.9.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel Acked-by: Robin Murphy 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