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.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 67B92C433B4 for ; Fri, 9 Apr 2021 11:59:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BA4CC61177 for ; Fri, 9 Apr 2021 11:59:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA4CC61177 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 23C616B0074; Fri, 9 Apr 2021 07:59:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1ED508D0003; Fri, 9 Apr 2021 07:59:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0425E6B0078; Fri, 9 Apr 2021 07:59:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0030.hostedemail.com [216.40.44.30]) by kanga.kvack.org (Postfix) with ESMTP id DDA946B0074 for ; Fri, 9 Apr 2021 07:59:40 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 796EA18463DAB for ; Fri, 9 Apr 2021 11:59:40 +0000 (UTC) X-FDA: 78012684120.03.53F6874 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf21.hostedemail.com (Postfix) with ESMTP id 8F22AE000118 for ; Fri, 9 Apr 2021 11:59:38 +0000 (UTC) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 139BYsMM092973; Fri, 9 Apr 2021 07:59:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=Us3UH84vgCH9c0G2yzSE7UHxEExA/BWhebWtzXlvFkA=; b=NhPUyg7STXzYk18gxsBLhMhJqxfzrMztV6uam9pEDTTok4iEnRZQUtE91SxSwWxy3HGJ yLlKPJGNPC0Ee5CDrzYSBq8Y5/ftfw6HQzRxqiuGsMTMxDxgpuWA3PrAw6d958xt19OM v42tQTXBa5dfCIsFE1u2krV7/YPifbsPRDYH/cJIRz3W5zi/I5k2i11KC6HptWMywtmJ G//BGBGQeBKgTTrHKrWZF/gNfgal9S1McJYf+3c4q5XgTFZ8RL0AQD7fvFcr2xWWFI3O ogsPAHq2jwys9x2q4M5mzidBfhNvvdSUe/259Ovul0G2lIGEar3+BmNJiEBxDT0R776m WQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 37s5xubwck-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Apr 2021 07:59:33 -0400 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 139BbGIa102374; Fri, 9 Apr 2021 07:59:32 -0400 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 37s5xubwc7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Apr 2021 07:59:32 -0400 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 139BvMn8027257; Fri, 9 Apr 2021 11:59:31 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma06ams.nl.ibm.com with ESMTP id 37rvbwae17-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Apr 2021 11:59:30 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 139BxS3R50528626 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Apr 2021 11:59:28 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 76D1A4C040; Fri, 9 Apr 2021 11:59:28 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CA0DE4C04E; Fri, 9 Apr 2021 11:59:26 +0000 (GMT) Received: from [9.85.75.82] (unknown [9.85.75.82]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 9 Apr 2021 11:59:26 +0000 (GMT) Subject: Re: [PATCH v3 8/9] mm/mremap: Allow arch runtime override To: Christophe Leroy , 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: "Aneesh Kumar K.V" Message-ID: <955e19f7-e15c-d7cc-3cdf-0c237ae980c1@linux.ibm.com> Date: Fri, 9 Apr 2021 17:29:25 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 9DorQKqgJJZ1T06pcYWKHZuApm7E8PSj X-Proofpoint-ORIG-GUID: FandDaYX_mML3gi2w5LFg_53NGxCUHvh X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-04-09_05:2021-04-09,2021-04-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 malwarescore=0 mlxscore=0 spamscore=0 impostorscore=0 mlxlogscore=999 bulkscore=0 clxscore=1015 lowpriorityscore=0 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104090086 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 8F22AE000118 X-Stat-Signature: g543smf539pgmm81my5fb9rpor49qztt Received-SPF: none (linux.ibm.com>: No applicable sender policy available) receiver=imf21; identity=mailfrom; envelope-from=""; helo=mx0b-001b2d01.pphosted.com; client-ip=148.163.158.5 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617969578-565593 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: On 4/9/21 3:05 PM, Christophe Leroy wrote: >=20 >=20 > 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 radi= x >=20 > ... only .... only ... >=20 >> translation. Hence allow a runtime check w.r.t support for fast mremap= . >> will fix that >> Signed-off-by: Aneesh Kumar K.V >> --- >> =C2=A0 arch/arc/include/asm/tlb.h=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 5 ++= +++ >> =C2=A0 arch/arm64/include/asm/tlb.h=C2=A0=C2=A0 |=C2=A0 6 ++++++ >> =C2=A0 arch/powerpc/include/asm/tlb.h |=C2=A0 6 ++++++ >> =C2=A0 arch/x86/include/asm/tlb.h=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 5 ++= +++ >> =C2=A0 mm/mremap.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 14 +++++++= ++++++- >> =C2=A0 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 @@ >> =C2=A0 #include >> =C2=A0 #include >> +#define arch_supports_page_tables_move arch_supports_page_tables_move >> +static inline bool arch_supports_page_tables_move(void) >> +{ >> +=C2=A0=C2=A0=C2=A0 return true; >> +} >=20 > I can't see why ARC arch needs that. It neither selects=20 > CONFIG_HAVE_MOVE_PMD nor CONFIG_HAVE_MOVE_PUD. >=20 > ok will fix that (I confused arch/Kconfig with arc/Kconfig ) >> =C2=A0 #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= =20 >> *tlb, pud_t *pudp, >> =C2=A0 } >> =C2=A0 #endif >> +#define arch_supports_page_tables_move arch_supports_page_tables_move >> +static inline bool arch_supports_page_tables_move(void) >> +{ >> +=C2=A0=C2=A0=C2=A0 return true; >> +} >> + >> =C2=A0 #endif >> diff --git a/arch/powerpc/include/asm/tlb.h=20 >> 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=20 >> mm_struct *mm) >> =C2=A0 } >> =C2=A0 #endif >> +#define arch_supports_page_tables_move arch_supports_page_tables_move >> +static inline bool arch_supports_page_tables_move(void) >> +{ >> +=C2=A0=C2=A0=C2=A0 return radix_enabled(); >> +} >> + >> =C2=A0 #endif /* __KERNEL__ */ >> =C2=A0 #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) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 free_page_and_swap_cache(table); >> =C2=A0 } >> +#define arch_supports_page_tables_move arch_supports_page_tables_move >> +static inline bool arch_supports_page_tables_move(void) >> +{ >> +=C2=A0=C2=A0=C2=A0 return true; >> +} >> =C2=A0 #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 @@ >> =C2=A0 #include >> =C2=A0 #include >> -#include >> +#include >> =C2=A0 #include >> =C2=A0 #include "internal.h" >> @@ -221,6 +221,14 @@ static inline void flush_pte_tlb_pwc_range(struct= =20 >> vm_area_struct *vma, >> =C2=A0 } >> =C2=A0 #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) >> +{ >> +=C2=A0=C2=A0=C2=A0 return false; >=20 > Can you do >=20 > =C2=A0=C2=A0=C2=A0=C2=A0return IS_ENABLED(CONFIG_HAVE_MOVE_PMD) ||=20 > IS_ENABLED(CONFIG_HAVE_MOVE_PUD); >=20 > And then remove the arch_supports_page_tables_move() you have added for= =20 > arc, arm64 and x86 ? >=20 something like below? #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 IS_ENABLED(CONFIG_HAVE_MOVE_PMD) || IS_ENABLED(CONFIG_HAVE_MOVE_PUD); } #endif are remove those from those arch headers. >> +} >> +#endif >> + >> =C2=A0 #ifdef CONFIG_HAVE_MOVE_PMD >=20 > 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()= . >=20 >> =C2=A0 static bool move_normal_pmd(struct vm_area_struct *vma, unsigne= d=20 >> long old_addr, >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 uns= igned long new_addr, pmd_t *old_pmd, pmd_t *new_pmd) >> @@ -229,6 +237,8 @@ static bool move_normal_pmd(struct vm_area_struct=20 >> *vma, unsigned long old_addr, >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct mm_struct *mm =3D vma->vm_mm; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pmd_t pmd; >> +=C2=A0=C2=A0=C2=A0 if (!arch_supports_page_tables_move()) >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return false; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * The destination pmd shouldn't b= e established, free_pgtables() >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * should have released it. >> @@ -295,6 +305,8 @@ static bool move_normal_pud(struct vm_area_struct=20 >> *vma, unsigned long old_addr, >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct mm_struct *mm =3D vma->vm_mm; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pud_t pud; >> +=C2=A0=C2=A0=C2=A0 if (!arch_supports_page_tables_move()) >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return false; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * The destination pud shouldn't b= e established, free_pgtables() >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * should have released it. >> 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.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 7206EC433ED for ; Fri, 9 Apr 2021 12:00:23 +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 1F8B1610CC for ; Fri, 9 Apr 2021 12:00:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1F8B1610CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com 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 4FGxXN45yYz3byZ for ; Fri, 9 Apr 2021 22:00:20 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=NhPUyg7S; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0b-001b2d01.pphosted.com; envelope-from=aneesh.kumar@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=NhPUyg7S; dkim-atps=neutral Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 4FGxWh2nHpz30JL for ; Fri, 9 Apr 2021 21:59:43 +1000 (AEST) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 139BYsMM092973; Fri, 9 Apr 2021 07:59:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=Us3UH84vgCH9c0G2yzSE7UHxEExA/BWhebWtzXlvFkA=; b=NhPUyg7STXzYk18gxsBLhMhJqxfzrMztV6uam9pEDTTok4iEnRZQUtE91SxSwWxy3HGJ yLlKPJGNPC0Ee5CDrzYSBq8Y5/ftfw6HQzRxqiuGsMTMxDxgpuWA3PrAw6d958xt19OM v42tQTXBa5dfCIsFE1u2krV7/YPifbsPRDYH/cJIRz3W5zi/I5k2i11KC6HptWMywtmJ G//BGBGQeBKgTTrHKrWZF/gNfgal9S1McJYf+3c4q5XgTFZ8RL0AQD7fvFcr2xWWFI3O ogsPAHq2jwys9x2q4M5mzidBfhNvvdSUe/259Ovul0G2lIGEar3+BmNJiEBxDT0R776m WQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 37s5xubwck-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Apr 2021 07:59:33 -0400 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 139BbGIa102374; Fri, 9 Apr 2021 07:59:32 -0400 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 37s5xubwc7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Apr 2021 07:59:32 -0400 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 139BvMn8027257; Fri, 9 Apr 2021 11:59:31 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma06ams.nl.ibm.com with ESMTP id 37rvbwae17-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Apr 2021 11:59:30 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 139BxS3R50528626 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Apr 2021 11:59:28 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 76D1A4C040; Fri, 9 Apr 2021 11:59:28 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CA0DE4C04E; Fri, 9 Apr 2021 11:59:26 +0000 (GMT) Received: from [9.85.75.82] (unknown [9.85.75.82]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 9 Apr 2021 11:59:26 +0000 (GMT) Subject: Re: [PATCH v3 8/9] mm/mremap: Allow arch runtime override To: Christophe Leroy , 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: "Aneesh Kumar K.V" Message-ID: <955e19f7-e15c-d7cc-3cdf-0c237ae980c1@linux.ibm.com> Date: Fri, 9 Apr 2021 17:29:25 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 9DorQKqgJJZ1T06pcYWKHZuApm7E8PSj X-Proofpoint-ORIG-GUID: FandDaYX_mML3gi2w5LFg_53NGxCUHvh X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-04-09_05:2021-04-09, 2021-04-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 malwarescore=0 mlxscore=0 spamscore=0 impostorscore=0 mlxlogscore=999 bulkscore=0 clxscore=1015 lowpriorityscore=0 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104090086 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" On 4/9/21 3:05 PM, Christophe Leroy wrote: > > > 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. >> will fix that >> 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. > > ok will fix that (I confused arch/Kconfig with arc/Kconfig ) >>   #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 ? > something like below? #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 IS_ENABLED(CONFIG_HAVE_MOVE_PMD) || IS_ENABLED(CONFIG_HAVE_MOVE_PUD); } #endif are remove those from those arch headers. >> +} >> +#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. >>