Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934894Ab0GOW12 (ORCPT ); Thu, 15 Jul 2010 18:27:28 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:35004 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934086Ab0GOW11 (ORCPT ); Thu, 15 Jul 2010 18:27:27 -0400 MIME-Version: 1.0 In-Reply-To: References: <20100714203940.GC22096@Krystal> <20100714222115.GA30122@Krystal> <20100715183153.GA9276@Krystal> <20100715220117.GA1499@Krystal> Date: Thu, 15 Jul 2010 15:26:51 -0700 Message-ID: Subject: Re: [patch 1/2] x86_64 page fault NMI-safe From: Linus Torvalds To: Mathieu Desnoyers Cc: LKML , Andrew Morton , Ingo Molnar , Peter Zijlstra , Steven Rostedt , Steven Rostedt , Frederic Weisbecker , Thomas Gleixner , Christoph Hellwig , Li Zefan , Lai Jiangshan , Johannes Berg , Masami Hiramatsu , Arnaldo Carvalho de Melo , Tom Zanussi , KOSAKI Motohiro , Andi Kleen , "H. Peter Anvin" , Jeremy Fitzhardinge , "Frank Ch. Eigler" , Tejun Heo Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1188 Lines: 28 On Thu, Jul 15, 2010 at 3:16 PM, Linus Torvalds wrote: > > Then you could in fact possibly test the stack pointer for whether it > is in the NMI stack area, and use the value of %rsp itself as the > flag. So you could avoid the flag entirely. Because testing %rsp is > valid - testing %rip is not. > > That would also avoid the race, because %rsp (as a flag) now gets > cleared atomically by the "iret". So that might actually solve things. Hmm. So on x86-32, it's easy: if the NMI is nested, you can literally look at the current %rsp value, and see if it's within the NMI stack region. But on x86-64, due to IST, you need to look at the saved-rsp value on the stack, since the %rsp always gets reset to the NMI stack region regardless of where it was before. Why do we force IST use for NMI, btw? Maybe we shouldn't, and just use the normal kernel stack mechanisms? Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/