Re: [PATCH 1/7] KVM: x86: Free vCPUs before freeing VM state

2025-02-26 Thread Paolo Bonzini
On Wed, Feb 26, 2025 at 1:27 AM Sean Christopherson wrote: > > On Wed, Feb 26, 2025, Paolo Bonzini wrote: > > On 2/25/25 00:55, Sean Christopherson wrote: > > > Free vCPUs before freeing any VM state, as both SVM and VMX may access > > > VM state when "freeing" a vCPU that is currently "in" L2, i.

Re: [PATCH 1/7] KVM: x86: Free vCPUs before freeing VM state

2025-02-25 Thread Yan Zhao
On Tue, Feb 25, 2025 at 07:04:55AM -0800, Sean Christopherson wrote: > On Tue, Feb 25, 2025, Yan Zhao wrote: > > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > > > index 58b82d6fd77c..045c61cc7e54 100644 > > > --- a/arch/x86/kvm/x86.c > > > +++ b/arch/x86/kvm/x86.c > > > @@ -12890,11 +128

Re: [PATCH 1/7] KVM: x86: Free vCPUs before freeing VM state

2025-02-25 Thread Sean Christopherson
On Wed, Feb 26, 2025, Paolo Bonzini wrote: > On 2/25/25 00:55, Sean Christopherson wrote: > > Free vCPUs before freeing any VM state, as both SVM and VMX may access > > VM state when "freeing" a vCPU that is currently "in" L2, i.e. that needs > > to be kicked out of nested guest mode. > > > > Comm

Re: [PATCH 1/7] KVM: x86: Free vCPUs before freeing VM state

2025-02-25 Thread Paolo Bonzini
On 2/25/25 00:55, Sean Christopherson wrote: Free vCPUs before freeing any VM state, as both SVM and VMX may access VM state when "freeing" a vCPU that is currently "in" L2, i.e. that needs to be kicked out of nested guest mode. Commit 6fcee03df6a1 ("KVM: x86: avoid loading a vCPU after .vm_dest

Re: [PATCH 1/7] KVM: x86: Free vCPUs before freeing VM state

2025-02-25 Thread Sean Christopherson
On Tue, Feb 25, 2025, Yan Zhao wrote: > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > > index 58b82d6fd77c..045c61cc7e54 100644 > > --- a/arch/x86/kvm/x86.c > > +++ b/arch/x86/kvm/x86.c > > @@ -12890,11 +12890,11 @@ void kvm_arch_destroy_vm(struct kvm *kvm) > > mutex_unlock(&

Re: [PATCH 1/7] KVM: x86: Free vCPUs before freeing VM state

2025-02-24 Thread Yan Zhao
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 58b82d6fd77c..045c61cc7e54 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -12890,11 +12890,11 @@ void kvm_arch_destroy_vm(struct kvm *kvm) > mutex_unlock(&kvm->slots_lock); > } > kvm_unload_v

[PATCH 1/7] KVM: x86: Free vCPUs before freeing VM state

2025-02-24 Thread Sean Christopherson
Free vCPUs before freeing any VM state, as both SVM and VMX may access VM state when "freeing" a vCPU that is currently "in" L2, i.e. that needs to be kicked out of nested guest mode. Commit 6fcee03df6a1 ("KVM: x86: avoid loading a vCPU after .vm_destroy was called") partially fixed the issue, but