[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1337761940.13348.138.camel@gandalf.stny.rr.com>
Date: Wed, 23 May 2012 04:32:20 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Brian Gerst <brgerst@...il.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Avi Kivity <avi@...hat.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...e.hu>, "H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Paul Turner <pjt@...gle.com>,
Peter Zijlstra <peterz@...radead.org>,
Frederic Weisbecker <fweisbec@...il.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Subject: Re: NMI vs #PF clash
On Tue, 2012-05-22 at 21:26 -0400, Brian Gerst wrote:
> > @@ -1734,6 +1748,13 @@ end_repeat_nmi:
> > nmi_swapgs:
> > SWAPGS_UNSAFE_STACK
> > nmi_restore:
> > + /* Test if the cr2 reg changed */
> > + movq ORIG_RAX-R15+(12*8)(%rsp), %rdx
> > + movq %cr2, %rcx
> > + cmp %rdx, %rcx
> > + je 1f
> > + movq %rdx, %cr2
> > +1:
> > RESTORE_ALL 8
> > /* Clear the NMI executing stack variable */
> > movq $0, 10*8(%rsp)
>
> You could save cr2 in a callee-saved register (like r12) instead of
> putting it on the stack.
>
You know, I thought about that but decided against it. My rational was
that I wanted the store of the cr2 in the first NMI where it would do it
again if it had to do a repeated NMI. At first I thought that a repeated
NMI would corrupt the cr2, but that is not the case as the cr2 would
have been restored before repeating the NMI.
I guess I also wanted to limit the number of reads of the cr2 as well.
But as repeated NMIs is such a seldom case (requires a fault and then
another NMI to come in), that this optimization is practically useless.
I agree, it would be better to just use one of the non-clobbered regs.
Thanks, I'll try that out and this should make the patch much simpler.
-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists