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 46621C43460 for ; Wed, 14 Apr 2021 06:10:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E1148611C9 for ; Wed, 14 Apr 2021 06:10:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E1148611C9 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 73FBC6B0036; Wed, 14 Apr 2021 02:10:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F0D86B006C; Wed, 14 Apr 2021 02:10:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5436E6B0070; Wed, 14 Apr 2021 02:10:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0242.hostedemail.com [216.40.44.242]) by kanga.kvack.org (Postfix) with ESMTP id 3818A6B0036 for ; Wed, 14 Apr 2021 02:10:54 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id DAC4818017361 for ; Wed, 14 Apr 2021 06:10:53 +0000 (UTC) X-FDA: 78029949186.18.78095F7 Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by imf14.hostedemail.com (Postfix) with ESMTP id 5F4E3C0001EE for ; Wed, 14 Apr 2021 06:10:45 +0000 (UTC) Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4FKsXp6CPzzB09bD; Wed, 14 Apr 2021 08:10:50 +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 bgEX-Y99N3ka; Wed, 14 Apr 2021 08:10:50 +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 4FKsXp513xzB09bB; Wed, 14 Apr 2021 08:10:50 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 8F6CC8B7B6; Wed, 14 Apr 2021 08:10:51 +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 8t_hMitD6rsU; Wed, 14 Apr 2021 08:10:51 +0200 (CEST) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 62A328B75F; Wed, 14 Apr 2021 08:10:50 +0200 (CEST) Subject: Re: [PATCH] mm: Define ARCH_HAS_FIRST_USER_ADDRESS To: Anshuman Khandual , linux-mm@kvack.org, akpm@linux-foundation.org Cc: linux-s390@vger.kernel.org, x86@kernel.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-sh@vger.kernel.org, linux-um@lists.infradead.org, linux-mips@vger.kernel.org, linux-csky@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, openrisc@lists.librecores.org, linux-alpha@vger.kernel.org, sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org, linux-snps-arc@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org References: <1618368899-20311-1-git-send-email-anshuman.khandual@arm.com> <6d24d3cc-b2df-f0d7-f4bf-f505f679c77e@arm.com> From: Christophe Leroy Message-ID: Date: Wed, 14 Apr 2021 08:10:49 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <6d24d3cc-b2df-f0d7-f4bf-f505f679c77e@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 5F4E3C0001EE X-Stat-Signature: nfucuftjh6bqqhznx78jcpmcixqchm7o Received-SPF: none (csgroup.eu>: No applicable sender policy available) receiver=imf14; identity=mailfrom; envelope-from=""; helo=pegase1.c-s.fr; client-ip=93.17.236.30 X-HE-DKIM-Result: none/none X-HE-Tag: 1618380645-303643 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 14/04/2021 =C3=A0 07:59, Anshuman Khandual a =C3=A9crit=C2=A0: >=20 >=20 > On 4/14/21 10:52 AM, Christophe Leroy wrote: >> >> >> Le 14/04/2021 =C3=A0 04:54, Anshuman Khandual a =C3=A9crit=C2=A0: >>> Currently most platforms define FIRST_USER_ADDRESS as 0UL duplicating= the >>> same code all over. Instead define a new option ARCH_HAS_FIRST_USER_A= DDRESS >>> for those platforms which would override generic default FIRST_USER_A= DDRESS >>> value 0UL. This makes it much cleaner with reduced code. >>> >>> Cc: linux-alpha@vger.kernel.org >>> Cc: linux-snps-arc@lists.infradead.org >>> Cc: linux-arm-kernel@lists.infradead.org >>> Cc: linux-csky@vger.kernel.org >>> Cc: linux-hexagon@vger.kernel.org >>> Cc: linux-ia64@vger.kernel.org >>> Cc: linux-m68k@lists.linux-m68k.org >>> Cc: linux-mips@vger.kernel.org >>> Cc: openrisc@lists.librecores.org >>> Cc: linux-parisc@vger.kernel.org >>> Cc: linuxppc-dev@lists.ozlabs.org >>> Cc: linux-riscv@lists.infradead.org >>> Cc: linux-s390@vger.kernel.org >>> Cc: linux-sh@vger.kernel.org >>> Cc: sparclinux@vger.kernel.org >>> Cc: linux-um@lists.infradead.org >>> Cc: linux-xtensa@linux-xtensa.org >>> Cc: x86@kernel.org >>> Cc: linux-mm@kvack.org >>> Cc: linux-kernel@vger.kernel.org >>> Signed-off-by: Anshuman Khandual >>> --- >>> =C2=A0 arch/alpha/include/asm/pgtable.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 1 - >>> =C2=A0 arch/arc/include/asm/pgtable.h=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 | 6 ------ >>> =C2=A0 arch/arm/Kconfig=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=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 1 + >>> =C2=A0 arch/arm64/include/asm/pgtable.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 2 -- >>> =C2=A0 arch/csky/include/asm/pgtable.h=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 | 1 - >>> =C2=A0 arch/hexagon/include/asm/pgtable.h=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 3 --- >>> =C2=A0 arch/ia64/include/asm/pgtable.h=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 | 1 - >>> =C2=A0 arch/m68k/include/asm/pgtable_mm.h=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 1 - >>> =C2=A0 arch/microblaze/include/asm/pgtable.h=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 | 2 -- >>> =C2=A0 arch/mips/include/asm/pgtable-32.h=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 1 - >>> =C2=A0 arch/mips/include/asm/pgtable-64.h=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 1 - >>> =C2=A0 arch/nds32/Kconfig=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=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 1 + >>> =C2=A0 arch/nios2/include/asm/pgtable.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 2 -- >>> =C2=A0 arch/openrisc/include/asm/pgtable.h=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 | 1 - >>> =C2=A0 arch/parisc/include/asm/pgtable.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 2 -- >>> =C2=A0 arch/powerpc/include/asm/book3s/pgtable.h=C2=A0=C2=A0=C2=A0 |= 1 - >>> =C2=A0 arch/powerpc/include/asm/nohash/32/pgtable.h | 1 - >>> =C2=A0 arch/powerpc/include/asm/nohash/64/pgtable.h | 2 -- >>> =C2=A0 arch/riscv/include/asm/pgtable.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 2 -- >>> =C2=A0 arch/s390/include/asm/pgtable.h=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 | 2 -- >>> =C2=A0 arch/sh/include/asm/pgtable.h=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 | 2 -- >>> =C2=A0 arch/sparc/include/asm/pgtable_32.h=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 | 1 - >>> =C2=A0 arch/sparc/include/asm/pgtable_64.h=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 | 3 --- >>> =C2=A0 arch/um/include/asm/pgtable-2level.h=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 | 1 - >>> =C2=A0 arch/um/include/asm/pgtable-3level.h=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 | 1 - >>> =C2=A0 arch/x86/include/asm/pgtable_types.h=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 | 2 -- >>> =C2=A0 arch/xtensa/include/asm/pgtable.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 1 - >>> =C2=A0 include/linux/mm.h=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=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 4 ++++ >>> =C2=A0 mm/Kconfig=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=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 | 4 ++++ >>> =C2=A0 29 files changed, 10 insertions(+), 43 deletions(-) >>> >>> diff --git a/include/linux/mm.h b/include/linux/mm.h >>> index 8ba434287387..47098ccd715e 100644 >>> --- a/include/linux/mm.h >>> +++ b/include/linux/mm.h >>> @@ -46,6 +46,10 @@ extern int sysctl_page_lock_unfairness; >>> =C2=A0 =C2=A0 void init_mm_internals(void); >>> =C2=A0 +#ifndef ARCH_HAS_FIRST_USER_ADDRESS >> >> I guess you didn't test it ..... :) >=20 > In fact I did :) Though just booted it on arm64 and cross compiled on > multiple others platforms. >=20 >> >> should be #ifndef CONFIG_ARCH_HAS_FIRST_USER_ADDRESS >=20 > Right, meant that instead. >=20 >> >>> +#define FIRST_USER_ADDRESS=C2=A0=C2=A0=C2=A0 0UL >>> +#endif >> >> But why do we need a config option at all for that ? >> >> Why not just: >> >> #ifndef FIRST_USER_ADDRESS >> #define FIRST_USER_ADDRESS=C2=A0=C2=A0=C2=A0 0UL >> #endif >=20 > This sounds simpler. But just wondering, would not there be any possibi= lity > of build problems due to compilation sequence between arch and generic = code ? >=20 For sure it has to be addresses carefully, but there are already a lot of= stuff like that around=20 pgtables.h For instance, pte_offset_kernel() has a generic definition in linux/pgtab= les.h based on whether it=20 is already defined or not. Taking into account that FIRST_USER_ADDRESS is today in the architectures= 's asm/pgtables.h, I think=20 putting the fallback definition in linux/pgtable.h would do the trick.