public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Andi Kleen <andi@firstfloor.org>,
	mingo@elte.hu, akpm@osdl.org, "H. Peter Anvin" <hpa@zytor.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	"Frank Ch. Eigler" <fche@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] x86 NMI-safe INT3 and Page Fault (v7)
Date: Sun, 20 Apr 2008 08:10:28 +1000	[thread overview]
Message-ID: <480A6DD4.8050702@goop.org> (raw)
In-Reply-To: <20080419212937.GA2831@Krystal>

Mathieu Desnoyers wrote:
> * Jeremy Fitzhardinge (jeremy@goop.org) wrote:
>   
>> Mathieu Desnoyers wrote:
>>     
>>> +/*
>>> + * Only returns from a trap or exception to a NMI context 
>>> (intra-privilege
>>> + * level near return) to the same SS and CS segments. Should be used
>>> + * upon trap or exception return when nested over a NMI context so no 
>>> iret is
>>> + * issued. It takes care of modifying the eflags, rsp and returning to 
>>> the
>>> + * previous function.
>>> + *
>>> + * The stack, at that point, looks like :
>>> + *
>>> + * 0(rsp)  RIP
>>> + * 8(rsp)  CS
>>> + * 16(rsp) EFLAGS
>>> + * 24(rsp) RSP
>>> + * 32(rsp) SS
>>> + *
>>> + * Upon execution :
>>> + * Copy EIP to the top of the return stack
>>> + * Update top of return stack address
>>> + * Pop eflags into the eflags register
>>> + * Make the return stack current
>>> + * Near return (popping the return address from the return stack)
>>> + */
>>> +#define INTERRUPT_RETURN_NMI_SAFE	pushq %rax;		\
>>> +					mov %rsp, %rax;		\
>>> +					mov 24+8(%rax), %rsp;	\
>>> +					pushq 0+8(%rax);	\
>>> +					pushq 16+8(%rax);	\
>>> +					movq (%rax), %rax;	\
>>> +					popfq;			\
>>> +					ret;
>>>   
>>>       
>> I got this right first go?  I must be getting good at this...
>>
>>     
>
> Yes, it looked good to me at least :)
>
>   
>> Anyway, trailing ';', and perhaps use a consistent form for mov (either 
>> movq or mov in all three instances).
>>
>>     
>
> Ok, fixed. Here is the update.
>
> The last issue standing would be the paravirt code. Any ideas about how
> it's best to do it ? It would be good to be able to get the nmi-safe
> version on bare metal, patched with a standard iret emulation in
> paravirt code.
>   

#ifdef CONFIG_PARAVIRT
#define NMI_RETURN   paravirt_nmi_return

/* elsewhere */
    .nmi_return = native_iret_nmi_return;
#else
#define NMI_RETURN   NMI_SAFE_NMI_RETURN
#endif

?

    J

  reply	other threads:[~2008-04-19 22:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-17 16:41 [RFC PATCH] x86 NMI-safe INT3 and Page Fault (v4) Mathieu Desnoyers
2008-04-18 10:04 ` Jeremy Fitzhardinge
2008-04-19 21:29   ` [RFC PATCH] x86 NMI-safe INT3 and Page Fault (v7) Mathieu Desnoyers
2008-04-19 22:10     ` Jeremy Fitzhardinge [this message]
2008-04-19 22:40       ` Mathieu Desnoyers
2008-04-20  0:33       ` [RFC PATCH] x86 NMI-safe INT3 and Page Fault (v8) Mathieu Desnoyers
2008-04-20 19:02         ` [RFC PATCH] x86 NMI-safe INT3 and Page Fault (v9) Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=480A6DD4.8050702@goop.org \
    --to=jeremy@goop.org \
    --cc=akpm@osdl.org \
    --cc=andi@firstfloor.org \
    --cc=fche@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox