On 2013-03-03 20:15, Nadav Har'El wrote: > On Sun, Mar 03, 2013, Jan Kiszka wrote about "[PATCH] KVM: nVMX: Reset RFLAGS on VM-exit": >> From: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> >> >> Ouch, how could this work so well that far? We need to clear RFLAGS to >> the reset value as specified by the SDM. Particularly, IF must be off >> after VM-exit! > > nested_vmx_succeed() or nested_vmx_fail*() were already clearing some of > the fields that I understood was necessary to clear. But they did not clear > the IF - I never realised (and didn't verify now) that this is part of the > spec. And since L1 KVM anyways enters L2 with interrupts disabled, nested KVM > would not see a difference. But we didn't restore rflags on vmexit either, we reused the guest value for L1. It was pure luck (and due to KVM's short IRQ-off phase after vmexit) when things worked. But I bet this should fix some spurious issues. > >> + vmx_set_rflags(vcpu, 0x02); > > There's a macro X86_EFLAGS_BIT1 which you can use for this 0x02. Ah, good to know. Checked vmx_vcpu_reset and found this value. Jan
Attachment:
signature.asc
Description: OpenPGP digital signature