lkml.org 
[lkml]   [2008]   [Dec]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: kvm vmload/vmsave vs tss.ist
Ingo Molnar wrote:
>> I think it's enough to switch %rsp before incrementing irqcount, no?
>>
>
> no - that would introduce a small race: if an exception (say an NMI or
> MCE, or a debug trap) happens in that small window then the exception
> context thinks that it's on the IRQ stack already, and would use the task
> stack.
>
>

I'm suggesting

check irqcount
if (wasnt_in_irq)
rsp = irqstack
++irqcount

If the NMI happens before the increment, we'll switch the stack
unconditionally, and if the NMI happens after the increment, then we
won't switch the stack, but we're guaranteed to be on the irqstack
anyway. The window size is negative :)

Similarly, the exit path should be

oldstack_reg = oldstack;
--irqcount;
rsp = oldstack_register;

To guarantee that by the time we decrement irqcount, we don't need the
stack anymore.

--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.



\
 
 \ /
  Last update: 2008-12-25 19:21    [W:0.059 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site