xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Kevin Tian <kevin.tian@intel.com>, Wei Liu <wei.liu2@citrix.com>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Jun Nakajima <jun.nakajima@intel.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH 2/3] x86/HVM: support (emulate) UMIP
Date: Wed, 7 Dec 2016 16:06:55 +0000	[thread overview]
Message-ID: <77abc5a0-c6fe-b0d5-fec0-9506a2806da4@citrix.com> (raw)
In-Reply-To: <58483B5902000078001265B8@prv-mh.provo.novell.com>

On 07/12/16 15:39, Jan Beulich wrote:
>>>> On 07.12.16 at 16:31, <boris.ostrovsky@oracle.com> wrote:
>> On 12/07/2016 10:14 AM, Jan Beulich wrote:
>>>>>> On 07.12.16 at 16:10, <boris.ostrovsky@oracle.com> wrote:
>>>> On 12/07/2016 06:29 AM, Jan Beulich wrote:
>>>>>>>> On 06.12.16 at 17:23, <boris.ostrovsky@oracle.com> wrote:
>>>>>> On 12/06/2016 06:44 AM, Jan Beulich wrote:
>>>>>>> --- a/xen/arch/x86/cpuid.c
>>>>>>> +++ b/xen/arch/x86/cpuid.c
>>>>>>> @@ -154,6 +154,13 @@ static void __init calculate_hvm_feature
>>>>>>>      __set_bit(X86_FEATURE_APIC, hvm_featureset);
>>>>>>>  
>>>>>>>      /*
>>>>>>> +     * Xen can often provide UMIP emulation to HVM guests even if the host
>>>>>>> +     * doesn't have such functionality.
>>>>>>> +     */
>>>>>>> +    if ( cpu_has_vmx_dt_exiting || cpu_has_svm )
>>>>>>> +        __set_bit(X86_FEATURE_UMIP, hvm_featureset);
>>>>>> I don't think I understand how this is going to work for processors that
>>>>>> don't support UMIP.
>>>>>>
>>>>>> How, for example, can guest_cr[4] have X86_CR4_UMIP set on these
>>>>>> processors when CPUID will not show the feature being there?
>>>>> What we allow the guest to see and what we store into hardware
>>>>> registers are two different things: Note how svm_update_guest_cr()
>>>>> masks off X86_CR4_UMIP from the vale to be put into the VMCB.
>>>> So that was kind of my question --- why would a guest ever try to set
>>>> this bit? As far as it is concerned, UMIP is not available and the guest
>>>> is then trying to set an unsupported bit in cr4. And that should result
>>>> in a #GP.
>>> But the code fragment above adds the respective CPUID bit to the
>>> permitted features. Believe me, I've tried this with a UMIP-enabled
>>> Linux (including proper CPUID based detection).
>> Are you referring to these patches: https://lkml.org/lkml/2016/11/8/68 ?
>> If yes then they look to be Intel-specific.
> No, I had written my own before these had been posted. I did
> actually post mine too, but that was a week or so after theirs,
> and theirs appears to be more complete.
>
>> If AMD decides to use CPUID0x7.ecx[2] for something else --- won't this
>> be a problem for this patch?
> I think the two vendors meanwhile do a good job not interfering with
> one another's CPUID bits. We'd have ugly problems elsewhere if any
> new dual purpose CPUID bit appeared.

[root@minuet-1 ~]# head /proc/cpuinfo
processor    : 0
vendor_id    : AuthenticAMD
cpu family    : 21
model        : 96

[root@minuet-1 ~]# xen-cpuid
nr_features: 10
                      KEY 1d       1c       e1d      e1c      Da1     
7b0      7c0      e7d      e8b      7d0     

Static sets:
Known                    
b7ebfbff:fffef3ff:efd3fbff:2469bfff:0000000f:fdbfffff:0000001b:00000500:00000001:0000000c
Special                  
10000200:88200000:00000000:00000002:00000000:00002040:00000010:00000000:00000000:00000000
PV Mask                  
17c9cbf5:f6f83203:e2500800:042109e3:00000007:fdaf0b39:00000003:00000000:00000001:0000000c
HVM Shadow Mask          
17cbfbff:f7f83223:ea500800:04218df7:0000000f:fdbf4bbb:00000003:00000000:00000001:0000000c
HVM Hap Mask             
17cbfbff:f7fa3223:ee500800:04218df7:0000000f:fdbf4fbb:0000000b:00000000:00000001:0000000c

Dynamic sets:
Raw                      
178bfbff:fed8320b:2fd3fbff:2febbfff:00000001:000001a9:00000000:000037d9:00000000:00000000
Host                     
178bf3ff:f6d8320b:2fd3fbff:2469bfff:00000001:000001a9:00000000:00000500:00000000:00000000
PV                       
1789c3f5:f6f83203:23d1cbf5:042109e3:00000001:00000129:00000000:00000000:00000000:00000000
HVM                      
178bfbff:f6f83203:2fd3fbff:04218df7:00000001:000001a9:00000000:00000000:00000000:00000000


This processor already implements some of Intel's features from
0x7[0].ebx, including SMEP.  According to marketing, AMD Zen processors
will add the ADX, RDSEED, SHA, CLFLUSHOPT and SMAP features

I can't reasonably see them using a different feature word.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-12-07 16:09 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-06 11:35 [PATCH 0/3] x86/HVM: misc improvements Jan Beulich
2016-12-06 11:43 ` [PATCH 1/3] x86/HVM: introduce hvm_get_cpl() and respective hook Jan Beulich
2016-12-06 12:16   ` Razvan Cojocaru
2016-12-06 13:49   ` Andrew Cooper
2016-12-06 14:07     ` Jan Beulich
2016-12-06 14:10       ` Andrew Cooper
2016-12-06 15:49   ` Boris Ostrovsky
2016-12-07  6:21   ` Tian, Kevin
2016-12-13  8:45   ` Ping: " Jan Beulich
2016-12-13  9:33     ` Tim Deegan
2016-12-06 11:44 ` [PATCH 2/3] x86/HVM: support (emulate) UMIP Jan Beulich
2016-12-06 14:47   ` Andrew Cooper
2016-12-06 14:55     ` Jan Beulich
2016-12-06 14:57       ` Andrew Cooper
2016-12-08 12:20     ` Jan Beulich
2016-12-09 18:42       ` Andrew Cooper
2016-12-06 16:23   ` Boris Ostrovsky
2016-12-07 11:29     ` Jan Beulich
2016-12-07 15:10       ` Boris Ostrovsky
2016-12-07 15:14         ` Jan Beulich
2016-12-07 15:31           ` Boris Ostrovsky
2016-12-07 15:39             ` Jan Beulich
2016-12-07 16:06               ` Andrew Cooper [this message]
2016-12-08  8:20                 ` Tian, Kevin
2016-12-26  3:56                 ` Suravee Suthikulpanit
2016-12-06 11:45 ` [PATCH 3/3] x86/HVM: prefer structure assignment for seg reg copying Jan Beulich
2016-12-06 11:47   ` Paul Durrant
2016-12-06 13:55   ` Andrew Cooper
2016-12-06 16:25   ` 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=77abc5a0-c6fe-b0d5-fec0-9506a2806da4@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /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).