From nobody Wed Dec 17 12:46:04 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2787523DEBB; Tue, 10 Dec 2024 16:06:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733846803; cv=none; b=Lsp3VzMgJHwHgj2c7dW/Fo9G0ZiGE1Hk+H+Avc65E2TXrjGcLqu1iASRsu6EgtWgZjz1Jk7MuZ4Wmded6iu8MNFYdkv2pwDpNZbuqY7M7n/VbH3ll7UYxqz6NfMXi++9nVgYz1kOKaTubaX+8VeqKMTtG99/fQ3ScPuRrBs6px8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733846803; c=relaxed/simple; bh=nhIKrOVHXT3fUCBw4LPHGsOsiy5FD8A3uloS3DV+YHc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FjbBPHLLUjtykXNIeXb/xEy99mNRE6FD7Re0UuaeqOmnekFcSJ4Qxi8RhpOPvokEMnpHwWEs4NphtULHe1D1JO2G/5oR8jvXdJ6hl5ifxpxiv8cCCt1nRu3zY7R6L7euOhyc8rE+SJdnF6aQAcIsQWqG5WaVRwmd3IgWK9bALF4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=P8ZZHIvS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="P8ZZHIvS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41C9CC4CEE8; Tue, 10 Dec 2024 16:06:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733846802; bh=nhIKrOVHXT3fUCBw4LPHGsOsiy5FD8A3uloS3DV+YHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P8ZZHIvSDkAlRtjuBdPZfIY3aU5cCBpzyB/i2Vv0HHj1O6+BciyVjba8Qkih/H+oH 8TtDjHvi5iAR5MM0ElcShiTGwZql1i32Y6428E+38PRhzgRtAWTKpfhzHJiPn84smK HJWY3mo1jKE1QGYdAFfrLrczgT25PXzoZxXyZngcTAjKXWCDBA2CPN3ZHKobWSi6Kp YPEzJWTJOIMs4W0CAIhrvEGezqOkDjf872n/KtyP4lCYe2TAn2G5E3eIEtTgkMqO5y 6R94PbszNkqgUUmIxY+fUeVVOLgne6LUFDtXRCNteNin/BkIZD+yk9ibqhphxRJ7mU pxz1jz8DVVEoQ== From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , linux-mm@kvack.org, linux-rt-devel@lists.linux.dev, Ard Biesheuvel , Clark Williams , Jason Baron , Josh Poimboeuf , Linus Walleij , Mark Rutland , Matthew Wilcox , Peter Zijlstra , Russell King , Sebastian Andrzej Siewior , Steven Rostedt , Thomas Gleixner Subject: [PATCH 1/4] ARM: Disable jump-label on PREEMPT_RT Date: Tue, 10 Dec 2024 17:05:53 +0100 Message-Id: <20241210160556.2341497-2-arnd@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241210160556.2341497-1-arnd@kernel.org> References: <20241210160556.2341497-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Thomas Gleixner jump-labels are used to efficiently switch between two possible code paths. To achieve this, stop_machine() is used to keep the CPU in a known state while the opcode is modified. The usage of stop_machine() here leads to large latency spikes which can be observed on PREEMPT_RT. Jump labels may change the target during runtime and are not restricted to debug or "configuration/ setup" part of a PREEMPT_RT system where high latencies could be defined as acceptable. On 64-bit Arm, it is possible to use jump labels without the stop_machine() call, which architecturally provides a way to atomically change one 32-bit instruction word while keeping maintaining consistency, but this is not generally the case on 32-bit, in particular in thumb2 mode. Disable jump-label support on a PREEMPT_RT system when SMP is enabled. [bigeasy: Patch description.] [arnd: add !SMP case, extend changelog] Signed-off-by: Thomas Gleixner Signed-off-by: Sebastian Andrzej Siewior Cc: Mark Rutland Cc: Ard Biesheuvel Link: https://lkml.kernel.org/r/20220613182447.112191-2-bigeasy@linutronix.= de Signed-off-by: Arnd Bergmann Reviewed-by: Linus Walleij --- I slightly changed the patch from the version currently in linux-rt.git to leave jump labels enabled on single-CPU kernels that are still fairly common on 32-bit arm. If there are no additional concerns about this version, I will forward it to Russell's patch system --- arch/arm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index fb4e1da3bb98..ed850cc0ed3c 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -80,7 +80,7 @@ config ARM select HAS_IOPORT if PCI || PCMCIA || ISA || ARCH_FOOTBRIDGE || ARCH_RPC select HAVE_ARCH_AUDITSYSCALL if AEABI && !OABI_COMPAT select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6 - select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU + select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU && = (!PREEMPT_RT || !SMP) select HAVE_ARCH_KFENCE if MMU && !XIP_KERNEL select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU select HAVE_ARCH_KASAN if MMU && !XIP_KERNEL --=20 2.39.5 From nobody Wed Dec 17 12:46:04 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0F4923DEBB; Tue, 10 Dec 2024 16:06:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733846806; cv=none; b=ImMCg5xhFpYr18ym4PfAlEarsfRvbOj/moBQsLA5P8zRq3fasfjvcHS4YA7ttAW0sEo2ifOmR01fJtyh5Os2EpatfeZOkzqt7FaRSbO2Swhv8aoB1YjvX1DJzing9/k3W14Yvi5kyDytB1rFo7l6GG+HY6n2AyGBdTGdHrBcVOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733846806; c=relaxed/simple; bh=wxcjY6Sxsaz2hTsZ9OLXJZ3XXXODa/UsYKOkty8coHs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ck86OacM2JXWX+n8UqXls98lxyTRCO9uFZYgpcQW+CJ90vFtY8mS6HuH/LwcVIOr0r0mIx83y8tQ+oHzIxTuynFBmG6vVjXJ921RLryuTCjiim2yHIrrXtIq2Ub5hg40B+D+JzrIk7rHtIQOF/pPZEHeNSNaHgm9vxrQadVLO3Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=M1E8oc1U; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="M1E8oc1U" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25C9DC4CEE2; Tue, 10 Dec 2024 16:06:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733846806; bh=wxcjY6Sxsaz2hTsZ9OLXJZ3XXXODa/UsYKOkty8coHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M1E8oc1U42hpuavRnkbvtANsKDn6k+Yz5tBBqHzq5EK5TUqUHa36DOjdsZtM9/Oah 7Ob9TQmtp+TOGUxnPtTmLmpIqpnNroAzwnwmKUX1z2y5QJwZPjTBumWMwxlbxrJQSL XoGjjYk7/bX9yNbgOjxxo7jOVri9x8edVaTFuojVFYs2+5qimV28MQOYmCOpDoZ2hZ 3WTBquHU2z6SE3hFNLNM85NRZOHnW3qjqYiCxnAFISoWZu2F1V4EvZJlQ1m0lTFihC 7qBKTrXhoKxEhKdX/7Db81ANvpyxEUk+sFfpsf2DdNRV2wLjIJfc+yFATv/VLswlTx xiIo205ZM9XMQ== From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , linux-mm@kvack.org, linux-rt-devel@lists.linux.dev, Ard Biesheuvel , Clark Williams , Jason Baron , Josh Poimboeuf , Linus Walleij , Mark Rutland , Matthew Wilcox , Peter Zijlstra , Russell King , Sebastian Andrzej Siewior , Steven Rostedt Subject: [PATCH 2/4] ARM: Disable HIGHPTE on PREEMPT_RT kernels Date: Tue, 10 Dec 2024 17:05:54 +0100 Message-Id: <20241210160556.2341497-3-arnd@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241210160556.2341497-1-arnd@kernel.org> References: <20241210160556.2341497-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Sebastian Andrzej Siewior gup_pgd_range() is invoked with disabled interrupts and invokes __kmap_local_page_prot() via pte_offset_map(), gup_p4d_range(). With HIGHPTE enabled, __kmap_local_page_prot() invokes kmap_high_get() which uses a spinlock_t via lock_kmap_any(). This leads to an sleeping-while-atomic error on PREEMPT_RT because spinlock_t becomes a sleeping lock and must not be acquired in atomic context. The loop in map_new_virtual() uses wait_queue_head_t for wake up which also is using a spinlock_t. Since HIGHPTE is rarely needed at all, turn it off for PREEMPT_RT to allow the use of get_user_pages_fast(). [arnd: rework patch to turn off HIGHPTE instead of HAVE_PAST_GUP] Signed-off-by: Sebastian Andrzej Siewior --- There is an open question about whether HIGHPTE is still needed at all, given how rare 32-bit machines with more than 4GB are on any architecture. If we instead decide to remove HIGHPTE altogether, this patch is no longer needed. --- arch/arm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index ed850cc0ed3c..4de4e5697bdf 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1231,7 +1231,7 @@ config HIGHMEM =20 config HIGHPTE bool "Allocate 2nd-level pagetables from highmem" if EXPERT - depends on HIGHMEM + depends on HIGHMEM && !PREEMPT_RT default y help The VM uses one page of physical memory for each page table. --=20 2.39.5 From nobody Wed Dec 17 12:46:04 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C8E322FE07; Tue, 10 Dec 2024 16:06:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733846810; cv=none; b=oaKf/nEjQeyFlSbUyobybywYP20FA/vMcFL8fSlxypkOb/+ZrhcpmXr/j8V5c4mxqf9AE9LXlxQDby/EAmgP4k6wUgFcQePCbbnXq5q7jPYPDwY9HNYVBNWj3OvUWKdiNH9VEmcTqVsqomqykQl2nDapQMsH8IMTxAkL3kwblaM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733846810; c=relaxed/simple; bh=IDAs66loD46ejrDZgcdhA2wj912kFUy5s0hoLSzyXSk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=c9ABv2zN7788WMftpTrPPU4jdL/2IctglHB5u1XOBNu+BzqZaSaZhUBaPwLlLZE/JLdee4Z/EOK0a4M6nXiba+8JbHfXchtapvH5GHBKnUeRx6928j3FASbh1TxQtzBy1IELDojGMXy9oxJjoSAgDxxHsdTNC7xgPAcjz7pJIEc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ADJHIkfi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ADJHIkfi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2AE5C4CEE1; Tue, 10 Dec 2024 16:06:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733846810; bh=IDAs66loD46ejrDZgcdhA2wj912kFUy5s0hoLSzyXSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ADJHIkfiTV0YsOu/HXMzwiS2RxR+5D0cCrNlcj00SQU1YljAfFMCaXaJUWQ2rdFOU iSq4zLD9LGm3Rf1r52f2jsvLRxJzbx4RHtht+B0YxK/e+1a1h1XYL9yntzNDQfQiSZ Z5x1beU4WJoE/X7BOoMoY//o1542eZPoiKgXvjzBiFVv4Ok1RdB5kWh7b1KHLRwzuJ mITMmSURfkPXvsQi08gl0RbQOPq87tCYfo9u81kCz3a8Z/pS/rAzarx8y7plmv+tHv W3QP4/mwCMHdaVN4qnm8tdWHIryJnxDxcvzoT7KBq3kTjX98PcHL4zfil8uaKsh099 cHaTRkEQ4+Nsw== From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , linux-mm@kvack.org, linux-rt-devel@lists.linux.dev, Ard Biesheuvel , Clark Williams , Jason Baron , Josh Poimboeuf , Linus Walleij , Mark Rutland , Matthew Wilcox , Peter Zijlstra , Russell King , Sebastian Andrzej Siewior , Steven Rostedt Subject: [PATCH 3/4] ARM: drop CONFIG_HIGHPTE support Date: Tue, 10 Dec 2024 17:05:55 +0100 Message-Id: <20241210160556.2341497-4-arnd@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241210160556.2341497-1-arnd@kernel.org> References: <20241210160556.2341497-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann CONFIG_HIGHPTE was added in linux-2.6.32, a few years before 64-bit support. At the time it made sense, as the CONFIG_ARM_LPAE option allowed systems with 16GB of memory that made lowmem a particularly scarce resource, and the HIGHPTE implementation gave feature parity with 32-bit x86 and frv machines. Since Arm is the last architecture remaining that uses this, and almost no 32-bit machines support more than 4GB of RAM, the cost of continuing to maintain HIGHPTE seems unjustified, so remove it here to allow simplifying the generic page table handling. Link: https://lore.kernel.org/lkml/20241204103042.1904639-8-arnd@kernel.org= /T/#u Signed-off-by: Arnd Bergmann Acked-by: Linus Walleij Acked-by: Sebastian Andrzej Siewior --- I sent a patch to drop HIGHPTE support on x86 today, see https://lore.kernel.org/lkml/20241210144945.2325330-9-arnd@kernel.org/T/#u If that one gets merged, we can merge this one instead of the one that makes HIGHPTE depend on !PREEMPT_RT, but if we decide against the x86 change, then we probably don't want this one either. --- arch/arm/Kconfig | 11 ----------- arch/arm/include/asm/pgalloc.h | 8 +------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 4de4e5697bdf..e132effafd8b 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1229,17 +1229,6 @@ config HIGHMEM =20 If unsure, say n. =20 -config HIGHPTE - bool "Allocate 2nd-level pagetables from highmem" if EXPERT - depends on HIGHMEM && !PREEMPT_RT - default y - help - The VM uses one page of physical memory for each page table. - For systems with a lot of processes, this can use a lot of - precious low memory, eventually leading to low memory being - consumed by page tables. Setting this option will allow - user-space 2nd level page tables to reside in high memory. - config ARM_PAN bool "Enable privileged no-access" depends on MMU diff --git a/arch/arm/include/asm/pgalloc.h b/arch/arm/include/asm/pgalloc.h index a17f01235c29..ef6cb3e6d179 100644 --- a/arch/arm/include/asm/pgalloc.h +++ b/arch/arm/include/asm/pgalloc.h @@ -85,18 +85,12 @@ pte_alloc_one_kernel(struct mm_struct *mm) return pte; } =20 -#ifdef CONFIG_HIGHPTE -#define PGTABLE_HIGHMEM __GFP_HIGHMEM -#else -#define PGTABLE_HIGHMEM 0 -#endif - static inline pgtable_t pte_alloc_one(struct mm_struct *mm) { struct page *pte; =20 - pte =3D __pte_alloc_one(mm, GFP_PGTABLE_USER | PGTABLE_HIGHMEM); + pte =3D __pte_alloc_one(mm, GFP_PGTABLE_USER); if (!pte) return NULL; if (!PageHighMem(pte)) --=20 2.39.5 From nobody Wed Dec 17 12:46:04 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A3C41A9B39; Tue, 10 Dec 2024 16:06:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733846814; cv=none; b=K9zRWlcU0gyQ6tLG9o1Vu5M7YzAv0BZo1jQDgsJuMmlEDadD89MigC0RmyUMd3bcmBnT1s/7ddCLja6ME5ZSVdgSpyT6BFyqIi6NfOIs3aapvgWL+pxgiBVc9QKbDyzJxp7S39NttvmZ5gZF9iF8+dstBrezOfd6QQVqJVeCTv8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733846814; c=relaxed/simple; bh=au+G63Alb5GCF/A9SMKFt0ffiADn8Kv5aULRnynJplQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ndQFtCoKPEYmur9WYOcTeCoarHB2AiPljGxw/qqwoWFI8buHipof3PUklvUpDtQUaBY+po/U986xZjwekhCoZA6CdeKlmr/BRxRdi/3gVEWR1UEicrnu3P1eqpJpbD5uiIhPPhPXRZA/y8wUZaizjqcetdvvs0gj+9B4RJNlcrY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DEjxcxD8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DEjxcxD8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 931B6C4CEE5; Tue, 10 Dec 2024 16:06:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733846814; bh=au+G63Alb5GCF/A9SMKFt0ffiADn8Kv5aULRnynJplQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DEjxcxD8oTx/TOiQj0A2f+JJWdp/WTkV38+nqMqbKqE7+bF6LG9S+6FdFjp6oYQtq rW1mfkcfhys/Emrwns6joq2JUc53T52CS463Zf/K5eFYzyYk7YjDEIVC4mkWw39m9j S6Z6Oqr/P1VJwWZx+FKYRsDQ6xsQzrgLqFnD+wTb1DLUo4Rj1JRdck87rev7uW6xSX mfsaWuEGPNNqdlX046i345AyLRdM8upKoU4Y31jGz7ADYX6irfh+RsIJEiaUdtPhbV 0Lh1SwNgDuIqEQjYvdRqYWOg3GV79ubzX6l4VsAKF47MKqP0JVWTeXepIEOL0Y7J6Q sQebOtMZyj6vg== From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , linux-mm@kvack.org, linux-rt-devel@lists.linux.dev, Ard Biesheuvel , Clark Williams , Jason Baron , Josh Poimboeuf , Linus Walleij , Mark Rutland , Matthew Wilcox , Peter Zijlstra , Russell King , Sebastian Andrzej Siewior , Steven Rostedt Subject: [PATCH 4/4] mm: drop HIGHPTE support altogether Date: Tue, 10 Dec 2024 17:05:56 +0100 Message-Id: <20241210160556.2341497-5-arnd@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241210160556.2341497-1-arnd@kernel.org> References: <20241210160556.2341497-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann With both x86 and arm having dropped CONFIG_HIGHPTE support, no architecture is left using it, so remove the remnants in common code. It is likely that further cleanups are possible in the page table code but those are not obvious from the config options. Signed-off-by: Arnd Bergmann Acked-by: Linus Walleij Acked-by: Sebastian Andrzej Siewior --- include/linux/hugetlb.h | 5 +---- include/linux/mm.h | 1 - include/linux/pgtable.h | 9 --------- 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index ae4fe8615bb6..5369a269dd39 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -176,7 +176,6 @@ extern struct list_head huge_boot_pages[MAX_NUMNODES]; =20 /* arch callbacks */ =20 -#ifndef CONFIG_HIGHPTE /* * pte_offset_huge() and pte_alloc_huge() are helpers for those architectu= res * which may go down to the lowest PTE level in their huge_pte_offset() and @@ -191,7 +190,6 @@ static inline pte_t *pte_alloc_huge(struct mm_struct *m= m, pmd_t *pmd, { return pte_alloc(mm, pmd) ? NULL : pte_offset_huge(pmd, address); } -#endif =20 pte_t *huge_pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long sz); @@ -966,9 +964,8 @@ static inline spinlock_t *huge_pte_lockptr(struct hstat= e *h, */ if (size >=3D PUD_SIZE) return pud_lockptr(mm, (pud_t *) pte); - else if (size >=3D PMD_SIZE || IS_ENABLED(CONFIG_HIGHPTE)) + else if (size >=3D PMD_SIZE) return pmd_lockptr(mm, (pmd_t *) pte); - /* pte_alloc_huge() only applies with !CONFIG_HIGHPTE */ return ptep_lockptr(mm, pte); } =20 diff --git a/include/linux/mm.h b/include/linux/mm.h index f56f81d5e244..6353fd939702 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2954,7 +2954,6 @@ static inline spinlock_t *pte_lockptr(struct mm_struc= t *mm, pmd_t *pmd) =20 static inline spinlock_t *ptep_lockptr(struct mm_struct *mm, pte_t *pte) { - BUILD_BUG_ON(IS_ENABLED(CONFIG_HIGHPTE)); BUILD_BUG_ON(MAX_PTRS_PER_PTE * sizeof(pte_t) > PAGE_SIZE); return ptlock_ptr(virt_to_ptdesc(pte)); } diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index adef9d6e9b1b..23be8776bd5e 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -119,14 +119,6 @@ static inline pte_t *pte_offset_kernel(pmd_t *pmd, uns= igned long address) #define pte_offset_kernel pte_offset_kernel #endif =20 -#ifdef CONFIG_HIGHPTE -#define __pte_map(pmd, address) \ - ((pte_t *)kmap_local_page(pmd_page(*(pmd))) + pte_index((address))) -#define pte_unmap(pte) do { \ - kunmap_local((pte)); \ - rcu_read_unlock(); \ -} while (0) -#else static inline pte_t *__pte_map(pmd_t *pmd, unsigned long address) { return pte_offset_kernel(pmd, address); @@ -135,7 +127,6 @@ static inline void pte_unmap(pte_t *pte) { rcu_read_unlock(); } -#endif =20 void pte_free_defer(struct mm_struct *mm, pgtable_t pgtable); =20 --=20 2.39.5