From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965725AbcDLVzp (ORCPT ); Tue, 12 Apr 2016 17:55:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57177 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933061AbcDLVzo (ORCPT ); Tue, 12 Apr 2016 17:55:44 -0400 Subject: Re: [PART1 RFC v4 02/11] KVM: x86: Introducing kvm_x86_ops VM init/uninit hooks To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Suravee Suthikulpanit References: <1460017232-17429-1-git-send-email-Suravee.Suthikulpanit@amd.com> <1460017232-17429-3-git-send-email-Suravee.Suthikulpanit@amd.com> <20160411204937.GA6762@potion.brq.redhat.com> Cc: joro@8bytes.org, bp@alien8.de, gleb@kernel.org, alex.williamson@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, wei@redhat.com, sherry.hurwitz@amd.com From: Paolo Bonzini Message-ID: <570D6ED5.4030403@redhat.com> Date: Tue, 12 Apr 2016 23:55:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <20160411204937.GA6762@potion.brq.redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 12 Apr 2016 21:55:43 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/04/2016 22:49, Radim Krčmář wrote: >> > @@ -7781,6 +7784,9 @@ static void kvm_free_vcpus(struct kvm *kvm) >> > kvm_for_each_vcpu(i, vcpu, kvm) >> > kvm_arch_vcpu_free(vcpu); >> > >> > + if (kvm_x86_ops->vm_uninit) >> > + kvm_x86_ops->vm_uninit(kvm); > vm_uninit() doesn't seem to have much to do with kvm_free_vcpus(), > please call it from kvm_arch_destroy_vm(). > > (kvm_x86_ops.vm_destroy would be a better name then.) Especially, you're calling it with struct kvm full of dangling pointer, so please call it early, right after the "if (current->mm == kvm->mm)" block. Paolo