All of lore.kernel.org
 help / color / mirror / Atom feed
From: Haozhong Zhang <haozhong.zhang@intel.com>
To: <qemu-devel@nongnu.org>, Eduardo Habkost <ehabkost@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	"Michael S. Tsirkin" <mst@redhat.com>, <afaerber@suse.de>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	kvm@vger.kernel.org, Haozhong Zhang <haozhong.zhang@intel.com>
Subject: [PATCH v4 0/2] target-i386: save/restore vcpu's TSC rate during migration
Date: Mon, 16 Nov 2015 16:04:06 +0800	[thread overview]
Message-ID: <1447661048-31048-1-git-send-email-haozhong.zhang@intel.com> (raw)

This patchset enables QEMU to save/restore vcpu's TSC rate during the
migration on machine types pc-*-2.5 or newer.

On the source machine:
 * If the vcpu's TSC rate is specified by the cpu option 'tsc-freq',
   then this user-specified TSC rate will be migrated.
 * Otherwise, the TSC rate returned by KVM_GET_TSC_KHZ will be
   migrated. For a fresh VM, this is the host TSC rate.

On the destination machine:
 * If the vcpu's TSC rate has been specified by the cpu option
   'tsc-freq' and is inconsistent with the migrated TSC rate, then
   the migration will be aborted.
 * Otherwise, QEMU will try to use the migrated TSC rate. If KVM on
   the destination supports TSC scaling, guest programs will observe a
   consistent TSC rate across the migration. If TSC scaling is not
   supported, the migration will not be aborted and QEMU will behave
   like before, i.e using the host TSC rate instead.

Changes in v4:
 * Make all code x86 specific.
 * Abort the migration if the user-specified TSC rate is inconsistent
   with the migrated TSC rate.
 * Move the sanity check to cpu_post_load().
 * All KVM_SET_TSC_KHZ and save/restore use env->tsc_khz.
 * Replace env->tsc_khz_saved with env->user_tsc_khz, and only use the
   latter for sanity check.

Changes in v3:
 * Change the cpu option 'save-tsc-freq' to an internal flag.
 * Remove the cpu option 'load-tsc-freq' and change the logic of
   loading the migrated TSC rate as above.
 * Move the setup of migrated TSC rate back to
   do_kvm_cpu_synchronize_post_init().

Changes in v2:
 * Add a pair of cpu options 'save-tsc-freq' and 'load-tsc-freq' to
   control the migration of vcpu's TSC rate.
 * Move all logic of setting TSC rate to target-i386.
 * Remove the duplicated TSC setup in kvm_arch_init_vcpu().

Haozhong Zhang (2):
  target-i386: fallback vcpu's TSC rate to value returned by KVM
  target-i386: add support to migrate vcpu's TSC rate

 hw/i386/pc.c          |  1 +
 hw/i386/pc_piix.c     |  1 +
 hw/i386/pc_q35.c      |  1 +
 include/hw/i386/pc.h  |  1 +
 target-i386/cpu.c     |  2 +-
 target-i386/cpu.h     |  1 +
 target-i386/kvm.c     | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 target-i386/machine.c | 28 ++++++++++++++++++++++++++++
 8 files changed, 81 insertions(+), 1 deletion(-)

-- 
2.6.3


WARNING: multiple messages have this Message-ID (diff)
From: Haozhong Zhang <haozhong.zhang@intel.com>
To: qemu-devel@nongnu.org, Eduardo Habkost <ehabkost@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Haozhong Zhang <haozhong.zhang@intel.com>,
	kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	afaerber@suse.de, Richard Henderson <rth@twiddle.net>
Subject: [Qemu-devel] [PATCH v4 0/2] target-i386: save/restore vcpu's TSC rate during migration
Date: Mon, 16 Nov 2015 16:04:06 +0800	[thread overview]
Message-ID: <1447661048-31048-1-git-send-email-haozhong.zhang@intel.com> (raw)

This patchset enables QEMU to save/restore vcpu's TSC rate during the
migration on machine types pc-*-2.5 or newer.

On the source machine:
 * If the vcpu's TSC rate is specified by the cpu option 'tsc-freq',
   then this user-specified TSC rate will be migrated.
 * Otherwise, the TSC rate returned by KVM_GET_TSC_KHZ will be
   migrated. For a fresh VM, this is the host TSC rate.

On the destination machine:
 * If the vcpu's TSC rate has been specified by the cpu option
   'tsc-freq' and is inconsistent with the migrated TSC rate, then
   the migration will be aborted.
 * Otherwise, QEMU will try to use the migrated TSC rate. If KVM on
   the destination supports TSC scaling, guest programs will observe a
   consistent TSC rate across the migration. If TSC scaling is not
   supported, the migration will not be aborted and QEMU will behave
   like before, i.e using the host TSC rate instead.

Changes in v4:
 * Make all code x86 specific.
 * Abort the migration if the user-specified TSC rate is inconsistent
   with the migrated TSC rate.
 * Move the sanity check to cpu_post_load().
 * All KVM_SET_TSC_KHZ and save/restore use env->tsc_khz.
 * Replace env->tsc_khz_saved with env->user_tsc_khz, and only use the
   latter for sanity check.

Changes in v3:
 * Change the cpu option 'save-tsc-freq' to an internal flag.
 * Remove the cpu option 'load-tsc-freq' and change the logic of
   loading the migrated TSC rate as above.
 * Move the setup of migrated TSC rate back to
   do_kvm_cpu_synchronize_post_init().

Changes in v2:
 * Add a pair of cpu options 'save-tsc-freq' and 'load-tsc-freq' to
   control the migration of vcpu's TSC rate.
 * Move all logic of setting TSC rate to target-i386.
 * Remove the duplicated TSC setup in kvm_arch_init_vcpu().

Haozhong Zhang (2):
  target-i386: fallback vcpu's TSC rate to value returned by KVM
  target-i386: add support to migrate vcpu's TSC rate

 hw/i386/pc.c          |  1 +
 hw/i386/pc_piix.c     |  1 +
 hw/i386/pc_q35.c      |  1 +
 include/hw/i386/pc.h  |  1 +
 target-i386/cpu.c     |  2 +-
 target-i386/cpu.h     |  1 +
 target-i386/kvm.c     | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 target-i386/machine.c | 28 ++++++++++++++++++++++++++++
 8 files changed, 81 insertions(+), 1 deletion(-)

-- 
2.6.3

             reply	other threads:[~2015-11-16  8:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-16  8:04 Haozhong Zhang [this message]
2015-11-16  8:04 ` [Qemu-devel] [PATCH v4 0/2] target-i386: save/restore vcpu's TSC rate during migration Haozhong Zhang
2015-11-16  8:04 ` [PATCH v4 1/2] target-i386: fallback vcpu's TSC rate to value returned by KVM Haozhong Zhang
2015-11-16  8:04   ` [Qemu-devel] " Haozhong Zhang
2015-11-16 13:39   ` Eduardo Habkost
2015-11-16 13:39     ` [Qemu-devel] " Eduardo Habkost
2015-11-16 14:30     ` Haozhong Zhang
2015-11-16 14:30       ` [Qemu-devel] " Haozhong Zhang
2015-11-16  8:04 ` [PATCH v4 2/2] target-i386: add support to migrate vcpu's TSC rate Haozhong Zhang
2015-11-16  8:04   ` [Qemu-devel] " Haozhong Zhang
2015-11-16 13:43   ` Eduardo Habkost
2015-11-16 13:43     ` [Qemu-devel] " Eduardo Habkost
2015-11-16 14:30     ` Haozhong Zhang
2015-11-16 14:30       ` [Qemu-devel] " Haozhong Zhang
2015-11-16 15:35       ` Eduardo Habkost
2015-11-16 15:35         ` [Qemu-devel] " Eduardo Habkost
2015-11-17  5:24         ` Haozhong Zhang
2015-11-17  5:24           ` [Qemu-devel] " Haozhong Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1447661048-31048-1-git-send-email-haozhong.zhang@intel.com \
    --to=haozhong.zhang@intel.com \
    --cc=afaerber@suse.de \
    --cc=dgilbert@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.