From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35559) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuFXu-0006pM-CZ for qemu-devel@nongnu.org; Thu, 05 Nov 2015 03:05:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZuFXr-0007MQ-0g for qemu-devel@nongnu.org; Thu, 05 Nov 2015 03:05:22 -0500 Received: from e06smtp05.uk.ibm.com ([195.75.94.101]:52698) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuFXq-0007M7-OH for qemu-devel@nongnu.org; Thu, 05 Nov 2015 03:05:18 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 5 Nov 2015 08:05:16 -0000 References: <1446456403-29909-1-git-send-email-haozhong.zhang@intel.com> <1446456403-29909-3-git-send-email-haozhong.zhang@intel.com> <20151102094018.GE22011@jhogan-linux.le.imgtec.org> From: Christian Borntraeger Message-ID: <563B0DB8.5000207@de.ibm.com> Date: Thu, 5 Nov 2015 09:05:12 +0100 MIME-Version: 1.0 In-Reply-To: <20151102094018.GE22011@jhogan-linux.le.imgtec.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 2/3] target-i386: calculate vcpu's TSC rate to be migrated List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: James Hogan , Haozhong Zhang Cc: Peter Maydell , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , qemu-devel@nongnu.org, "Dr. David Alan Gilbert" , Alexander Graf , qemu-ppc@nongnu.org, Cornelia Huck , Paolo Bonzini , Leon Alrae , Aurelien Jarno , Richard Henderson Am 02.11.2015 um 10:40 schrieb James Hogan: > On Mon, Nov 02, 2015 at 05:26:42PM +0800, Haozhong Zhang wrote: >> The value of the migrated vcpu's TSC rate is determined as below. >> 1. If a TSC rate is specified by the cpu option 'tsc-freq', then this >> user-specified value will be used. >> 2. If neither a user-specified TSC rate nor a migrated TSC rate is >> present, we will use the TSC rate from KVM (returned by >> KVM_GET_TSC_KHZ). >> 3. Otherwise, we will use the migrated TSC rate. >> >> Signed-off-by: Haozhong Zhang >> --- >> include/sysemu/kvm.h | 2 ++ >> kvm-all.c | 1 + >> target-arm/kvm.c | 5 +++++ >> target-i386/kvm.c | 33 +++++++++++++++++++++++++++++++++ >> target-mips/kvm.c | 5 +++++ >> target-ppc/kvm.c | 5 +++++ >> target-s390x/kvm.c | 5 +++++ >> 7 files changed, 56 insertions(+) >> >> diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h >> index 461ef65..0ec8b98 100644 >> --- a/include/sysemu/kvm.h >> +++ b/include/sysemu/kvm.h >> @@ -328,6 +328,8 @@ int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route, >> >> int kvm_arch_msi_data_to_gsi(uint32_t data); >> >> +int kvm_arch_setup_tsc_khz(CPUState *cpu); >> + >> int kvm_set_irq(KVMState *s, int irq, int level); >> int kvm_irqchip_send_msi(KVMState *s, MSIMessage msg); >> >> diff --git a/kvm-all.c b/kvm-all.c >> index c442838..1ecaf04 100644 >> --- a/kvm-all.c >> +++ b/kvm-all.c >> @@ -1757,6 +1757,7 @@ static void do_kvm_cpu_synchronize_post_init(void *arg) >> { >> CPUState *cpu = arg; >> >> + kvm_arch_setup_tsc_khz(cpu); > > Sorry if this is a stupid question, but why aren't you doing this from > the i386 kvm_arch_put_registers when level == KVM_PUT_FULL_STATE, rather > than introducing x86 specifics to the generic KVM api? > > Cheers > James I agree. We should try to keep this in x86 code.