> -----Original Message----- > From: Zhuangyanying > Sent: Friday, November 04, 2016 4:17 PM > To: [email protected]; [email protected]; [email protected] > Cc: [email protected]; Gonglei (Arei); Zhuangyanying > Subject: [PATCH] target-i386/machine:fix migrate faile because of Hyper-V > HV_X64_MSR_VP_RUNTIME > > From: ZhuangYanying <[email protected]> > > Hyper-V HV_X64_MSR_VP_RUNTIME was introduced in linux-4.4 + qemu-2.5. > > As long as the KVM module supports, qemu will save / load the > vmstate_msr_hyperv_runtime register during the migration. > > Regardless of whether the hyperv_runtime configuration of > x86_cpu_properties is > enabled. > > The qemu-2.3 does not support this feature, of course, failed to migrate. > > linux-BGSfqC:/home/qemu # ./x86_64-softmmu/qemu-system-x86_64 > --enable-kvm > -nodefaults -machine pc-i440fx-2.3,accel=kvm,usb=off -smp 4 -m 4096 -drive > file=/work/suse/sles11sp3.img.bak,format=raw,if=none,id=drive-virtio-disk0,ca > che=none > -device > virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 > -vnc :99 -device cirrus-vga,id=video0,vgamem_mb=8,bus=pci.0,addr=0x2 > -monitor vc > > save_section_header:se->section_id=3,se->idstr:ram,se->instance_id=0,se->v > ersion_id=4 > > save_section_header:se->section_id=0,se->idstr:timer,se->instance_id=0,se-> > version_id=2 > > save_section_header:se->section_id=4,se->idstr:cpu_common,se->instance_id > =0,se->version_id=1 > > save_section_header:se->section_id=5,se->idstr:cpu,se->instance_id=0,se->ve > rsion_id=12 > > vmstate_subsection_save:vmsd->name:cpu/async_pf_msr > > hyperv_runtime_enable_needed:env->msr_hv_runtime=128902811 > > vmstate_subsection_save:vmsd->name:cpu/msr_hyperv_runtime > > Since hyperv_runtime is false, vm will not use hv->runtime_offset, then > vmstate_msr_hyperv_runtime is no need to transfer while migrating. > > Signed-off-by: [email protected] > --- > Hi, > > Recently, I tested cross-version migration/rollback between qemu tag v2.3.1 > and > qemu-master, found that rollback failed. > > linux-rIVrzS:/home/git/qemu # ./x86_64-softmmu/qemu-system-x86_64 > --enable-kvm > -nodefaults -machine pc-i440fx-2.3,accel=kvm,usb=off -smp 4 -m 4096 -drive > file=/work/suse/sles11sp3.img.bak,format=raw,if=none,id=drive-virtio-disk0,ca > che=none > -device > virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 > -vnc :99 -device cirrus-vga,id=video0,vgamem_mb=8,bus=pci.0,addr=0x2 > -monitor vc > -incoming tcp:0:8888 > > qemu-system-x86_64: error while loading state for instance 0x0 of device 'cpu' > > qemu-system-x86_64: load of migration failed: No such file or directory > > Maybe set compat_props on PC_COMPAT_2_5 ? Any better idea? > --- > target-i386/machine.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/target-i386/machine.c b/target-i386/machine.c > index 48037f1..e984d77 100644 > --- a/target-i386/machine.c > +++ b/target-i386/machine.c > @@ -709,6 +709,10 @@ static bool hyperv_runtime_enable_needed(void > *opaque) > X86CPU *cpu = opaque; > CPUX86State *env = &cpu->env; > > + if (!cpu->hyperv_runtime) { > + return 0;
'return false' is better. Regards, -Gonglei > + } > + > return env->msr_hv_runtime != 0; > } > > -- > 1.8.3.1 >
