lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20241119163035.985203915@infradead.org>
Date: Tue, 19 Nov 2024 17:25:34 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: x86@...nel.org, "To:riel"@surriel.com
Cc: linux-kernel@...r.kernel.org,
 peterz@...radead.org,
 Andy Lutomirski <luto@...nel.org>
Subject: [PATCH 7/7] x86/mm: Opt in to IRQs-off activate_mm()

From: Andy Lutomirski <luto@...nel.org>

We gain nothing by having the core code enable IRQs right before calling
activate_mm() only for us to turn them right back off again in switch_mm().

This will save a few cycles, so execve() should be blazingly fast with this
patch applied!

Signed-off-by: Andy Lutomirski <luto@...nel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Link: https://lkml.kernel.org/r/69c7d711f240cfec23e6024e940d31af2990db36.1641659630.git.luto@kernel.org
---
 arch/x86/Kconfig                   |    1 +
 arch/x86/include/asm/mmu_context.h |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6/arch/x86/Kconfig
===================================================================
--- linux-2.6.orig/arch/x86/Kconfig
+++ linux-2.6/arch/x86/Kconfig
@@ -133,6 +133,7 @@ config X86
 	select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP	if X86_64
 	select ARCH_WANTS_THP_SWAP		if X86_64
 	select ARCH_HAS_PARANOID_L1D_FLUSH
+	select ARCH_WANT_IRQS_OFF_ACTIVATE_MM
 	select BUILDTIME_TABLE_SORT
 	select CLKEVT_I8253
 	select CLOCKSOURCE_VALIDATE_LAST_CYCLE
Index: linux-2.6/arch/x86/include/asm/mmu_context.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/mmu_context.h
+++ linux-2.6/arch/x86/include/asm/mmu_context.h
@@ -175,7 +175,7 @@ extern void switch_mm_irqs_off(struct mm
 #define activate_mm(prev, next)			\
 do {						\
 	paravirt_enter_mmap(next);		\
-	switch_mm((prev), (next), NULL);	\
+	switch_mm_irqs_off((prev), (next), NULL);	\
 } while (0);
 
 #ifdef CONFIG_X86_32



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ