On 09/04/20 17:03, Andy Lutomirski wrote:
No, I think we wouldn't use a paravirt #VE at this point, we would use the real thing if available.
It would still be possible to switch from the IST to the main kernel stack before writing 0 to the reentrancy word.
Almost but not quite. We do this for NMI-from-usermode, and it’s ugly. But we can’t do this for NMI-from-kernel or #VE-from-kernel because there might not be a kernel stack. Trying to hack around this won’t be pretty.
Frankly, I think that we shouldn’t even try to report memory failure to the guest if it happens with interrupts off. Just kill the guest cleanly and keep it simple. Or inject an intentionally unrecoverable IST exception.
But it would be nice to use #VE for all host-side page faults, not just for memory failure.
So the solution would be the same as for NMIs, duplicating the stack frame and patching the outer handler's stack from the recursive #VE (https://lwn.net/Articles/484932/). It's ugly but it's a known ugliness.
Paolo