Re: [PATCH 4/7] KVM: nVMX: move inject_page_fault tweak to .complete_mmu_init

2021-02-18 Thread Paolo Bonzini
On 17/02/21 19:43, Maxim Levitsky wrote: 1. npt/ept disabled in the host. In this case we have a single shadowing and a nested hypervisor has to do its own shadowing on top of it. In this case the MMU itself has to generate page faults (they are a result of hardware page faults, but are completel

Re: [PATCH 4/7] KVM: nVMX: move inject_page_fault tweak to .complete_mmu_init

2021-02-17 Thread Maxim Levitsky
On Wed, 2021-02-17 at 18:37 +0100, Paolo Bonzini wrote: > On 17/02/21 18:29, Sean Christopherson wrote: > > All that being said, I'm pretty we can eliminate setting > > inject_page_fault dynamically. I think that would yield more > > maintainable code. Following these flows is a nightmare. The ch

Re: [PATCH 4/7] KVM: nVMX: move inject_page_fault tweak to .complete_mmu_init

2021-02-17 Thread Maxim Levitsky
On Wed, 2021-02-17 at 09:29 -0800, Sean Christopherson wrote: > On Wed, Feb 17, 2021, Maxim Levitsky wrote: > > This fixes a (mostly theoretical) bug which can happen if ept=0 > > on host and we run a nested guest which triggers a mmu context > > reset while running nested. > > In this case the .in

Re: [PATCH 4/7] KVM: nVMX: move inject_page_fault tweak to .complete_mmu_init

2021-02-17 Thread Paolo Bonzini
On 17/02/21 18:57, Sean Christopherson wrote: That said, I'm also rusty on_why_ this code is needed. Why isn't it enough to inject the exception normally, and let nested_vmx_check_exception decide whether to inject a vmexit to L1 or an exception into L2? Hmm, I suspect it was required at one

Re: [PATCH 4/7] KVM: nVMX: move inject_page_fault tweak to .complete_mmu_init

2021-02-17 Thread Sean Christopherson
On Wed, Feb 17, 2021, Paolo Bonzini wrote: > On 17/02/21 18:29, Sean Christopherson wrote: > > All that being said, I'm pretty we can eliminate setting > > inject_page_fault dynamically. I think that would yield more > > maintainable code. Following these flows is a nightmare. The change > > itself

Re: [PATCH 4/7] KVM: nVMX: move inject_page_fault tweak to .complete_mmu_init

2021-02-17 Thread Paolo Bonzini
On 17/02/21 18:29, Sean Christopherson wrote: All that being said, I'm pretty we can eliminate setting inject_page_fault dynamically. I think that would yield more maintainable code. Following these flows is a nightmare. The change itself will be scarier, but I'm pretty sure the end result will

Re: [PATCH 4/7] KVM: nVMX: move inject_page_fault tweak to .complete_mmu_init

2021-02-17 Thread Sean Christopherson
On Wed, Feb 17, 2021, Maxim Levitsky wrote: > This fixes a (mostly theoretical) bug which can happen if ept=0 > on host and we run a nested guest which triggers a mmu context > reset while running nested. > In this case the .inject_page_fault callback will be lost. > > Signed-off-by: Maxim Levitsky

[PATCH 4/7] KVM: nVMX: move inject_page_fault tweak to .complete_mmu_init

2021-02-17 Thread Maxim Levitsky
This fixes a (mostly theoretical) bug which can happen if ept=0 on host and we run a nested guest which triggers a mmu context reset while running nested. In this case the .inject_page_fault callback will be lost. Signed-off-by: Maxim Levitsky --- arch/x86/kvm/vmx/nested.c | 8 +--- arch/x86