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 DF77DC43461 for ; Fri, 9 Apr 2021 09:35:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4538961181 for ; Fri, 9 Apr 2021 09:35:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4538961181 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 AF4CE6B006C; Fri, 9 Apr 2021 05:35:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ACB9C6B006E; Fri, 9 Apr 2021 05:35:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 96DD56B0070; Fri, 9 Apr 2021 05:35:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0195.hostedemail.com [216.40.44.195]) by kanga.kvack.org (Postfix) with ESMTP id 7AEC76B006C for ; Fri, 9 Apr 2021 05:35:28 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 1B05D1846D332 for ; Fri, 9 Apr 2021 09:35:28 +0000 (UTC) X-FDA: 78012320736.28.1FA921E Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by imf25.hostedemail.com (Postfix) with ESMTP id B73FC600010B for ; Fri, 9 Apr 2021 09:35:25 +0000 (UTC) Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4FGtK85pZ8z9vBLl; Fri, 9 Apr 2021 11:35:24 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id uq813t82CATX; Fri, 9 Apr 2021 11:35:24 +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 4FGtK84CGyz9vBLh; Fri, 9 Apr 2021 11:35:24 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id BDAA48B7E1; Fri, 9 Apr 2021 11:35:25 +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 wpfiCXxm5IY3; Fri, 9 Apr 2021 11:35:25 +0200 (CEST) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id F0BF28B7DE; Fri, 9 Apr 2021 11:35:24 +0200 (CEST) Subject: Re: [PATCH v3 8/9] mm/mremap: Allow arch runtime override To: "Aneesh Kumar K.V" , linux-mm@kvack.org, akpm@linux-foundation.org Cc: kaleshsingh@google.com, npiggin@gmail.com, joel@joelfernandes.org, linuxppc-dev@lists.ozlabs.org References: <20210330060752.592769-1-aneesh.kumar@linux.ibm.com> <20210330060752.592769-9-aneesh.kumar@linux.ibm.com> From: Christophe Leroy Message-ID: Date: Fri, 9 Apr 2021 11:35:23 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <20210330060752.592769-9-aneesh.kumar@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: B73FC600010B X-Stat-Signature: 3zz45hsec1f1mkdwnnacsg8kjffs4dy5 Received-SPF: none (csgroup.eu>: No applicable sender policy available) receiver=imf25; identity=mailfrom; envelope-from=""; helo=pegase1.c-s.fr; client-ip=93.17.236.30 X-HE-DKIM-Result: none/none X-HE-Tag: 1617960925-780502 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 30/03/2021 =C3=A0 08:07, Aneesh Kumar K.V a =C3=A9crit=C2=A0: > Architectures like ppc64 can only support faster mremap only with radix ... only .... only ... > translation. Hence allow a runtime check w.r.t support for fast mremap. >=20 > Signed-off-by: Aneesh Kumar K.V > --- > arch/arc/include/asm/tlb.h | 5 +++++ > arch/arm64/include/asm/tlb.h | 6 ++++++ > arch/powerpc/include/asm/tlb.h | 6 ++++++ > arch/x86/include/asm/tlb.h | 5 +++++ > mm/mremap.c | 14 +++++++++++++- > 5 files changed, 35 insertions(+), 1 deletion(-) >=20 > diff --git a/arch/arc/include/asm/tlb.h b/arch/arc/include/asm/tlb.h > index 975b35d3738d..22b8cfb46cbf 100644 > --- a/arch/arc/include/asm/tlb.h > +++ b/arch/arc/include/asm/tlb.h > @@ -9,4 +9,9 @@ > #include > #include > =20 > +#define arch_supports_page_tables_move arch_supports_page_tables_move > +static inline bool arch_supports_page_tables_move(void) > +{ > + return true; > +} I can't see why ARC arch needs that. It neither selects CONFIG_HAVE_MOVE_= PMD nor CONFIG_HAVE_MOVE_PUD. > #endif /* _ASM_ARC_TLB_H */ > diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.= h > index 61c97d3b58c7..fe209efc6a10 100644 > --- a/arch/arm64/include/asm/tlb.h > +++ b/arch/arm64/include/asm/tlb.h > @@ -94,4 +94,10 @@ static inline void __pud_free_tlb(struct mmu_gather = *tlb, pud_t *pudp, > } > #endif > =20 > +#define arch_supports_page_tables_move arch_supports_page_tables_move > +static inline bool arch_supports_page_tables_move(void) > +{ > + return true; > +} > + > #endif > diff --git a/arch/powerpc/include/asm/tlb.h b/arch/powerpc/include/asm/= tlb.h > index 160422a439aa..058918a7cd3c 100644 > --- a/arch/powerpc/include/asm/tlb.h > +++ b/arch/powerpc/include/asm/tlb.h > @@ -83,5 +83,11 @@ static inline int mm_is_thread_local(struct mm_struc= t *mm) > } > #endif > =20 > +#define arch_supports_page_tables_move arch_supports_page_tables_move > +static inline bool arch_supports_page_tables_move(void) > +{ > + return radix_enabled(); > +} > + > #endif /* __KERNEL__ */ > #endif /* __ASM_POWERPC_TLB_H */ > diff --git a/arch/x86/include/asm/tlb.h b/arch/x86/include/asm/tlb.h > index 1bfe979bb9bc..62915238bb36 100644 > --- a/arch/x86/include/asm/tlb.h > +++ b/arch/x86/include/asm/tlb.h > @@ -37,4 +37,9 @@ static inline void __tlb_remove_table(void *table) > free_page_and_swap_cache(table); > } > =20 > +#define arch_supports_page_tables_move arch_supports_page_tables_move > +static inline bool arch_supports_page_tables_move(void) > +{ > + return true; > +} > #endif /* _ASM_X86_TLB_H */ > diff --git a/mm/mremap.c b/mm/mremap.c > index 7ac1df8e6d51..4d812af3e44b 100644 > --- a/mm/mremap.c > +++ b/mm/mremap.c > @@ -25,7 +25,7 @@ > #include > =20 > #include > -#include > +#include > #include > =20 > #include "internal.h" > @@ -221,6 +221,14 @@ static inline void flush_pte_tlb_pwc_range(struct = vm_area_struct *vma, > } > #endif > =20 > +#ifndef arch_supports_page_tables_move > +#define arch_supports_page_tables_move arch_supports_page_tables_move > +static inline bool arch_supports_page_tables_move(void) > +{ > + return false; Can you do return IS_ENABLED(CONFIG_HAVE_MOVE_PMD) || IS_ENABLED(CONFIG_HAVE_MOVE_P= UD); And then remove the arch_supports_page_tables_move() you have added for a= rc, arm64 and x86 ? > +} > +#endif > + > #ifdef CONFIG_HAVE_MOVE_PMD Next step could be remove that #ifdef and the content of the matching #el= se For that we'd just need a stub version of set_pmd_at() and set_pud_at(). > static bool move_normal_pmd(struct vm_area_struct *vma, unsigned long= old_addr, > unsigned long new_addr, pmd_t *old_pmd, pmd_t *new_pmd) > @@ -229,6 +237,8 @@ static bool move_normal_pmd(struct vm_area_struct *= vma, unsigned long old_addr, > struct mm_struct *mm =3D vma->vm_mm; > pmd_t pmd; > =20 > + if (!arch_supports_page_tables_move()) > + return false; > /* > * The destination pmd shouldn't be established, free_pgtables() > * should have released it. > @@ -295,6 +305,8 @@ static bool move_normal_pud(struct vm_area_struct *= vma, unsigned long old_addr, > struct mm_struct *mm =3D vma->vm_mm; > pud_t pud; > =20 > + if (!arch_supports_page_tables_move()) > + return false; > /* > * The destination pud shouldn't be established, free_pgtables() > * should have released it. >=20 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 64FABC43460 for ; Fri, 9 Apr 2021 09:35:55 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6B9B661108 for ; Fri, 9 Apr 2021 09:35:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6B9B661108 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=csgroup.eu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4FGtKh6lVBz3bV8 for ; Fri, 9 Apr 2021 19:35:52 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=csgroup.eu (client-ip=93.17.236.30; helo=pegase1.c-s.fr; envelope-from=christophe.leroy@csgroup.eu; receiver=) Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4FGtKJ528gz2yxl for ; Fri, 9 Apr 2021 19:35:29 +1000 (AEST) Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4FGtK85pZ8z9vBLl; Fri, 9 Apr 2021 11:35:24 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id uq813t82CATX; Fri, 9 Apr 2021 11:35:24 +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 4FGtK84CGyz9vBLh; Fri, 9 Apr 2021 11:35:24 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id BDAA48B7E1; Fri, 9 Apr 2021 11:35:25 +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 wpfiCXxm5IY3; Fri, 9 Apr 2021 11:35:25 +0200 (CEST) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id F0BF28B7DE; Fri, 9 Apr 2021 11:35:24 +0200 (CEST) Subject: Re: [PATCH v3 8/9] mm/mremap: Allow arch runtime override To: "Aneesh Kumar K.V" , linux-mm@kvack.org, akpm@linux-foundation.org References: <20210330060752.592769-1-aneesh.kumar@linux.ibm.com> <20210330060752.592769-9-aneesh.kumar@linux.ibm.com> From: Christophe Leroy Message-ID: Date: Fri, 9 Apr 2021 11:35:23 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <20210330060752.592769-9-aneesh.kumar@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: joel@joelfernandes.org, linuxppc-dev@lists.ozlabs.org, npiggin@gmail.com, kaleshsingh@google.com Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Le 30/03/2021 à 08:07, Aneesh Kumar K.V a écrit : > Architectures like ppc64 can only support faster mremap only with radix ... only .... only ... > translation. Hence allow a runtime check w.r.t support for fast mremap. > > Signed-off-by: Aneesh Kumar K.V > --- > arch/arc/include/asm/tlb.h | 5 +++++ > arch/arm64/include/asm/tlb.h | 6 ++++++ > arch/powerpc/include/asm/tlb.h | 6 ++++++ > arch/x86/include/asm/tlb.h | 5 +++++ > mm/mremap.c | 14 +++++++++++++- > 5 files changed, 35 insertions(+), 1 deletion(-) > > diff --git a/arch/arc/include/asm/tlb.h b/arch/arc/include/asm/tlb.h > index 975b35d3738d..22b8cfb46cbf 100644 > --- a/arch/arc/include/asm/tlb.h > +++ b/arch/arc/include/asm/tlb.h > @@ -9,4 +9,9 @@ > #include > #include > > +#define arch_supports_page_tables_move arch_supports_page_tables_move > +static inline bool arch_supports_page_tables_move(void) > +{ > + return true; > +} I can't see why ARC arch needs that. It neither selects CONFIG_HAVE_MOVE_PMD nor CONFIG_HAVE_MOVE_PUD. > #endif /* _ASM_ARC_TLB_H */ > diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h > index 61c97d3b58c7..fe209efc6a10 100644 > --- a/arch/arm64/include/asm/tlb.h > +++ b/arch/arm64/include/asm/tlb.h > @@ -94,4 +94,10 @@ static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pudp, > } > #endif > > +#define arch_supports_page_tables_move arch_supports_page_tables_move > +static inline bool arch_supports_page_tables_move(void) > +{ > + return true; > +} > + > #endif > diff --git a/arch/powerpc/include/asm/tlb.h b/arch/powerpc/include/asm/tlb.h > index 160422a439aa..058918a7cd3c 100644 > --- a/arch/powerpc/include/asm/tlb.h > +++ b/arch/powerpc/include/asm/tlb.h > @@ -83,5 +83,11 @@ static inline int mm_is_thread_local(struct mm_struct *mm) > } > #endif > > +#define arch_supports_page_tables_move arch_supports_page_tables_move > +static inline bool arch_supports_page_tables_move(void) > +{ > + return radix_enabled(); > +} > + > #endif /* __KERNEL__ */ > #endif /* __ASM_POWERPC_TLB_H */ > diff --git a/arch/x86/include/asm/tlb.h b/arch/x86/include/asm/tlb.h > index 1bfe979bb9bc..62915238bb36 100644 > --- a/arch/x86/include/asm/tlb.h > +++ b/arch/x86/include/asm/tlb.h > @@ -37,4 +37,9 @@ static inline void __tlb_remove_table(void *table) > free_page_and_swap_cache(table); > } > > +#define arch_supports_page_tables_move arch_supports_page_tables_move > +static inline bool arch_supports_page_tables_move(void) > +{ > + return true; > +} > #endif /* _ASM_X86_TLB_H */ > diff --git a/mm/mremap.c b/mm/mremap.c > index 7ac1df8e6d51..4d812af3e44b 100644 > --- a/mm/mremap.c > +++ b/mm/mremap.c > @@ -25,7 +25,7 @@ > #include > > #include > -#include > +#include > #include > > #include "internal.h" > @@ -221,6 +221,14 @@ static inline void flush_pte_tlb_pwc_range(struct vm_area_struct *vma, > } > #endif > > +#ifndef arch_supports_page_tables_move > +#define arch_supports_page_tables_move arch_supports_page_tables_move > +static inline bool arch_supports_page_tables_move(void) > +{ > + return false; Can you do return IS_ENABLED(CONFIG_HAVE_MOVE_PMD) || IS_ENABLED(CONFIG_HAVE_MOVE_PUD); And then remove the arch_supports_page_tables_move() you have added for arc, arm64 and x86 ? > +} > +#endif > + > #ifdef CONFIG_HAVE_MOVE_PMD Next step could be remove that #ifdef and the content of the matching #else For that we'd just need a stub version of set_pmd_at() and set_pud_at(). > static bool move_normal_pmd(struct vm_area_struct *vma, unsigned long old_addr, > unsigned long new_addr, pmd_t *old_pmd, pmd_t *new_pmd) > @@ -229,6 +237,8 @@ static bool move_normal_pmd(struct vm_area_struct *vma, unsigned long old_addr, > struct mm_struct *mm = vma->vm_mm; > pmd_t pmd; > > + if (!arch_supports_page_tables_move()) > + return false; > /* > * The destination pmd shouldn't be established, free_pgtables() > * should have released it. > @@ -295,6 +305,8 @@ static bool move_normal_pud(struct vm_area_struct *vma, unsigned long old_addr, > struct mm_struct *mm = vma->vm_mm; > pud_t pud; > > + if (!arch_supports_page_tables_move()) > + return false; > /* > * The destination pud shouldn't be established, free_pgtables() > * should have released it. >