Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1932501rwr; Fri, 28 Apr 2023 04:02:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6sF/l3do3V8ekg1Dv4auDqtXknmOVGPkWHHxqnf713wYs4hf3Rf0T0kIzBbJM7S2V14Z47 X-Received: by 2002:a92:dc81:0:b0:32b:50d1:3403 with SMTP id c1-20020a92dc81000000b0032b50d13403mr3284320iln.7.1682679757803; Fri, 28 Apr 2023 04:02:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682679757; cv=none; d=google.com; s=arc-20160816; b=nBqvUlOVAwk7OqbZy1QgjxY/KXNnWatNAp5R2e5g/u8H7HvJnWW6nm/V01X50v0xDO HJfydxVy+CD4oBCMk4KuULReynPBv3PqBt50FjNlru+Qs7XXxLfGaquyT86ElFU9uofe p4DAsIpxlRN8UgaLBOdFJYP5sMWNDNrMCrfTHAanTUUboVtTh46b7We6gCaWqdSUEKl/ mrLyBsiPnnzqVrw24z0qM80u11FC268oEbKNmio60LLTkXV+1wRKBPNylTXN4QDzhSvw 8tXPZ3cZk29G1YUntXALVrVdjgZwb8KTBezP80gPvu9MCzVsfdMcQQT5ze0AudmwmfAB FvZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=j9HODdPdjUiXNECur+XI0dD5I+hE7OJGuomxVHJaS/8=; b=sFzLU7oigoM0MsDU44kOJvJXLb0CGHrdPwIkApZ2YVeXUoFm1veV4FMKfOeeJEpZhq chcv3bUkTZnoWmtcJ6rQN70hRG13cg/jp9eZ9ZvCn/X4KFYv9pRiybuqCeT9YE3+mN1u agLbpJYRbSROQ2pgNlcXAs6GKQwh1dA+Oq5R7Q12wdR5gtsa/6MQU1srxZaIEt5G5NhL iX7+Uyd+KMRQRgSDGRAwfOgzwPD2cOk5JIRa/1aAMnED1QqUSIhqkIDwL6FRmylv0oB7 LXDKEGbq7XmVgPTqZ/53XKtLIycYLqAitDLUpcGAHo4KgGrTqXnGQzD6KH4jOQcmnsOt 2LyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z3-20020a92bf03000000b0032b607f34e1si2206799ilh.56.2023.04.28.04.02.21; Fri, 28 Apr 2023 04:02:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345340AbjD1LAT (ORCPT + 99 others); Fri, 28 Apr 2023 07:00:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229577AbjD1LAR (ORCPT ); Fri, 28 Apr 2023 07:00:17 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CF08E2706 for ; Fri, 28 Apr 2023 04:00:16 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4ACFEC14; Fri, 28 Apr 2023 04:01:00 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.21.9]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E05973F64C; Fri, 28 Apr 2023 04:00:14 -0700 (PDT) Date: Fri, 28 Apr 2023 12:00:09 +0100 From: Mark Rutland To: Ard Biesheuvel Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon , Marc Zyngier , Ryan Roberts , Anshuman Khandual , Kees Cook Subject: Re: [PATCH v3 05/60] arm64: mm: Move fixmap region above vmemmap region Message-ID: References: <20230307140522.2311461-1-ardb@kernel.org> <20230307140522.2311461-6-ardb@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230307140522.2311461-6-ardb@kernel.org> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 07, 2023 at 03:04:27PM +0100, Ard Biesheuvel wrote: > Move the fixmap region above the vmemmap region, so that the start of > the vmemmap delineates the end of the region available for vmalloc and > vmap allocations and the randomized placement of the kernel and modules. > > In a subsequent patch, we will take advantage of this to reclaim most of > the vmemmap area when running a 52-bit VA capable build with 52-bit > virtual addressing disabled at runtime. > > Note that the existing guard region of 256 MiB covers the fixmap and PCI > I/O regions as well, so we can reduce it 8 MiB, which is what we use in > other places too. > > Signed-off-by: Ard Biesheuvel > --- > arch/arm64/include/asm/memory.h | 2 +- > arch/arm64/include/asm/pgtable.h | 2 +- > arch/arm64/mm/ptdump.c | 4 ++-- > 3 files changed, 4 insertions(+), 4 deletions(-) As a heads-up, this will (trivially) conflict with some of the arm64 fixmap cleanups that'll be in v6.4-rc1, due to the FIXADDR_TOT_* changes. > > diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h > index 6e321cc06a3c30f0..9b9e52d823beccc6 100644 > --- a/arch/arm64/include/asm/memory.h > +++ b/arch/arm64/include/asm/memory.h > @@ -51,7 +51,7 @@ > #define VMEMMAP_END (VMEMMAP_START + VMEMMAP_SIZE) > #define PCI_IO_START (VMEMMAP_END + SZ_8M) > #define PCI_IO_END (PCI_IO_START + PCI_IO_SIZE) > -#define FIXADDR_TOP (VMEMMAP_START - SZ_32M) > +#define FIXADDR_TOP (ULONG_MAX - SZ_8M + 1) Can we make this: #define FIXADDR_TOP (-SZ_8M) ... as that would match the way we define PAGE_OFFSET (and VMEMMAP_START), and it removes the need for the '+1' to handle ULONG_MAX being one-off what we actually want to subtact from. Mark. > > #if VA_BITS > 48 > #define VA_BITS_MIN (48) > diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h > index b6ba466e2e8a3fc7..3eff06c5d0eb73c7 100644 > --- a/arch/arm64/include/asm/pgtable.h > +++ b/arch/arm64/include/asm/pgtable.h > @@ -22,7 +22,7 @@ > * and fixed mappings > */ > #define VMALLOC_START (MODULES_END) > -#define VMALLOC_END (VMEMMAP_START - SZ_256M) > +#define VMALLOC_END (VMEMMAP_START - SZ_8M) > > #define vmemmap ((struct page *)VMEMMAP_START - (memstart_addr >> PAGE_SHIFT)) > > diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c > index 9d1f4cdc6672ed5f..76d28056bd14920a 100644 > --- a/arch/arm64/mm/ptdump.c > +++ b/arch/arm64/mm/ptdump.c > @@ -45,12 +45,12 @@ static struct addr_marker address_markers[] = { > { MODULES_END, "Modules end" }, > { VMALLOC_START, "vmalloc() area" }, > { VMALLOC_END, "vmalloc() end" }, > - { FIXADDR_START, "Fixmap start" }, > - { FIXADDR_TOP, "Fixmap end" }, > { VMEMMAP_START, "vmemmap start" }, > { VMEMMAP_START + VMEMMAP_SIZE, "vmemmap end" }, > { PCI_IO_START, "PCI I/O start" }, > { PCI_IO_END, "PCI I/O end" }, > + { FIXADDR_START, "Fixmap start" }, > + { FIXADDR_TOP, "Fixmap end" }, > { -1, NULL }, > }; > > -- > 2.39.2 > >