On Thu, Oct 15, 2009 at 01:15:25PM -0400, Glauber Costa wrote: > Hey, > > This patch is a proposal only. Among other things, it relies on a patch > Juan is yet to send, and I also would want to give it a bit more testing. > It shows my indented use of the new ioctl interface I've been proposing. > > First of all, we have to save the kvmclock msrs. This is per-cpu, and we > were failing to do it so far. > > The ioctls are issued in pre-save and post-load sections of a new vmstate > handler. I am not doing it in the cpu vmstate handler, because this has to > be done once per VM, not cpu. What I basically do is to grab the time > from GET ioctl, pass on through migration, and then do a SET on the other > side. Should be straighforward. > > Please let me hear your thoughts. And don't get me started with this > "you can't hear thoughts" thing! > > Signed-off-by: Glauber Costa <glommer@xxxxxxxxxx> > --- > kvm/include/linux/kvm.h | 9 +++++++++ > qemu-kvm-x86.c | 6 ++++++ > qemu-kvm.c | 29 +++++++++++++++++++++++++++++ > target-i386/cpu.h | 3 ++- > target-i386/machine.c | 2 ++ > 5 files changed, 48 insertions(+), 1 deletions(-) > > diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c > index fffcfd8..75e2ffd 100644 > --- a/qemu-kvm-x86.c > +++ b/qemu-kvm-x86.c > @@ -834,6 +834,9 @@ static int get_msr_entry(struct kvm_msr_entry *entry, CPUState *env) > case MSR_VM_HSAVE_PA: > env->vm_hsave = entry->data; > break; > + case MSR_KVM_SYSTEM_TIME: > + env->system_time_msr = entry->data; > + break; > default: > printf("Warning unknown msr index 0x%x\n", entry->index); > return 1; > @@ -1001,6 +1004,7 @@ void kvm_arch_load_regs(CPUState *env) > set_msr_entry(&msrs[n++], MSR_LSTAR , env->lstar); > } > #endif > + set_msr_entry(&msrs[n++], MSR_KVM_SYSTEM_TIME, env->system_time_msr); > > rc = kvm_set_msrs(env->kvm_cpu_state.vcpu_ctx, msrs, n); > if (rc == -1) > @@ -1179,6 +1183,8 @@ void kvm_arch_save_regs(CPUState *env) > msrs[n++].index = MSR_LSTAR; > } > #endif > + msrs[n++].index = MSR_KVM_SYSTEM_TIME; > + fix MSR_COUNT for kvm_arch_save_regs() Otherwise looks good. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html