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


Groups > linux.kernel > #1465701 > unrolled thread

Question: Outer NMI can nest if from user mode?

Started bySteven Rostedt <rostedt@goodmis.org>
First post2016-08-19 03:10 +0200
Last post2016-08-19 03:50 +0200
Articles 3 — 1 participant

Back to article view | Back to linux.kernel


Contents

  Question: Outer NMI can nest if from user mode? Steven Rostedt <rostedt@goodmis.org> - 2016-08-19 03:10 +0200
    Re: Question: Outer NMI can nest if from user mode? Steven Rostedt <rostedt@goodmis.org> - 2016-08-19 03:40 +0200
    Re: Question: Outer NMI can nest if from user mode? Steven Rostedt <rostedt@goodmis.org> - 2016-08-19 03:50 +0200

#1465701 — Question: Outer NMI can nest if from user mode?

FromSteven Rostedt <rostedt@goodmis.org>
Date2016-08-19 03:10 +0200
SubjectQuestion: Outer NMI can nest if from user mode?
Message-ID<s7GtQ-7go-13@gated-at.bofh.it>
Hi Andy,

I was reading some of the comments in nmi.c and came across this:

/*
 * NMIs can page fault or hit breakpoints which will cause it to lose
 * its NMI context with the CPU when the breakpoint or page fault does an IRET.
 *
 * As a result, NMIs can nest if NMIs get unmasked due an IRET during
 * NMI processing.  On x86_64, the asm glue protects us from nested NMIs
 * if the outer NMI came from kernel mode, but we can still nest if the
 * outer NMI came from user mode.


What confuses me is "but we can still nest if the outer NMI came from
user mode".

How can that happen? You mean do_nmi() can be called nested even on
x86_64 if the first NMI happened in user mode?

-- Steve

[toc] | [next] | [standalone]


#1465809

FromSteven Rostedt <rostedt@goodmis.org>
Date2016-08-19 03:40 +0200
Message-ID<s7GWS-7sc-35@gated-at.bofh.it>
In reply to#1465701
On Thu, 18 Aug 2016 11:48:45 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> 9b6e6a8334d56 x86/nmi/64: Switch stacks on userspace NMI entry
> 
> Which switches the stack to the kernel stack from the NMI stack if we
> came from user mode. That explains how the asm glue wont catch it.

In my own defense, the commit that added the comment came before the
stack switch commit, making the comment incorrect at the time it was
added ;-)

-- Steve

[toc] | [prev] | [next] | [standalone]


#1465847

FromSteven Rostedt <rostedt@goodmis.org>
Date2016-08-19 03:50 +0200
Message-ID<s7GWS-7sc-37@gated-at.bofh.it>
In reply to#1465701
On Thu, 18 Aug 2016 11:21:55 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> Hi Andy,
> 
> I was reading some of the comments in nmi.c and came across this:
> 
> /*
>  * NMIs can page fault or hit breakpoints which will cause it to lose
>  * its NMI context with the CPU when the breakpoint or page fault does an IRET.
>  *
>  * As a result, NMIs can nest if NMIs get unmasked due an IRET during
>  * NMI processing.  On x86_64, the asm glue protects us from nested NMIs
>  * if the outer NMI came from kernel mode, but we can still nest if the
>  * outer NMI came from user mode.
> 
> 
> What confuses me is "but we can still nest if the outer NMI came from
> user mode".
> 
> How can that happen? You mean do_nmi() can be called nested even on
> x86_64 if the first NMI happened in user mode?

Never mind. Jiri pointed out this patch (which I forgot about :-p)

9b6e6a8334d56 x86/nmi/64: Switch stacks on userspace NMI entry

Which switches the stack to the kernel stack from the NMI stack if we
came from user mode. That explains how the asm glue wont catch it.


-- Steve

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web