From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42434) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zh08W-00064a-Kr for qemu-devel@nongnu.org; Tue, 29 Sep 2015 15:00:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zh08R-0001t5-LZ for qemu-devel@nongnu.org; Tue, 29 Sep 2015 15:00:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45302) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zh08R-0001sz-Ff for qemu-devel@nongnu.org; Tue, 29 Sep 2015 15:00:19 -0400 Date: Tue, 29 Sep 2015 20:00:13 +0100 From: "Dr. David Alan Gilbert" Message-ID: <20150929190013.GO3810@work-vm> References: <1443418711-24106-1-git-send-email-haozhong.zhang@intel.com> <1443418711-24106-2-git-send-email-haozhong.zhang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1443418711-24106-2-git-send-email-haozhong.zhang@intel.com> Subject: Re: [Qemu-devel] [PATCH 1/3] target-i386: add a subsection of vcpu's TSC rate in vmstate_x86_cpu List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Haozhong Zhang Cc: Eduardo Habkost , kvm@vger.kernel.org, Marcelo Tosatti , qemu-devel@nongnu.org, Paolo Bonzini , Richard Henderson * Haozhong Zhang (haozhong.zhang@intel.com) wrote: > The newly added subsection 'vmstate_tsc_khz' in this patch results in > vcpu's TSC rate being saved on the source machine and loaded on the > target machine during the migration. > > Signed-off-by: Haozhong Zhang Hi, I'd appreciate it if you could tie this to only do it on newer machine types; that way it won't break back migration. Dave > --- > target-i386/machine.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/target-i386/machine.c b/target-i386/machine.c > index 9fa0563..80108a3 100644 > --- a/target-i386/machine.c > +++ b/target-i386/machine.c > @@ -752,6 +752,25 @@ static const VMStateDescription vmstate_xss = { > } > }; > > +static bool tsc_khz_needed(void *opaque) > +{ > + X86CPU *cpu = opaque; > + CPUX86State *env = &cpu->env; > + > + return env->tsc_khz != 0; > +} > + > +static const VMStateDescription vmstate_tsc_khz = { > + .name = "cpu/tsc_khz", > + .version_id = 1, > + .minimum_version_id = 1, > + .needed = tsc_khz_needed, > + .fields = (VMStateField[]) { > + VMSTATE_INT64(env.tsc_khz, X86CPU), > + VMSTATE_END_OF_LIST() > + } > +}; > + > VMStateDescription vmstate_x86_cpu = { > .name = "cpu", > .version_id = 12, > @@ -871,6 +890,7 @@ VMStateDescription vmstate_x86_cpu = { > &vmstate_msr_hyperv_crash, > &vmstate_avx512, > &vmstate_xss, > + &vmstate_tsc_khz, > NULL > } > }; > -- > 2.4.8 > > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK