Re: kvm vmload/vmsave vs tss.ist

From: Avi Kivity
Date: Thu Dec 25 2008 - 13:20:23 EST


Avi Kivity wrote:

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.


On the other hand, checking %rsp allows us to drop irqcount completely, so maybe it's better.

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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/