From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759812AbcHENxQ (ORCPT ); Fri, 5 Aug 2016 09:53:16 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:51613 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753776AbcHENxP (ORCPT ); Fri, 5 Aug 2016 09:53:15 -0400 Date: Fri, 5 Aug 2016 15:53:08 +0200 From: Peter Zijlstra To: Sebastian Andrzej Siewior Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, x86@kernel.org, Borislav Petkov , Andy Lutomirski , Rik van Riel , Mel Gorman Subject: Re: [PATCH] x86/mm: disable preemption during CR3 read+write Message-ID: <20160805135308.GT6879@twins.programming.kicks-ass.net> References: <1470404259-26290-1-git-send-email-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1470404259-26290-1-git-send-email-bigeasy@linutronix.de> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 05, 2016 at 03:37:39PM +0200, Sebastian Andrzej Siewior wrote: > diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h > index 4e5be94e079a..1ee065954e24 100644 > --- a/arch/x86/include/asm/tlbflush.h > +++ 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(); > } Acked-by: Peter Zijlstra (Intel) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f70.google.com (mail-pa0-f70.google.com [209.85.220.70]) by kanga.kvack.org (Postfix) with ESMTP id 685B0828E1 for ; Fri, 5 Aug 2016 11:34:37 -0400 (EDT) Received: by mail-pa0-f70.google.com with SMTP id le9so93203223pab.0 for ; Fri, 05 Aug 2016 08:34:37 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id tu4si20568911pac.261.2016.08.05.06.53.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Aug 2016 06:53:12 -0700 (PDT) Date: Fri, 5 Aug 2016 15:53:08 +0200 From: Peter Zijlstra Subject: Re: [PATCH] x86/mm: disable preemption during CR3 read+write Message-ID: <20160805135308.GT6879@twins.programming.kicks-ass.net> References: <1470404259-26290-1-git-send-email-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1470404259-26290-1-git-send-email-bigeasy@linutronix.de> Sender: owner-linux-mm@kvack.org List-ID: To: Sebastian Andrzej Siewior Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, x86@kernel.org, Borislav Petkov , Andy Lutomirski , Rik van Riel , Mel Gorman On Fri, Aug 05, 2016 at 03:37:39PM +0200, Sebastian Andrzej Siewior wrote: > diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h > index 4e5be94e079a..1ee065954e24 100644 > --- a/arch/x86/include/asm/tlbflush.h > +++ 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(); > } Acked-by: Peter Zijlstra (Intel) -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org