From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Ladi Prosek <lprosek@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: hyperv: support HV_X64_MSR_TSC_FREQUENCY and HV_X64_MSR_APIC_FREQUENCY
Date: Mon, 24 Jul 2017 16:23:44 +0200 [thread overview]
Message-ID: <20170724142343.GA14941@potion> (raw)
In-Reply-To: <20170717132847.29892-1-lprosek@redhat.com>
I missed this patch last week, sorry.
2017-07-17 15:28+0200, Ladi Prosek:
> It has been experimentally confirmed that supporting these two MSRs is one
> of the necessary conditions for nested Hyper-V to use the TSC page. Modern
> Windows guests are noticeably slower when they fall back to reading
> timestamps from the HV_X64_MSR_TIME_REF_COUNT MSR instead of using the TSC
> page.
>
> The newly supported MSRs are advertised with the AccessFrequencyRegs
> partition privilege flag and CPUID.40000003H:EDX[8] "Support for
> determining timer frequencies is available" (both outside of the scope of
> this KVM patch).
Do Windows ignore the AccessFrequencyMsrs (CPUID.40000003H:EAX[11]) bit?
> Hypervisor Top Level Functional Specification version 5.0b does not
> explicitly mark these MSRs as partition wide. This is, however, implied by
> the way Windows uses them (one read on Hyper-V startup regardless of the
> number of VCPUs) as well as our implementation.
>
> Signed-off-by: Ladi Prosek <lprosek@redhat.com>
> ---
> diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
> @@ -1065,6 +1067,12 @@ static int kvm_hv_get_msr_pw(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
> case HV_X64_MSR_REFERENCE_TSC:
> data = hv->hv_tsc_page;
> break;
> + case HV_X64_MSR_TSC_FREQUENCY:
> + data = (u64)tsc_khz * 1000;
> + break;
This should be based on vcpu->arch.virtual_tsc_khz, because KVM can use
guest TSC scaling,
thanks.
> + case HV_X64_MSR_APIC_FREQUENCY:
> + data = APIC_BUS_FREQUENCY;
> + break;
> case HV_X64_MSR_CRASH_P0 ... HV_X64_MSR_CRASH_P4:
> return kvm_hv_msr_get_crash_data(vcpu,
> msr - HV_X64_MSR_CRASH_P0,
next prev parent reply other threads:[~2017-07-24 14:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-17 13:28 [PATCH] KVM: hyperv: support HV_X64_MSR_TSC_FREQUENCY and HV_X64_MSR_APIC_FREQUENCY Ladi Prosek
2017-07-24 14:23 ` Radim Krčmář [this message]
2017-07-26 9:47 ` Ladi Prosek
2017-07-26 12:45 ` Radim Krčmář
2017-07-24 17:48 ` Paolo Bonzini
2017-07-26 9:51 ` Ladi Prosek
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=20170724142343.GA14941@potion \
--to=rkrcmar@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=lprosek@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