diff mbox series

[RFC] KVM: VMX: Always sync CR3 to VMCS in nested_vmx_load_cr3

Message ID 20190926140541.15453-2-reet@codelabs.ch (mailing list archive)
State New, archived
Headers show
Series KVM: VMX: Always sync CR3 to VMCS in nested_vmx_load_cr3 | expand

Commit Message

Reto Buerki Sept. 26, 2019, 2:05 p.m. UTC
Required to make a Muen system work on KVM nested.

Signed-off-by: Reto Buerki <reet@codelabs.ch>
---
 arch/x86/kvm/vmx/nested.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Sean Christopherson Sept. 26, 2019, 6:38 p.m. UTC | #1
On Thu, Sep 26, 2019 at 04:05:41PM +0200, Reto Buerki wrote:
> Required to make a Muen system work on KVM nested.
> 
> Signed-off-by: Reto Buerki <reet@codelabs.ch>
> ---
>  arch/x86/kvm/vmx/nested.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index 41abc62c9a8a..101b2c0c8480 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -1008,6 +1008,8 @@ static int nested_vmx_load_cr3(struct kvm_vcpu *vcpu, unsigned long cr3, bool ne
>  		}
>  	}
>  
> +	vmcs_writel(GUEST_CR3, cr3);

This isn't wrong, but it's not the most precise fix.  I've figured out
what's going awry, in the process of determining how best to fix the issue.

> +
>  	if (!nested_ept)
>  		kvm_mmu_new_cr3(vcpu, cr3, false);
>  
> -- 
> 2.20.1
>
diff mbox series

Patch

diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 41abc62c9a8a..101b2c0c8480 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -1008,6 +1008,8 @@  static int nested_vmx_load_cr3(struct kvm_vcpu *vcpu, unsigned long cr3, bool ne
 		}
 	}
 
+	vmcs_writel(GUEST_CR3, cr3);
+
 	if (!nested_ept)
 		kvm_mmu_new_cr3(vcpu, cr3, false);