From: Keir Fraser <keir.xen@gmail.com>
To: "Huang2, Wei" <Wei.Huang2@amd.com>,
"Ostrovsky, Boris" <Boris.Ostrovsky@amd.com>,
"JBeulich@suse.com" <JBeulich@suse.com>,
Dan Magenheimer <dan.magenheimer@oracle.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH] svm: Do not intercept RDTCS(P) when TSC scaling is supported by hardware
Date: Fri, 20 Apr 2012 17:56:09 +0100 [thread overview]
Message-ID: <CBB753B9.3125C%keir.xen@gmail.com> (raw)
In-Reply-To: <4400B41FB768044EA720935D0808176C090DFB9E@sausexdag02.amd.com>
Ah, okay. Well, depending on review feedback on list perhaps it can slip
into the schedule then. :-)
On 20/04/2012 16:06, "Huang2, Wei" <Wei.Huang2@amd.com> wrote:
> Hi Keir,
>
> This patch is a bug fix for 23437:d7c755c25bb9 than new feature. It slipped my
> hand and Boris fixed it for me. The same applies to Xen-4.1.
>
> ===== Changeset 23437 =====
>
> HVM/SVM: enable tsc scaling ratio for SVM
>
> Future AMD CPUs support TSC scaling. It allows guests to have a
> different TSC frequency from host system using this formula: guest_tsc
> = host_tsc * tsc_ratio + vmcb_offset. The tsc_ratio is a 64bit MSR
> contains a fixed-point number in 8.32 format (8 bits for integer part
> and 32bits for fractional part). For instance 0x00000003_80000000
> means tsc_ratio=3.5.
>
> This patch enables TSC scaling ratio for SVM. With it, guest VMs don't
> need take #VMEXIT to calculate a translated TSC value when it is
> running under TSC emulation mode. This can substancially reduce the
> rdtsc overhead.
>
>
> -Wei
>
> -----Original Message-----
> From: Keir Fraser [mailto:keir.xen@gmail.com] On Behalf Of Keir Fraser
> Sent: Friday, April 20, 2012 3:15 AM
> To: Ostrovsky, Boris; JBeulich@suse.com; Dan Magenheimer
> Cc: Huang2, Wei; xen-devel@lists.xensource.com
> Subject: Re: [PATCH] svm: Do not intercept RDTCS(P) when TSC scaling is
> supported by hardware
>
> On 20/04/2012 09:05, "Keir Fraser" <keir.xen@gmail.com> wrote:
>
>> On 20/04/2012 03:21, "Boris Ostrovsky" <boris.ostrovsky@amd.com> wrote:
>>
>>> # HG changeset patch
>>> # User Boris Ostrovsky <boris.ostrovsky@amd.com>
>>> # Date 1334875170 14400
>>> # Node ID 55bf11ebce87ceb73fb2c372dcef170ec0bb4a18
>>> # Parent 7c777cb8f705411b77c551f34ba88bdc09e38ab8
>>> svm: Do not intercept RDTCS(P) when TSC scaling is supported by hardware
>>>
>>> When running in TSC_MODE_ALWAYS_EMULATE mode on processors that support
>>> TSC scaling we don't need to intercept RDTSC/RDTSCP instructions.
>>>
>>> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com>
>>> Acked-by: Wei Huang <wei.huang2@amd.com>
>>> Tested-by: Wei Huang <wei.huang2@amd.com>
>>
>> Worth an ack/nack from Dan M I'd say. He'll probably have some comment about
>> possible cross-CPU TSC skew.
>
> Oh, and apart from that, we're also in feature freeze for 4.2, and this
> isn't a bug fix. Similarly, it's not really a candidate for the stable 4.1
> branch either, at any time.
>
> -- Keir
>
>> -- Keir
>>
>>> diff -r 7c777cb8f705 -r 55bf11ebce87 xen/arch/x86/hvm/svm/svm.c
>>> --- a/xen/arch/x86/hvm/svm/svm.c Wed Apr 18 16:49:55 2012 +0100
>>> +++ b/xen/arch/x86/hvm/svm/svm.c Thu Apr 19 18:39:30 2012 -0400
>>> @@ -724,12 +724,18 @@ static void svm_set_rdtsc_exiting(struct
>>> {
>>> struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
>>> u32 general1_intercepts = vmcb_get_general1_intercepts(vmcb);
>>> + u32 general2_intercepts = vmcb_get_general2_intercepts(vmcb);
>>>
>>> general1_intercepts &= ~GENERAL1_INTERCEPT_RDTSC;
>>> - if ( enable )
>>> + general2_intercepts &= ~GENERAL2_INTERCEPT_RDTSCP;
>>> +
>>> + if ( enable && !cpu_has_tsc_ratio ) {
>>> general1_intercepts |= GENERAL1_INTERCEPT_RDTSC;
>>> + general2_intercepts |= GENERAL2_INTERCEPT_RDTSCP;
>>> + }
>>>
>>> vmcb_set_general1_intercepts(vmcb, general1_intercepts);
>>> + vmcb_set_general2_intercepts(vmcb, general2_intercepts);
>>> }
>>>
>>> static unsigned int svm_get_insn_bytes(struct vcpu *v, uint8_t *buf)
>>>
>>
>>
>
>
>
>
next prev parent reply other threads:[~2012-04-20 16:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-20 2:21 [PATCH] svm: Do not intercept RDTCS(P) when TSC scaling is supported by hardware Boris Ostrovsky
2012-04-20 3:57 ` Huang2, Wei
2012-04-20 8:05 ` Keir Fraser
2012-04-20 8:14 ` Keir Fraser
2012-04-20 15:06 ` Huang2, Wei
2012-04-20 16:56 ` Keir Fraser [this message]
2012-04-20 15:02 ` Dan Magenheimer
2012-04-20 16:20 ` Wei Huang
2012-04-20 17:25 ` Dan Magenheimer
2012-04-20 8:15 ` Jan Beulich
2012-04-20 8:45 ` Keir Fraser
2012-04-20 15:27 ` Boris Ostrovsky
2012-04-25 9:27 ` Jan Beulich
2012-04-25 15:01 ` Dan Magenheimer
2012-04-25 15:51 ` Jan Beulich
2012-04-25 16:05 ` Dan Magenheimer
2012-04-25 16:04 ` Wei Huang
2012-04-25 17:14 ` Keir Fraser
2012-04-25 20:07 ` Boris Ostrovsky
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=CBB753B9.3125C%keir.xen@gmail.com \
--to=keir.xen@gmail.com \
--cc=Boris.Ostrovsky@amd.com \
--cc=JBeulich@suse.com \
--cc=Wei.Huang2@amd.com \
--cc=dan.magenheimer@oracle.com \
--cc=xen-devel@lists.xensource.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).