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-next>] [day] [month] [year] [list]
Date:	Sat, 30 Aug 2008 12:20:12 +0200
From:	Andi Kleen <andi@...stfloor.org>
To:	x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] Avoid double flush in do_tlb_flush_all()

Avoid double flush in do_tlb_flush_all()

leave_mm already flushes the TLBs, so don't need to flush directly before that
in do_flush_tlb_all(). Avoid the double flush.

Pointed out by Rainer Weikusat

Signed-off-by: Andi Kleen <ak@...ux.intel.com>

---
 arch/x86/kernel/tlb_32.c |    5 ++---
 arch/x86/kernel/tlb_64.c |    7 +++----
 2 files changed, 5 insertions(+), 7 deletions(-)

Index: linux-2.6.27-rc4-misc/arch/x86/kernel/tlb_32.c
===================================================================
--- linux-2.6.27-rc4-misc.orig/arch/x86/kernel/tlb_32.c
+++ linux-2.6.27-rc4-misc/arch/x86/kernel/tlb_32.c
@@ -229,11 +229,10 @@ EXPORT_SYMBOL(flush_tlb_page);
 
 static void do_flush_tlb_all(void *info)
 {
-	unsigned long cpu = smp_processor_id();
-
-	__flush_tlb_all();
 	if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_LAZY)
 		leave_mm(cpu);
+	else
+		__flush_tlb_all(smp_processor_id());
 }
 
 void flush_tlb_all(void)
Index: linux-2.6.27-rc4-misc/arch/x86/kernel/tlb_64.c
===================================================================
--- linux-2.6.27-rc4-misc.orig/arch/x86/kernel/tlb_64.c
+++ linux-2.6.27-rc4-misc/arch/x86/kernel/tlb_64.c
@@ -266,11 +266,10 @@ void flush_tlb_page(struct vm_area_struc
 
 static void do_flush_tlb_all(void *info)
 {
-	unsigned long cpu = smp_processor_id();
-
-	__flush_tlb_all();
 	if (read_pda(mmu_state) == TLBSTATE_LAZY)
-		leave_mm(cpu);
+		leave_mm(smp_processor_id());
+	else
+		__flush_tlb_all();
 }
 
 void flush_tlb_all(void)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ