Re: [PATCH 3/4] KVM: x86: inject nested page faults on emulated instructions

2014-09-05 Thread Gleb Natapov
On Thu, Sep 04, 2014 at 07:44:51PM +0200, Paolo Bonzini wrote: Il 04/09/2014 17:05, Gleb Natapov ha scritto: If you do that, KVM gets down to the if (writeback) and writes the ctxt-eip from L2 into the L1 EIP. Heh, that's a bummer. We should not write back if an instruction caused a

Re: [PATCH 3/4] KVM: x86: inject nested page faults on emulated instructions

2014-09-04 Thread Gleb Natapov
On Tue, Sep 02, 2014 at 05:13:49PM +0200, Paolo Bonzini wrote: This is required for the following patch to work correctly. If a nested page fault happens during emulation, we must inject a vmexit, not a page fault. Luckily we already have the required machinery: it is enough to return

Re: [PATCH 3/4] KVM: x86: inject nested page faults on emulated instructions

2014-09-04 Thread Paolo Bonzini
of treating nested page faults like other nested vmexits during emulation (which is what this patch does). If I included this patch, I could then remove kvm_propagate_fault like (I think) this: diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 92493e10937c..e096db566ac2 100644 --- a/arch

Re: [PATCH 3/4] KVM: x86: inject nested page faults on emulated instructions

2014-09-04 Thread Gleb Natapov
-arch.pio.in) { /* FIXME: return into emulator if single-stepping. */ But I'm not sure how to test it, and I like the idea of treating nested page faults like other nested vmexits during emulation (which is what this patch does). IMO exits due to instruction intercept

Re: [PATCH 3/4] KVM: x86: inject nested page faults on emulated instructions

2014-09-04 Thread Paolo Bonzini
Il 04/09/2014 17:05, Gleb Natapov ha scritto: if (ctxt-have_exception) { inject_emulated_exception(vcpu); - r = EMULATE_DONE; + return EMULATE_DONE; If there was no vmexit we still want to writeback. Perhaps: writeback =

Re: [PATCH 3/4] KVM: x86: inject nested page faults on emulated instructions

2014-09-04 Thread Paolo Bonzini
Il 04/09/2014 17:05, Gleb Natapov ha scritto: If you do that, KVM gets down to the if (writeback) and writes the ctxt-eip from L2 into the L1 EIP. Heh, that's a bummer. We should not write back if an instruction caused a vmexit. You're right, that works. Paolo -- 8

[PATCH 3/4] KVM: x86: inject nested page faults on emulated instructions

2014-09-02 Thread Paolo Bonzini
This is required for the following patch to work correctly. If a nested page fault happens during emulation, we must inject a vmexit, not a page fault. Luckily we already have the required machinery: it is enough to return X86EMUL_INTERCEPTED instead of X86EMUL_PROPAGATE_FAULT. Reported-by:

[PATCH 0/4] KVM: nested x86: nested page faults fixes

2014-09-02 Thread Paolo Bonzini
and nested EPT/NPT, which was reported by Valentine. Reviews are very welcome, I'm walking on thin ice here... Paolo Paolo Bonzini (4): KVM: x86: reserve bit 8 of non-leaf PDPEs and PML4Es in 64-bit mode on AMD KVM: nSVM: propagate the NPF EXITINFO to the guest KVM: x86: inject nested page

Re: [PATCH 0/4] KVM: nested x86: nested page faults fixes

2014-09-02 Thread Valentine Sinitsyn
Hi Paolo, On 02.09.2014 21:13, Paolo Bonzini wrote: Patches 3 and 4 fix the interaction between emulator and nested EPT/NPT, which was reported by Valentine. I can confirm the initial bug I observed is fixed with these patches (applied to 3.16.1). All tests in kvm-unit-test's master also

Re: [PATCH 0/4] KVM: nested x86: nested page faults fixes

2014-09-02 Thread Paolo Bonzini
Il 02/09/2014 18:02, Valentine Sinitsyn ha scritto: I can confirm the initial bug I observed is fixed with these patches (applied to 3.16.1). All tests in kvm-unit-test's master also pass, except for ioio which is (probably) affected by another (unrelated) bug fixed by Jan back in June but

Re: Nested Page Faults

2010-05-15 Thread Joerg Roedel
] = pf_interception, Which ends up in tdp_page_fault(). This function calls the generic __direct_map() handler (that is used for real-mode paging too). Note that nested page faults are different from guest page faults. Guest page faults occur for guest virtual addresses (and are handled

Nested Page Faults

2010-05-14 Thread Matteo Signorini
Hi to all, I am working on NPT and have some doubts. Please correct me if I am wrong, In NPT only the first time a page fault happens it is trapped by the host. The following page faults are not trapped by the host in order to reduce page walk overhead. My question is... Which Kvm function

Re: Nested Page Faults

2010-05-14 Thread Alexander Graf
On 14.05.2010, at 15:15, Matteo Signorini wrote: Hi to all, I am working on NPT and have some doubts. Please correct me if I am wrong, In NPT only the first time a page fault happens it is trapped by the host. The following page faults are not trapped by the host in order to reduce