From nobody Mon Feb 9 18:19:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59CC5C7EE22 for ; Mon, 15 May 2023 08:24:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235813AbjEOIYU (ORCPT ); Mon, 15 May 2023 04:24:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232048AbjEOIWL (ORCPT ); Mon, 15 May 2023 04:22:11 -0400 Received: from out0-194.mail.aliyun.com (out0-194.mail.aliyun.com [140.205.0.194]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAAD410DF for ; Mon, 15 May 2023 01:20:32 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R891e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047204;MF=houwenlong.hwl@antgroup.com;NM=1;PH=DS;RN=19;SR=0;TI=SMTPD_---.T2GMf1Y_1684138824; Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.T2GMf1Y_1684138824) by smtp.aliyun-inc.com; Mon, 15 May 2023 16:20:25 +0800 From: "Hou Wenlong" To: linux-kernel@vger.kernel.org Cc: "Lai Jiangshan" , "Hou Wenlong" , "Andy Lutomirski" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "Dave Hansen" , , "H. Peter Anvin" , "Peter Zijlstra" , "Suren Baghdasaryan" , "Andrew Morton" , "=?UTF-8?B?TWlrZSBSYXBvcG9ydCAoSUJNKQ==?=" , "Kirill A. Shutemov" , "David Woodhouse" , "Usama Arif" , "Josh Poimboeuf" , "Brian Gerst" Subject: [PATCH RFC 3/4] x86/fixmap: Move vsyscall page out of fixmap area Date: Mon, 15 May 2023 16:19:34 +0800 Message-Id: <1d982a2883cd807668fad9575ea1c285ae7c272b.1684137557.git.houwenlong.hwl@antgroup.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" After mapping vsyscall page individually, the vsyscall page could be moved out of fixmap area. Suggested-by: Lai Jiangshan Signed-off-by: Hou Wenlong --- arch/x86/entry/vsyscall/vsyscall_64.c | 4 ---- arch/x86/include/asm/fixmap.h | 17 +++++------------ arch/x86/kernel/head_64.S | 6 +++--- arch/x86/mm/fault.c | 1 - arch/x86/mm/init_64.c | 2 +- 5 files changed, 9 insertions(+), 21 deletions(-) diff --git a/arch/x86/entry/vsyscall/vsyscall_64.c b/arch/x86/entry/vsyscal= l/vsyscall_64.c index 4373460ebbde..f469f8dc36d4 100644 --- a/arch/x86/entry/vsyscall/vsyscall_64.c +++ b/arch/x86/entry/vsyscall/vsyscall_64.c @@ -35,7 +35,6 @@ =20 #include #include -#include #include #include =20 @@ -391,7 +390,4 @@ void __init map_vsyscall(void) =20 if (vsyscall_mode =3D=3D XONLY) vm_flags_init(&gate_vma, VM_EXEC); - - BUILD_BUG_ON((unsigned long)__fix_to_virt(VSYSCALL_PAGE) !=3D - (unsigned long)VSYSCALL_ADDR); } diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h index d0dcefb5cc59..eeb152ad9682 100644 --- a/arch/x86/include/asm/fixmap.h +++ b/arch/x86/include/asm/fixmap.h @@ -23,13 +23,13 @@ * covered fully. */ #ifndef CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP -# define FIXMAP_PMD_NUM 2 +# define FIXMAP_PMD_NUM 1 #else # define KM_PMDS (KM_MAX_IDX * ((CONFIG_NR_CPUS + 511) / 512)) -# define FIXMAP_PMD_NUM (KM_PMDS + 2) +# define FIXMAP_PMD_NUM (KM_PMDS + 1) #endif -/* fixmap starts downwards from the 507th entry in level2_fixmap_pgt */ -#define FIXMAP_PMD_TOP 507 +/* fixmap starts downwards from the 506th entry in level2_fixmap_pgt */ +#define FIXMAP_PMD_TOP 506 =20 #ifndef __ASSEMBLY__ #include @@ -38,8 +38,6 @@ #include #ifdef CONFIG_X86_32 #include -#else -#include #endif =20 /* @@ -55,8 +53,7 @@ extern unsigned long __FIXADDR_TOP; #define FIXADDR_TOP ((unsigned long)__FIXADDR_TOP) #else -#define FIXADDR_TOP (round_up(VSYSCALL_ADDR + PAGE_SIZE, 1<> PAGE_SHIFT, -#endif #endif FIX_DBGP_BASE, FIX_EARLYCON_MEM_BASE, diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S index a5df3e994f04..8a0714bc52db 100644 --- a/arch/x86/kernel/head_64.S +++ b/arch/x86/kernel/head_64.S @@ -639,15 +639,15 @@ SYM_DATA_START_PAGE_ALIGNED(level2_kernel_pgt) SYM_DATA_END(level2_kernel_pgt) =20 SYM_DATA_START_PAGE_ALIGNED(level2_fixmap_pgt) - .fill (512 - 4 - FIXMAP_PMD_NUM),8,0 + .fill (512 - 5 - FIXMAP_PMD_NUM),8,0 pgtno =3D 0 .rept (FIXMAP_PMD_NUM) .quad level1_fixmap_pgt + (pgtno << PAGE_SHIFT) - __START_KERNEL_map \ + _PAGE_TABLE_NOENC; pgtno =3D pgtno + 1 .endr - /* 6 MB reserved space + a 2MB hole */ - .fill 4,8,0 + /* 2MB (with 4KB vsyscall page inside) + 6 MB reserved space + a 2MB hole= */ + .fill 5,8,0 SYM_DATA_END(level2_fixmap_pgt) =20 SYM_DATA_START_PAGE_ALIGNED(level1_fixmap_pgt) diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index e4399983c50c..988478e7ef1f 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -23,7 +23,6 @@ =20 #include /* boot_cpu_has, ... */ #include /* dotraplinkage, ... */ -#include /* VSYSCALL_ADDR */ #include /* emulate_vsyscall */ #include /* struct vm86 */ #include /* vma_pkey() */ diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index a190aae8ceaf..b7fd05a1ba1d 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include #include --=20 2.31.1