Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796178896; b=i0aH6Vk0S/GaVUg5z0096GoRLXXZ4GActK7TPyJjzuItFWive9Oaeubr8N6f3nZHjiEi tcpKaGrh1UCTfHOvyPtYNOaktViotNkwMOudVZlVxnQHiqBCZOYqTqMgmklA4GQv2B6e9 MY1HV8Bhk8a2CD3UdqhPQMW/B+eXEDVjd168Z0PCaNp+i3czSdfZ6ZhH9fb54BfQOA9Y9 FQcY6EPqcJV5XxQxgxebmGPWJOzCc5k5bbD6XmA0yuZ8LmbDrnyUD9GrI2r3ZiU1cpEvZ pIc3qX0JYWPaZrfCEnbdnhMviN6CiodD2PY3iM85ZUx2YV3CU0fwXROvDpaEWigso4g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796178896; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=16VpngLhEsz69ovQowqdSn4pRunRiERgwCWLqNgtzhM=; b=zXXPOo6kCO16pSufc2w2OrBCD8v5p+Dh2Ad4Azx0LHd/2ajFNpsQbPT5E+X5HTfg6Dqy vwcBfj9lpVJ/g7qvmD5/XabdeJi/rQjIik9dUS+dc1pzGNbl0OE5OAtHq/49Qq2GN084d vkrf1h+EkKVGxbbkzJ5BuZwXzS4HHL4noboeY0Av6J3+kfGAe96H0gLbYhuxyAkY/2dQ4 fUKXDXDU0dGy7ar4E14v6UYS1mYpsy1s35k0iGMoCQTtJJvbdppowR/rvKVmuGcYcugVh sY49ACji/mSBxVsTRXoaKGhEDmLLRrSt45zn5pFqXIaazodDMdhNFSwvmDYWahpn/5w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=JbLCfqbK; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F094D606A31A; Wed, 2 Dec 2026 02:34:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=JbLCfqbK Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A1A51F0089F; Wed, 2 Dec 2026 02:34:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796178895; bh=16VpngLhEsz69ovQowqdSn4pRunRiERgwCWLqNgtzhM=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=JbLCfqbK6sZ1QAJG3NO5HAYq6cgwXZIhG9ptoKD4kXLZKWUWB/nX2DhNe2PcTZh5e QT/qhvk2LTUei0KksSM3clAhHZGU+iUIaNR7/ngoBGEI7FV4ELhC2j6AmpMKDJKOEo NUXLbTxmfINQLPQG+p7rpgCMVIiW6UvJpamza7uUccGd/9aaTNsGHt802WRcV+k7Z2 mb+AgkAeXcRsSE5WhumYYg2bHNNaAHbArcSfqgcfiN+sQ/4Tmk3yXOmjUFmAsMiggK f1gNnh30N2CTUGntlZQikQfaUntMNZmKV2su2IVSeKCURMmM99g5cC1IBgb7SOvBhU YrJSJn2BMxTVg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [RFC PATCH v2 43/43] arm64: Enable boot-time page size selection Reply-To: sashiko-reviews@lists.linux.dev To: "Eric Curtin" Cc: "Ryan Roberts" , "Jonathan Corbet" , "Shuah Khan" , "Randy Dunlap" , "Catalin Marinas" , "Will Deacon" , "Mark Rutland" , "Marc Zyngier" , "Oliver Upton" , "Fuad Tabba" , "Joey Gouly" , "Steffen Eiden" , "Suzuki K Poulose" , "Zenghui Yu" , "Muchun Song" , "Mike Rapoport" , "David Hildenbrand" , "Ard Biesheuvel" , "Ilias Apalodimas" , kvmarm@lists.linux.dev, linux-mm@kvack.org, linux-efi@vger.kernel.org In-Reply-To: <20261201015240.1017259-44-ericcurtin17@gmail.com> References: <20261201015240.1017259-1-ericcurtin17@gmail.com> <20261201015240.1017259-44-ericcurtin17@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 02:34:54 +0000 X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [High] arm64: Kconfig ARM64_BOOT_TIME_PAGE_SIZE defaults VA space choice to 42-bit - [High] arm64: non-constant PAGE_SHIFT and PAGE_SIZE break build in core MM/net headers - [Medium] arm64: Kconfig ARCH_MMAP_RND_BITS checks ARM64_64K_PAGES not PAGE_SIZE_64KB - [Low] arm64: mm: missing linux/export.h include in arch/arm64/mm/pgtable-geometry.c -- commit fdde9968b708f81560ecc9e1237491977b2dbeed Author: Ryan Roberts arm64: Enable boot-time page size selection This commit introduces CONFIG_ARM64_BOOT_TIME_PAGE_SIZE to allow choosing t= he 4K, 16K or 64K translation granule at boot via the arm64.pagesize=3D command line option, resolving page and page-table geometry macros through runtime ptg_* variables initialized in early_map_kernel(). [Severity: Medium] In arch/arm64/Kconfig, around line 319 in config ARCH_MMAP_RND_BITS, should the 24-bit default check PAGE_SIZE_64KB instead of ARM64_64K_PAGES, matching ARCH_MMAP_RND_BITS_MAX and ARCH_MMAP_RND_COMPAT_BITS_MIN? When ARM64_BOOT_TIME_PAGE_SIZE=3Dy, both ARM64_64K_PAGES and ARM64_16K_PAGES are n, so ARCH_MMAP_RND_BITS falls through to 28 instead of the 64K-page default of 24. When booted with 64K pages (PAGE_SHIFT =3D 16), arch_mmap_r= nd() in mm/util.c shifts a 28-bit random value by 16 bits, randomizing user mmap bases across 16 TiB (2^44 bytes, one bit below ARCH_MMAP_RND_BITS_MAX =3D 2= 9) instead of 1 TiB. [Severity: High] In arch/arm64/Kconfig, around lines 1608 and 1661-1674, does enabling ARM64_BOOT_TIME_PAGE_SIZE cause the "Virtual address space size" choice blo= ck to default to ARM64_VA_BITS_42 instead of ARM64_VA_BITS_48? ARM64_BOOT_TIME_PAGE_SIZE selects HAVE_PAGE_SIZE_64KB (enabling PAGE_SIZE_64KB=3Dy) and disables the choice's default symbol ARM64_VA_BITS_= 52. Because ARM64_VA_BITS_42 depends on PAGE_SIZE_64KB and precedes ARM64_VA_BITS_48 in the choice block, Kconfig falls back to the first visib= le entry and selects 42-bit VA by default, even though only 48-bit VA is supported: - With 42-bit VA and 64K pages, ARCH_MMAP_RND_BITS_MAX defaults to 27, so arch_mmap_rnd() can shift 27 + 16 =3D 43 bits, exceeding the 42-bit user = VA space. - With 42-bit VA and 4K pages (ptg_pgtable_levels =3D 4, PGDIR_SHIFT =3D 39= ), if KASLR places the kernel image in the top 512 GiB of the 2 TiB kernel VA range so it shares a PGD entry with the fixmap, early_fixmap_init_pud() in arch/arm64/mm/fixmap.c hits BUG_ON(PAGE_SIZE !=3D SZ_16K). - With 42-bit VA and 64K pages (ptg_pgtable_levels =3D 2, where ptg_init() = sets PUD_SHIFT =3D PMD_SHIFT =3D PGDIR_SHIFT =3D 29 while __PAGETABLE_PMD_FOLD= ED is not defined because CONFIG_PGTABLE_LEVELS is 4), __flush_hugetlb_tlb_rang= e() in arch/arm64/include/asm/hugetlb.h matches stride =3D=3D PUD_SIZE and pa= sses TTL level 1 instead of level 2 for PMD hugepages, and huge_pte_offset() in arch/arm64/mm/hugetlbpage.c computes pgd_offset(mm, addr) before masking addr &=3D CONT_PMD_MASK while pmd_offset() folds to the PGD entry without using the masked address. Making ARM64_VA_BITS_42 depend on ARM64_64K_PAGES (or !ARM64_BOOT_TIME_PAGE= _SIZE) would keep 48-bit VA as the only selectable option. [Severity: High] In arch/arm64/include/asm/pgtable-geometry.h, around line 26, does replacing ptg_page_shift with an extern int variable break compilation in core code when CONFIG_ARM64_BOOT_TIME_PAGE_SIZE=3Dy? With PAGE_SHIFT defined as ptg_page_shift and PAGE_SIZE as (_AC(1, UL) << PAGE_SHIFT), building with CONFIG_ARM64_BOOT_TIME_PAGE_SIZE= =3Dy fails in two ways: - Preprocessor directives that test PAGE_SHIFT or PAGE_SIZE, such as include/linux/mmzone.h:2002 (#if (MAX_PAGE_ORDER + PAGE_SHIFT) > SECTION_= SIZE_BITS), include/linux/netlink.h:272 (#if PAGE_SIZE < 8192UL), include/net/page_pool/types.h:56 (#if PAGE_SIZE >=3D SZ_64K), and mm/memcontrol.c:2118 (#if PAGE_SHIFT > 16), evaluate ptg_page_shift in #if and fail under arch/arm64/Makefile's -Werror=3Dundef. - File-scope and struct array declarations sized by PAGE_SIZE, such as union swap_header in include/linux/swap.h:121, str_dup in mm/huge_memory.c:1172, and kasan_early_shadow_page in include/linux/kasan.h:53, fail to compile because PAGE_SIZE is no longer a compile-time constant. [Severity: Low] In arch/arm64/mm/pgtable-geometry.c, lines 6-32 use EXPORT_SYMBOL() without including , which triggers a warning from scripts/misc-check at W=3D2. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201015240.1017= 259-1-ericcurtin17@gmail.com?part=3D43