From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sean Christopherson Date: Wed, 18 Mar 2020 18:16:46 +0000 Subject: Re: [PATCH 1/3] KVM: PPC: Fix kernel crash with PR KVM Message-Id: <20200318181646.GL24357@linux.intel.com> List-Id: References: <158455340419.178873.11399595021669446372.stgit@bahia.lan> <158455341029.178873.15248663726399374882.stgit@bahia.lan> In-Reply-To: <158455341029.178873.15248663726399374882.stgit@bahia.lan> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Greg Kurz Cc: kvm-ppc@vger.kernel.org, Paolo Bonzini , linuxppc-dev@lists.ozlabs.org On Wed, Mar 18, 2020 at 06:43:30PM +0100, Greg Kurz wrote: > It turns out that this is only relevant to PR KVM actually. And both > 32 and 64 backends need vcpu->arch.book3s to be valid when calling > kvmppc_mmu_destroy_pr(). So instead of calling kvmppc_mmu_destroy() > from kvm_arch_vcpu_destroy(), call kvmppc_mmu_destroy_pr() at the > beginning of kvmppc_core_vcpu_free_pr(). This is consistent with > kvmppc_mmu_init() being the last call in kvmppc_core_vcpu_create_pr(). > > For the same reason, if kvmppc_core_vcpu_create_pr() returns an > error then this means that kvmppc_mmu_init() was either not called > or failed, in which case kvmppc_mmu_destroy() should not be called. > Drop the line in the error path of kvm_arch_vcpu_create(). > > Fixes: ff030fdf5573 ("KVM: PPC: Move kvm_vcpu_init() invocation to common code") > Signed-off-by: Greg Kurz > --- Dang, I see where I went wrong. Sorry :-( Reviewed-by: Sean Christopherson