From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: keir@xen.org, ian.campbell@citrix.com,
stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com,
eddie.dong@intel.com, xen-devel@lists.xen.org,
jun.nakajima@intel.com, yang.z.zhang@intel.com,
ian.jackson@eu.citrix.com
Subject: Re: [PATCH v6 1/4] xen/libxc: Allow changing max number of hypervisor cpuid leaves
Date: Fri, 21 Mar 2014 11:13:20 -0400 [thread overview]
Message-ID: <532C5710.7070007@oracle.com> (raw)
In-Reply-To: <532C288D02000078001267A1@nat28.tlf.novell.com>
On 03/21/2014 06:54 AM, Jan Beulich wrote:
>>>> On 21.03.14 at 04:51, Boris Ostrovsky <boris.ostrovsky@oracle.com> wrote:
>> --- a/tools/libxc/xc_cpuid_x86.c
>> +++ b/tools/libxc/xc_cpuid_x86.c
>> @@ -555,6 +555,17 @@ static int xc_cpuid_policy(
>> {
>> xc_dominfo_t info;
>>
>> + /*
>> + * For hypervisor leaves (0x4000XXXX) only 0x40000x00.EAX[7:0] bits (max
> 0x4000xx00.EAX[7:0] (also in the description).
>
>> + * number of leaves) can be set by user. Hypervisor will enforce this so
>> + * all other bits are don't-care and we can set them to zero.
>> + */
>> + if ( (input[0] & 0xffff0000) == 0x40000000 )
>> + {
>> + regs[0] = regs[1] = regs[2] = regs[3] = 0;
>> + return 0;
>> + }
> Except that x in the config won't work anymore (not that I consider
> this particularly useful here, but you never know what people come
> up with - read: I'm not sure this needs dealing with).
Yes, I did think about 'x' but didn't feel that it's worth adding back
pv cpuid (which would address this issue) since specifying 'x' only
for some bits in the number of leaves field seemed somewhat strange.
>> --- a/xen/arch/x86/traps.c
>> +++ b/xen/arch/x86/traps.c
>> @@ -677,15 +677,21 @@ int cpuid_hypervisor_leaves( uint32_t idx, uint32_t sub_idx,
>> struct domain *d = current->domain;
>> /* Optionally shift out of the way of Viridian architectural leaves. */
>> uint32_t base = is_viridian_domain(d) ? 0x40000100 : 0x40000000;
>> - uint32_t limit;
>> + uint32_t limit, dummy;
>>
>> idx -= base;
>> + if ( idx > 3 )
>> + return 0; /* Avoid unnecessary pass through domain_cpuid() */
>>
>> - /*
>> - * Some Solaris PV drivers fail if max > base + 2. Help them out by
>> - * hiding the PVRDTSCP leaf if PVRDTSCP is disabled.
>> - */
>> - limit = (d->arch.tsc_mode < TSC_MODE_PVRDTSCP) ? 2 : 3;
>> + /* Number of leaves may be user-specified */
>> + domain_cpuid(d, base, 0, &limit, &dummy, &dummy, &dummy);
>> + limit &= 0xff;
>> + if ( (limit < 2) || (limit > 3) )
> So all of the sudden you also enforce a lower limit? That doesn't
> seem to belong here (and at a first glance it doesn't seem to be
> right either).
>
> There are two things you want enforce
> - limit never becoming zero due to user override (at once taking
> care of the no override case)
You think not having leaf 1 is something we should allow? I can see why
2 perhaps may be omitted.
> - limit never getting set higher than the hypervisor internal limit
> but that's unrelated to the Solaris specifics here, so should be
> handled separately (and in fact there's no point in having the
> fake revert in the next patch then: do the right thing here right
> away, as what the next patch does isn't really a revert anymore
> with the changes here in place).
Yes, I thought that reverting Solaris fix as a standalone patch may be too
much work for no benefit. I'll merge it into the first patch.
-boris
next prev parent reply other threads:[~2014-03-21 15:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-21 3:51 [PATCH v6 0/4] Expose HW APIC virtualization support to HVM guests Boris Ostrovsky
2014-03-21 3:51 ` [PATCH v6 1/4] xen/libxc: Allow changing max number of hypervisor cpuid leaves Boris Ostrovsky
2014-03-21 10:54 ` Jan Beulich
2014-03-21 15:13 ` Boris Ostrovsky [this message]
2014-03-21 15:15 ` Jan Beulich
2014-03-21 15:22 ` Boris Ostrovsky
2014-03-21 3:51 ` [PATCH v6 2/4] x86/hvm: Revert 80ecb40362365ba77e68fc609de8bd3b7208ae19 Boris Ostrovsky
2014-03-21 3:51 ` [PATCH v6 3/4] x86/hvm: Add HVM-specific hypervisor CPUID leaf Boris Ostrovsky
2014-03-21 3:51 ` [PATCH v6 4/4] x86/hvm: Indicate avaliability of HW support of APIC virtualization to HVM guests 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=532C5710.7070007@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=eddie.dong@intel.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jun.nakajima@intel.com \
--cc=keir@xen.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xen.org \
--cc=yang.z.zhang@intel.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).