From: Vadim Rozenfeld <vrozenfe@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, gleb@redhat.com, mtosatti@redhat.com, pl@dlh.net
Subject: Re: [RFC PATCH v2 2/2] add support for Hyper-V invariant TSC
Date: Fri, 24 May 2013 06:16:34 -0400 (EDT) [thread overview]
Message-ID: <1169203408.7041392.1369390594093.JavaMail.root@redhat.com> (raw)
In-Reply-To: <519E4782.3020402@redhat.com>
----- Original Message -----
From: "Paolo Bonzini" <pbonzini@redhat.com>
To: "Vadim Rozenfeld" <vrozenfe@redhat.com>
Cc: kvm@vger.kernel.org, gleb@redhat.com, mtosatti@redhat.com, pl@dlh.net
Sent: Friday, May 24, 2013 2:44:50 AM
Subject: Re: [RFC PATCH v2 2/2] add support for Hyper-V invariant TSC
Il 19/05/2013 09:06, Vadim Rozenfeld ha scritto:
> The following patch allows to activate a partition reference
> time enlightenment that is based on the host platform's support
> for an Invariant Time Stamp Counter (iTSC).
> NOTE: This code will survive migration due to lack of VM stop/resume
> handlers, when offset, scale and sequence should be
> readjusted.
>
> ---
> arch/x86/kvm/x86.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 9645dab..b423fe4 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -1838,7 +1838,6 @@ static int set_msr_hyperv_pw(struct kvm_vcpu *vcpu, u32 msr, u64 data)
> u64 gfn;
> unsigned long addr;
> HV_REFERENCE_TSC_PAGE tsc_ref;
> - tsc_ref.TscSequence = 0;
> if (!(data & HV_X64_MSR_TSC_REFERENCE_ENABLE)) {
> kvm->arch.hv_tsc_page = data;
> break;
> @@ -1848,6 +1847,11 @@ static int set_msr_hyperv_pw(struct kvm_vcpu *vcpu, u32 msr, u64 data)
> HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT);
> if (kvm_is_error_hva(addr))
> return 1;
> + tsc_ref.TscSequence =
> + boot_cpu_has(X86_FEATURE_CONSTANT_TSC) ? 1 : 0;
Thinking more of migration, could we increment whatever sequence value
we found (or better, do (x|3)+2 to skip over 0 and 0xFFFFFFFF), instead
of forcing it to 1?
[VR]
Yes, it should work.
We need to keep sequence between 1 and 0xFFFFFFFF and increment it every time
the VM was migrated or paused/resumed.
Add HV_X64_MSR_REFERENCE_TSC to msrs_to_save, and migration should just
work.
Paolo
> + tsc_ref.TscScale =
> + ((10000LL << 32) / vcpu->arch.virtual_tsc_khz) << 32;
> + tsc_ref.TscOffset = 0;
> if (__copy_to_user((void __user *)addr, &tsc_ref, sizeof(tsc_ref)))
> return 1;
> mark_page_dirty(kvm, gfn);
>
prev parent reply other threads:[~2013-05-24 10:16 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-19 7:06 [RFC PATCH v2 0/2] Hyper-V timers Vadim Rozenfeld
2013-05-19 7:06 ` [RFC PATCH v2 1/2] add support for Hyper-V reference time counter Vadim Rozenfeld
2013-05-19 13:47 ` Gleb Natapov
2013-05-19 14:37 ` Paolo Bonzini
2013-05-22 0:46 ` Marcelo Tosatti
2013-05-22 3:28 ` Gleb Natapov
2013-05-22 3:32 ` Marcelo Tosatti
2013-05-22 3:38 ` Gleb Natapov
2013-05-22 14:31 ` Marcelo Tosatti
2013-05-22 7:32 ` Vadim Rozenfeld
2013-05-22 21:55 ` Paolo Bonzini
2013-05-23 6:17 ` Peter Lieven
2013-05-23 9:54 ` Paolo Bonzini
2013-05-23 10:45 ` Peter Lieven
2013-05-23 12:25 ` Vadim Rozenfeld
2013-05-23 13:18 ` Paolo Bonzini
2013-05-23 13:20 ` Peter Lieven
2013-05-23 13:23 ` Paolo Bonzini
2013-05-23 13:30 ` Peter Lieven
2013-05-23 13:40 ` Paolo Bonzini
2013-05-19 7:06 ` [RFC PATCH v2 2/2] add support for Hyper-V invariant TSC Vadim Rozenfeld
2013-05-22 0:50 ` Marcelo Tosatti
2013-05-22 7:22 ` Vadim Rozenfeld
2013-05-22 21:23 ` Marcelo Tosatti
2013-05-23 6:18 ` Peter Lieven
2013-05-23 9:13 ` Gleb Natapov
2013-05-23 13:35 ` Marcelo Tosatti
2013-05-23 15:14 ` Gleb Natapov
2013-05-24 9:57 ` Vadim Rozenfeld
2013-05-23 12:33 ` Vadim Rozenfeld
2013-05-23 12:44 ` Peter Lieven
2013-05-23 12:45 ` Gleb Natapov
2013-05-23 12:54 ` Vadim Rozenfeld
2013-05-23 9:12 ` Gleb Natapov
2013-05-23 13:53 ` Marcelo Tosatti
2013-05-23 15:31 ` Gleb Natapov
2013-05-24 10:11 ` Vadim Rozenfeld
2013-05-24 19:41 ` Marcelo Tosatti
2013-05-27 12:33 ` Vadim Rozenfeld
2013-05-23 12:21 ` Vadim Rozenfeld
2013-05-23 13:47 ` Marcelo Tosatti
2013-05-24 10:01 ` Vadim Rozenfeld
2013-05-23 16:44 ` Paolo Bonzini
2013-05-24 10:16 ` Vadim Rozenfeld [this message]
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=1169203408.7041392.1369390594093.JavaMail.root@redhat.com \
--to=vrozenfe@redhat.com \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pl@dlh.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox