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
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

Patch 3 is also okay, please send it separately.
Ok, I will test and post it tomorrow, thanks!



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);
+               }
                         vcpu->arch.hflags &= ~HF_SMM_MASK;
                 vcpu->arch.smi_pending = events->smi.pending;


Reply via email to