From: Boris Ostrovsky <boris.ostrovsky@amd.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH] x86/AMD: Add support for AMD's OSVW feature in guests
Date: Wed, 18 Jan 2012 13:26:02 -0500 [thread overview]
Message-ID: <4F170EBA.70101@amd.com> (raw)
In-Reply-To: <4F16A402020000780006D571@nat28.tlf.novell.com>
On 01/18/12 04:50, Jan Beulich wrote:
>>>> On 17.01.12 at 18:54, Boris Ostrovsky<boris.ostrovsky@amd.com> wrote:
>> On 01/17/12 03:26, Jan Beulich wrote:
>>>>>> On 16.01.12 at 22:11, Boris Ostrovsky<boris.ostrovsky@amd.com> wrote:
>>>> --- a/tools/libxc/xc_cpuid_x86.c Mon Jan 09 16:01:44 2012 +0100
>>>> +++ b/tools/libxc/xc_cpuid_x86.c Mon Jan 16 22:08:09 2012 +0100
>>>> @@ -108,6 +108,7 @@ static void amd_xc_cpuid_policy(
>>>> bitmaskof(X86_FEATURE_SSE4A) |
>>>> bitmaskof(X86_FEATURE_MISALIGNSSE) |
>>>> bitmaskof(X86_FEATURE_3DNOWPREFETCH) |
>>>> + bitmaskof(X86_FEATURE_OSVW) |
>>>
>>> Indentation.
>>>
>>> Also, is this really meaningful to PV guests?
>>
>> Does amd_xc_cpuid_policy() get called for PV guests? I thought this is
>> HVM path only.
>
> In that case I simply misplaced the comment.
>
>> xc_cpuid_pv_policy() is where clear_bit(X86_FEATURE_OSVW, regs[2]) was
>> removed to handle PV.
>>
>> I believe this (i.e. OSVW changes) is meaningful for PV. Taking erratum
>> 400 as an example -- we don't need a Linux PV guest reading an MSR
>> before going to idle (in amd_e400_idle()).
>
> It is bogus in the first place if a pv guest does so - after all, not doing
> stuff like this is the nature of being pv.
It was actually a bad example --- the guest is not using amd_e400_idle()
and so there are no extra MSR accesses.
However, without this change OSVW bit will not show up in the guest's
CPUID and I think guests should be able to see it. One could argue
whether or not we should mask off status bits for the two errata (400
and 415) since they are not currently used; I'd mask them off just to be
consistent with HVM, it won't affect anything.
>>>> + vcpu->arch.amd.osvw.length = (osvw_length >= 3) ? (osvw_length) : 3
>>>> + vcpu->arch.amd.osvw.status = osvw_status& ~(6ULL);
>>>> +
>>>> + /*
>>>> + * By increasing VCPU's osvw.length to 3 we are telling the guest that
>>>> + * all osvw.status bits inside that length, including bit 0 (which is
>>>> + * reserved for erratum 298), are valid. However, if host processor's
>>>> + * osvw_len is 0 then osvw_status[0] carries no information. We need to
>>>> + * be conservative here and therefore we tell the guest that erratum
>> 298
>>>> + * is present (because we really don't know).
>>>> + */
>>>> + if (osvw_length == 0&& boot_cpu_data.x86 == 0x10)
>>>
>>> Why do you check the family here? If osvw_length can only ever be
>>> zero on Fam10, then the first check is sufficient. If osvw_length can
>>> be zero on other than Fam10 (no matter whether we bail early older
>>> CPUs), then the check is actually wrong.
>>
>> 10h is the only family affected by this erratum.
>
> What is "this erratum" here? My comment was to suggest that either
> of the two conditions can likely be eliminated for being redundant.
("This erratum" is erratum 298, which is bit 0)
If osvw_length!=0 then we don't need to do anything since bit 0 is
already valid.
If osvw_length==0 then -- since we just made the guest's version of this
register 3 and thus turned bit 0 from being invalid to valid -- we need
to do something about bit 0. But the bit can only be set on family 10h,
thus both checks.
Thanks.
-boris
next prev parent reply other threads:[~2012-01-18 18:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-16 21:11 [PATCH] x86/AMD: Add support for AMD's OSVW feature in guests Boris Ostrovsky
2012-01-17 8:26 ` Jan Beulich
2012-01-17 17:54 ` Boris Ostrovsky
2012-01-18 9:50 ` Jan Beulich
2012-01-18 18:26 ` Boris Ostrovsky [this message]
2012-01-19 8:10 ` Jan Beulich
2012-01-19 8:46 ` Keir Fraser
2012-01-19 15:57 ` Boris Ostrovsky
2012-01-19 15:22 ` Boris Ostrovsky
2012-01-19 16:29 ` Jan Beulich
-- strict thread matches above, loose matches on Subject: below --
2012-01-30 17:05 Boris Ostrovsky
2012-01-31 10:13 ` Jan Beulich
2012-01-31 10:36 ` Christoph Egger
2012-01-31 10:39 ` Keir Fraser
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=4F170EBA.70101@amd.com \
--to=boris.ostrovsky@amd.com \
--cc=JBeulich@suse.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).