From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56842C433B4 for ; Wed, 28 Apr 2021 10:20:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3A3876142C for ; Wed, 28 Apr 2021 10:20:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A3876142C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=csgroup.eu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BAF0D6B006E; Wed, 28 Apr 2021 06:20:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B851E6B0070; Wed, 28 Apr 2021 06:20:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A27B86B0071; Wed, 28 Apr 2021 06:20:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0220.hostedemail.com [216.40.44.220]) by kanga.kvack.org (Postfix) with ESMTP id 89C2A6B006E for ; Wed, 28 Apr 2021 06:20:53 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 48C1840DD for ; Wed, 28 Apr 2021 10:20:53 +0000 (UTC) X-FDA: 78081382386.13.3A36F87 Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by imf15.hostedemail.com (Postfix) with ESMTP id C5874A0009CA for ; Wed, 28 Apr 2021 10:20:48 +0000 (UTC) Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4FVZQq457Cz9tT1; Wed, 28 Apr 2021 12:20:51 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lI0TKj8XhRxZ; Wed, 28 Apr 2021 12:20:51 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4FVX2T0p7Cz9w8C; Wed, 28 Apr 2021 10:33:05 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id ABB708B800; Wed, 28 Apr 2021 10:33:04 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id ul-3gbgTjQKo; Wed, 28 Apr 2021 10:33:04 +0200 (CEST) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 857FE8B799; Wed, 28 Apr 2021 10:33:03 +0200 (CEST) Subject: Re: [PATCH v13 06/14] mm: HUGE_VMAP arch support cleanup To: Nicholas Piggin , linux-mm@kvack.org, Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Jonathan Cameron , Christoph Hellwig , Rick Edgecombe , Ding Tianhong , linuxppc-dev@lists.ozlabs.org, Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" References: <20210317062402.533919-1-npiggin@gmail.com> <20210317062402.533919-7-npiggin@gmail.com> From: Christophe Leroy Message-ID: <303a93df-6b32-1b3e-d293-b569e1a4b03e@csgroup.eu> Date: Wed, 28 Apr 2021 10:32:58 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <20210317062402.533919-7-npiggin@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr X-Stat-Signature: h59scpzto51y45s1hddsw7iifb8ga5o3 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: C5874A0009CA Received-SPF: none (csgroup.eu>: No applicable sender policy available) receiver=imf15; identity=mailfrom; envelope-from=""; helo=pegase1.c-s.fr; client-ip=93.17.236.30 X-HE-DKIM-Result: none/none X-HE-Tag: 1619605248-181244 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Le 17/03/2021 =C3=A0 07:23, Nicholas Piggin a =C3=A9crit=C2=A0: > This changes the awkward approach where architectures provide init > functions to determine which levels they can provide large mappings for= , > to one where the arch is queried for each call. >=20 > This removes code and indirection, and allows constant-folding of dead > code for unsupported levels. >=20 > This also adds a prot argument to the arch query. This is unused > currently but could help with some architectures (e.g., some powerpc > processors can't map uncacheable memory with large pages). >=20 > Cc: linuxppc-dev@lists.ozlabs.org > Cc: Catalin Marinas > Cc: Will Deacon > Cc: linux-arm-kernel@lists.infradead.org > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Borislav Petkov > Cc: x86@kernel.org > Cc: "H. Peter Anvin" > Reviewed-by: Ding Tianhong > Acked-by: Catalin Marinas [arm64] > Signed-off-by: Nicholas Piggin > --- > arch/arm64/include/asm/vmalloc.h | 8 ++ > arch/arm64/mm/mmu.c | 10 +-- > arch/powerpc/include/asm/vmalloc.h | 8 ++ > arch/powerpc/mm/book3s64/radix_pgtable.c | 8 +- > arch/x86/include/asm/vmalloc.h | 7 ++ > arch/x86/mm/ioremap.c | 12 +-- > include/linux/io.h | 9 --- > include/linux/vmalloc.h | 6 ++ > init/main.c | 1 - > mm/debug_vm_pgtable.c | 4 +- > mm/ioremap.c | 94 ++++++++++-------------= - > 11 files changed, 87 insertions(+), 80 deletions(-) >=20 > diff --git a/mm/ioremap.c b/mm/ioremap.c > index 3f4d36f9745a..3264d0203785 100644 > --- a/mm/ioremap.c > +++ b/mm/ioremap.c > @@ -16,49 +16,16 @@ > #include "pgalloc-track.h" > =20 > #ifdef CONFIG_HAVE_ARCH_HUGE_VMAP > -static int __read_mostly ioremap_p4d_capable; > -static int __read_mostly ioremap_pud_capable; > -static int __read_mostly ioremap_pmd_capable; > -static int __read_mostly ioremap_huge_disabled; > +static bool __ro_after_init iomap_max_page_shift =3D PAGE_SHIFT; Must be an int, not a bool. > =20 > static int __init set_nohugeiomap(char *str) > { > - ioremap_huge_disabled =3D 1; > + iomap_max_page_shift =3D P4D_SHIFT; > return 0; > } > early_param("nohugeiomap", set_nohugeiomap); > - > -void __init ioremap_huge_init(void) > -{ > - if (!ioremap_huge_disabled) { > - if (arch_ioremap_p4d_supported()) > - ioremap_p4d_capable =3D 1; > - if (arch_ioremap_pud_supported()) > - ioremap_pud_capable =3D 1; > - if (arch_ioremap_pmd_supported()) > - ioremap_pmd_capable =3D 1; > - } > -} > - > -static inline int ioremap_p4d_enabled(void) > -{ > - return ioremap_p4d_capable; > -} > - > -static inline int ioremap_pud_enabled(void) > -{ > - return ioremap_pud_capable; > -} > - > -static inline int ioremap_pmd_enabled(void) > -{ > - return ioremap_pmd_capable; > -} > - > -#else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */ > -static inline int ioremap_p4d_enabled(void) { return 0; } > -static inline int ioremap_pud_enabled(void) { return 0; } > -static inline int ioremap_pmd_enabled(void) { return 0; } > +#else /* CONFIG_HAVE_ARCH_HUGE_VMAP */ > +static const bool iomap_max_page_shift =3D PAGE_SHIFT; > #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */ > =20 > static int vmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned lo= ng end, Christophe