From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [RFC] Do clock adjustments over migration Date: Thu, 15 Oct 2009 17:08:16 -0300 Message-ID: <20091015200816.GC11656@amt.cnet> References: <1255626925-3140-1-git-send-email-glommer@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, avi@redhat.com To: Glauber Costa Return-path: Received: from mx1.redhat.com ([209.132.183.28]:53392 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935366AbZJOUJC (ORCPT ); Thu, 15 Oct 2009 16:09:02 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9FK8aum011099 for ; Thu, 15 Oct 2009 16:08:36 -0400 Content-Disposition: inline In-Reply-To: <1255626925-3140-1-git-send-email-glommer@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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 > --- > 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.