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


Groups > linux.kernel > #1457127

Re: [PATCH] x86/mm: disable preemption during CR3 read+write

From Rik van Riel <riel@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] x86/mm: disable preemption during CR3 read+write
Date 2016-08-05 16:40 +0200
Message-ID <s2Os1-i5-1@gated-at.bofh.it> (permalink)
References <s2NvX-89z-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Fri, 2016-08-05 at 15:37 +0200, Sebastian Andrzej Siewior wrote:
> 
> +++ b/arch/x86/include/asm/tlbflush.h
> @@ -135,7 +135,14 @@ static inline void
> cr4_set_bits_and_update_boot(unsigned long mask)
>  
>  static inline void __native_flush_tlb(void)
>  {
> +	/*
> +	 * if current->mm == NULL then we borrow a mm which may
> change during a
> +	 * task switch and therefore we must not be preempted while
> we write CR3
> +	 * back.
> +	 */
> +	preempt_disable();
>  	native_write_cr3(native_read_cr3());
> +	preempt_enable();
>  }

That is one subtle race!

Acked-by: Rik van Riel <riel@redhat.com>

-- 

All Rights Reversed.

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


Thread

[PATCH] x86/mm: disable preemption during CR3 read+write Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-05 15:40 +0200
  Re: [PATCH] x86/mm: disable preemption during CR3 read+write Peter Zijlstra <peterz@infradead.org> - 2016-08-05 16:00 +0200
  Re: [PATCH] x86/mm: disable preemption during CR3 read+write Rik van Riel <riel@redhat.com> - 2016-08-05 16:40 +0200
  Re: [PATCH] x86/mm: disable preemption during CR3 read+write Andy Lutomirski <luto@amacapital.net> - 2016-08-05 17:50 +0200
    Re: [PATCH] x86/mm: disable preemption during CR3 read+write Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-05 18:00 +0200
  [tip:x86/urgent] x86/mm: Disable preemption during CR3 read+write tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-08-10 23:00 +0200

csiph-web