From patchwork Mon Feb 26 10:57:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 10242039 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 85EBA60211 for ; Mon, 26 Feb 2018 10:58:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78FFE28AA8 for ; Mon, 26 Feb 2018 10:58:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6DCA629F42; Mon, 26 Feb 2018 10:58:35 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham 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 DD2CD28AA8 for ; Mon, 26 Feb 2018 10:58:34 +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:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gYI42H9jS75I/d2BfIQIgaFIfVP282wgY+VzkOYbltw=; b=sDN+ilpdjJJcAt 8o5kQzYQ4ClZS9mYqxKHdQB9UjRNVdLH+Bb1ar38cS64lfsMTb9qlRp/lQn0EZ7XlpdKblWvMPSca Bj1bX0pOxb6NPptW2mEVn4u31cPoscGKJR8w9AVGyRWiVsijXk+V/lLImIjRCfqAbaUKljrOp+3KG LqPuhIivozaePr++i3wB/KwFo2um6q20h02YWK37Cq2Lsy6CRuemd47q/7irbmgNHTQkceS8krEIb fwd/ETKFeol+5dhfCHV6a2i32YjBzmUDelq+Bq4PLtd+t7GXMC8yk9v8rW36nGuFoTKjFyn3nQp/M v7kNXeBJE9YAYcP1wE2Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eqGU6-0001pL-3u; Mon, 26 Feb 2018 10:58:18 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eqGU2-0001nH-BB for linux-arm-kernel@lists.infradead.org; Mon, 26 Feb 2018 10:58:16 +0000 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 31E80455D0913; Mon, 26 Feb 2018 18:57:44 +0800 (CST) Received: from [127.0.0.1] (10.177.223.23) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.361.1; Mon, 26 Feb 2018 18:57:35 +0800 Subject: =?UTF-8?Q?Re:_=e7=ad=94=e5=a4=8d:_[RFC_patch]_ioremap:_don't_set_up?= =?UTF-8?Q?_huge_I/O_mappings_when_p4d/pud/pmd_is_zero?= To: Will Deacon , "Wangxuefeng (E)" References: <1514460261-65222-1-git-send-email-guohanjun@huawei.com> <861128ce-966f-7006-45ba-6a7298918686@codeaurora.org> <1519175992.16384.121.camel@hpe.com> <20180221115758.GA7614@arm.com> From: Hanjun Guo Message-ID: <32c9b1c3-086b-ba54-f9e9-aefa50066730@huawei.com> Date: Mon, 26 Feb 2018 18:57:20 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180221115758.GA7614@arm.com> Content-Language: en-US X-Originating-IP: [10.177.223.23] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180226_025814_640540_8850C763 X-CRM114-Status: GOOD ( 11.82 ) 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: "mark.rutland" , mhocko , "toshi.kani" , "catalin.marinas" , linux-kernel , Linuxarm , linux-mm , "hanjun.guo" , cpandya , akpm , linux-arm-kernel 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 On 2018/2/21 19:57, Will Deacon wrote: > [sorry, trying to deal with top-posting here] > > On Wed, Feb 21, 2018 at 07:36:34AM +0000, Wangxuefeng (E) wrote: >> The old flow of reuse the 4k page as 2M page does not follow the BBM flow >> for page table reconstruction,not only the memory leak problems. If BBM flow >> is not followed,the speculative prefetch of tlb will made false tlb entries >> cached in MMU, the false address will be got, panic will happen. > > If I understand Toshi's suggestion correctly, he's saying that the PMD can > be cleared when unmapping the last PTE (like try_to_free_pte_page). In this > case, there's no issue with the TLB because this is exactly BBM -- the PMD > is cleared and TLB invalidation is issued before the PTE table is freed. A > subsequent 2M map request will see an empty PMD and put down a block > mapping. > > The downside is that freeing becomes more expensive as the last level table > becomes more sparsely populated and you need to ensure you don't have any > concurrent maps going on for the same table when you're unmapping. I also > can't see a neat way to fit this into the current vunmap code. Perhaps we > need an iounmap_page_range. > > In the meantime, the code in lib/ioremap.c looks totally broken so I think > we should deselect CONFIG_HAVE_ARCH_HUGE_VMAP on arm64 until it's fixed. Simply do something below at now (before the broken code is fixed)? Thanks Hanjun diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index b2b95f7..a86148c 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -84,7 +84,6 @@ config ARM64 select HAVE_ALIGNED_STRUCT_PAGE if SLUB select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_BITREVERSE - select HAVE_ARCH_HUGE_VMAP select HAVE_ARCH_JUMP_LABEL select HAVE_ARCH_KASAN if !(ARM64_16K_PAGES && ARM64_VA_BITS_48) select HAVE_ARCH_KGDB