From: Paolo Bonzini <pbonzini@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm-devel <kvm@vger.kernel.org>, Gleb Natapov <gleb@redhat.com>
Subject: Re: [uq/master PATCH] kvm: i386: fix LAPIC TSC deadline timer save/restore
Date: Mon, 19 Aug 2013 20:57:58 +0200 [thread overview]
Message-ID: <52126AB6.20005@redhat.com> (raw)
In-Reply-To: <20130819171342.GA3272@amt.cnet>
Il 19/08/2013 19:13, Marcelo Tosatti ha scritto:
>
> The configuration of the timer represented by MSR_IA32_TSCDEADLINE depends on:
>
> - APIC LVT Timer register.
> - TSC value.
>
> Change the order to respect the dependency.
Do you have a testcase?
Paolo
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
>
> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> index 376fc70..d04c6ae 100644
> --- a/target-i386/kvm.c
> +++ b/target-i386/kvm.c
> @@ -1044,6 +1044,26 @@ static void kvm_msr_entry_set(struct kvm_msr_entry *entry,
> entry->data = value;
> }
>
> +static int kvm_put_tscdeadline_msr(X86CPU *cpu)
> +{
> + CPUX86State *env = &cpu->env;
> + struct {
> + struct kvm_msrs info;
> + struct kvm_msr_entry entries[1];
> + } msr_data;
> + struct kvm_msr_entry *msrs = msr_data.entries;
> +
> + if (!has_msr_tsc_deadline) {
> + return 0;
> + }
> +
> + kvm_msr_entry_set(&msrs[0], MSR_IA32_TSCDEADLINE, env->tsc_deadline);
> +
> + msr_data.info.nmsrs = 1;
> +
> + return kvm_vcpu_ioctl(CPU(cpu), KVM_SET_MSRS, &msr_data);
> +}
> +
> static int kvm_put_msrs(X86CPU *cpu, int level)
> {
> CPUX86State *env = &cpu->env;
> @@ -1067,9 +1087,6 @@ static int kvm_put_msrs(X86CPU *cpu, int level)
> if (has_msr_tsc_adjust) {
> kvm_msr_entry_set(&msrs[n++], MSR_TSC_ADJUST, env->tsc_adjust);
> }
> - if (has_msr_tsc_deadline) {
> - kvm_msr_entry_set(&msrs[n++], MSR_IA32_TSCDEADLINE, env->tsc_deadline);
> - }
> if (has_msr_misc_enable) {
> kvm_msr_entry_set(&msrs[n++], MSR_IA32_MISC_ENABLE,
> env->msr_ia32_misc_enable);
> @@ -1708,6 +1725,12 @@ int kvm_arch_put_registers(CPUState *cpu, int level)
> return ret;
> }
> }
> +
> + ret = kvm_put_tscdeadline_msr(x86_cpu);
> + if (ret < 0) {
> + return ret;
> + }
> +
> ret = kvm_put_vcpu_events(x86_cpu, level);
> if (ret < 0) {
> return ret;
>
next prev parent reply other threads:[~2013-08-19 18:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-19 17:13 [uq/master PATCH] kvm: i386: fix LAPIC TSC deadline timer save/restore Marcelo Tosatti
2013-08-19 18:57 ` Paolo Bonzini [this message]
2013-08-19 20:01 ` Marcelo Tosatti
2013-08-20 16:40 ` Paolo Bonzini
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=52126AB6.20005@redhat.com \
--to=pbonzini@redhat.com \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).