Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1305071

[RFC 09/13] x86/mm: Disable interrupts when flushing the TLB using CR3

From Andy Lutomirski <luto@kernel.org>
Newsgroups linux.kernel
Subject [RFC 09/13] x86/mm: Disable interrupts when flushing the TLB using CR3
Date 2016-01-09 00:20 +0100
Message-ID <qOOu6-5ka-29@gated-at.bofh.it> (permalink)
References <qOOu6-5ka-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
 arch/x86/include/asm/tlbflush.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h
index 3d905f12cda9..32e3d8769a22 100644
--- a/arch/x86/include/asm/tlbflush.h
+++ b/arch/x86/include/asm/tlbflush.h
@@ -135,7 +135,17 @@ static inline void cr4_set_bits_and_update_boot(unsigned long mask)
 
 static inline void __native_flush_tlb(void)
 {
+	unsigned long flags;
+
+	/*
+	 * We mustn't be preempted or handle an IPI while reading and
+	 * writing CR3.  Preemption could switch mms and switch back, and
+	 * an IPI could call leave_mm.  Either of those could cause our
+	 * PCID to change asynchronously.
+	 */
+	raw_local_irq_save(flags);
 	native_write_cr3(native_read_cr3());
+	raw_local_irq_restore(flags);
 }
 
 static inline void __native_flush_tlb_global_irq_disabled(void)
-- 
2.5.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[RFC 09/13] x86/mm: Disable interrupts when flushing the TLB using CR3 Andy Lutomirski <luto@kernel.org> - 2016-01-09 00:20 +0100
  Re: [RFC 09/13] x86/mm: Disable interrupts when flushing the TLB  using CR3 Linus Torvalds <torvalds@linux-foundation.org> - 2016-01-09 00:50 +0100
    Re: [RFC 09/13] x86/mm: Disable interrupts when flushing the TLB  using CR3 Andy Lutomirski <luto@amacapital.net> - 2016-01-09 01:20 +0100
      Re: [RFC 09/13] x86/mm: Disable interrupts when flushing the TLB  using CR3 Linus Torvalds <torvalds@linux-foundation.org> - 2016-01-09 03:30 +0100
        Re: [RFC 09/13] x86/mm: Disable interrupts when flushing the TLB  using CR3 Ingo Molnar <mingo@kernel.org> - 2016-01-11 12:00 +0100
          Re: [RFC 09/13] x86/mm: Disable interrupts when flushing the TLB  using CR3 Andy Lutomirski <luto@amacapital.net> - 2016-01-14 00:40 +0100
        Re: [RFC 09/13] x86/mm: Disable interrupts when flushing the TLB  using CR3 Andy Lutomirski <luto@amacapital.net> - 2016-01-14 00:40 +0100
          Re: [RFC 09/13] x86/mm: Disable interrupts when flushing the TLB  using CR3 Dave Hansen <dave.hansen@linux.intel.com> - 2016-01-14 00:50 +0100
            Re: [RFC 09/13] x86/mm: Disable interrupts when flushing the TLB  using CR3 Dave Hansen <dave.hansen@linux.intel.com> - 2016-01-14 01:00 +0100
              Re: [RFC 09/13] x86/mm: Disable interrupts when flushing the TLB  using CR3 Andy Lutomirski <luto@amacapital.net> - 2016-01-14 01:40 +0100
            Re: [RFC 09/13] x86/mm: Disable interrupts when flushing the TLB  using CR3 Andy Lutomirski <luto@amacapital.net> - 2016-01-14 01:00 +0100

csiph-web