From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Herongguang (Stephen)" Subject: Re: [RFC/PATCH 2] kvm: x86: handle KVM_SET_VCPU_EVENTS/KVM_VCPUEVENT_VALID_SMM properly Date: Thu, 22 Sep 2016 21:19:42 +0800 Message-ID: <57E3DA6E.1060702@huawei.com> References: <57D90289.6020003@huawei.com> <57E38D7D.1050806@huawei.com> <28cd815c-8120-cc05-fc47-1ed31030f607@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Cc: , , "Huangweidong (C)" To: Paolo Bonzini , , , , Return-path: Received: from szxga03-in.huawei.com ([119.145.14.66]:54709 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933337AbcIVNUS (ORCPT ); Thu, 22 Sep 2016 09:20:18 -0400 In-Reply-To: <28cd815c-8120-cc05-fc47-1ed31030f607@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 2016/9/22 17:29, Paolo Bonzini wrote: > > > On 22/09/2016 09:51, Herongguang (Stephen) wrote: >> After making memory consistent between source and destination >> (https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg03069.html), >> there can >> still reproduce instruction emulation failure in destination side if >> migration when VM’s in grub stage: > > Hi! Did you follow up on that patch, by the way? Yes, I have some concern, see that post. > >> So I think there is some lacking in kvm-kmod’s >> kvm_vcpu_ioctl_x86_set_vcpu_events that handles KVM_VCPUEVENT_VALID_SMM. >> I tried following patch, >> it seems works fine. >> >> Do you think this patch is appropriate or not enough? Thanks. > > Yes. I would just call kvm_mmu_reset_context unconditionally at the end > of kvm_vcpu_iocyl_x86_set_x86_vcpu_events. Please send this patch as > non-RFC. > > Patch 3 is also okay, please send it separately. Ok, I will test and post it tomorrow, thanks! > > Thanks, > > Paolo > >> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c >> index 19f9f9e..f39e839 100644 >> --- a/arch/x86/kvm/x86.c >> +++ b/arch/x86/kvm/x86.c >> @@ -3013,8 +3013,10 @@ static int >> kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, >> vcpu->arch.apic->sipi_vector = events->sipi_vector; >> >> if (events->flags & KVM_VCPUEVENT_VALID_SMM) { >> - if (events->smi.smm) >> + if (events->smi.smm) { >> vcpu->arch.hflags |= HF_SMM_MASK; >> + kvm_mmu_reset_context(vcpu); >> + } >> else >> vcpu->arch.hflags &= ~HF_SMM_MASK; >> vcpu->arch.smi_pending = events->smi.pending; >> >> > > . > From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn3vK-00057t-1c for qemu-devel@nongnu.org; Thu, 22 Sep 2016 09:20:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bn3v5-00024p-AL for qemu-devel@nongnu.org; Thu, 22 Sep 2016 09:20:20 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:42037) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn3v4-000229-Ks for qemu-devel@nongnu.org; Thu, 22 Sep 2016 09:20:07 -0400 References: <57D90289.6020003@huawei.com> <57E38D7D.1050806@huawei.com> <28cd815c-8120-cc05-fc47-1ed31030f607@redhat.com> From: "Herongguang (Stephen)" Message-ID: <57E3DA6E.1060702@huawei.com> Date: Thu, 22 Sep 2016 21:19:42 +0800 MIME-Version: 1.0 In-Reply-To: <28cd815c-8120-cc05-fc47-1ed31030f607@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC/PATCH 2] kvm: x86: handle KVM_SET_VCPU_EVENTS/KVM_VCPUEVENT_VALID_SMM properly List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , quintela@redhat.com, amit.shah@redhat.com, rkrcmar@redhat.com, kvm@vger.kernel.org Cc: qemu-devel@nongnu.org, arei.gonglei@huawei.com, "Huangweidong (C)" On 2016/9/22 17:29, Paolo Bonzini wrote: > > > On 22/09/2016 09:51, Herongguang (Stephen) wrote: >> After making memory consistent between source and destination >> (https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg03069.html), >> there can >> still reproduce instruction emulation failure in destination side if >> migration when VM’s in grub stage: > > Hi! Did you follow up on that patch, by the way? Yes, I have some concern, see that post. > >> So I think there is some lacking in kvm-kmod’s >> kvm_vcpu_ioctl_x86_set_vcpu_events that handles KVM_VCPUEVENT_VALID_SMM. >> I tried following patch, >> it seems works fine. >> >> Do you think this patch is appropriate or not enough? Thanks. > > Yes. I would just call kvm_mmu_reset_context unconditionally at the end > of kvm_vcpu_iocyl_x86_set_x86_vcpu_events. Please send this patch as > non-RFC. > > Patch 3 is also okay, please send it separately. Ok, I will test and post it tomorrow, thanks! > > Thanks, > > Paolo > >> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c >> index 19f9f9e..f39e839 100644 >> --- a/arch/x86/kvm/x86.c >> +++ b/arch/x86/kvm/x86.c >> @@ -3013,8 +3013,10 @@ static int >> kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, >> vcpu->arch.apic->sipi_vector = events->sipi_vector; >> >> if (events->flags & KVM_VCPUEVENT_VALID_SMM) { >> - if (events->smi.smm) >> + if (events->smi.smm) { >> vcpu->arch.hflags |= HF_SMM_MASK; >> + kvm_mmu_reset_context(vcpu); >> + } >> else >> vcpu->arch.hflags &= ~HF_SMM_MASK; >> vcpu->arch.smi_pending = events->smi.pending; >> >> > > . >