xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Haozhong Zhang <haozhong.zhang@intel.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Kevin Tian <kevin.tian@intel.com>, Wei Liu <wei.liu2@citrix.com>,
	IanCampbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	xen-devel@lists.xen.org, Jun Nakajima <jun.nakajima@intel.com>,
	Keir Fraser <keir@xen.org>
Subject: Re: [PATCH v2 1/2] x86/hvm: allow guest to use clflushopt and clwb
Date: Fri, 8 Jan 2016 16:27:14 +0800	[thread overview]
Message-ID: <20160108082714.GC3828@hz-desktop.sh.intel.com> (raw)
In-Reply-To: <568E858E02000078000C4716@prv-mh.provo.novell.com>

On 01/07/16 07:34, Jan Beulich wrote:
> >>> On 07.01.16 at 15:01, <andrew.cooper3@citrix.com> wrote:
> > On 07/01/16 13:49, Jan Beulich wrote:
> >>>>> On 30.12.15 at 12:48, <haozhong.zhang@intel.com> wrote:
> >>> --- a/xen/arch/x86/hvm/hvm.c
> >>> +++ b/xen/arch/x86/hvm/hvm.c
> >>> @@ -4583,21 +4583,30 @@ void hvm_cpuid(unsigned int input, unsigned int *eax, 
> > unsigned int *ebx,
> >>>              *edx &= ~cpufeat_mask(X86_FEATURE_PSE36);
> >>>          break;
> >>>      case 0x7:
> >>> -        if ( (count == 0) && !cpu_has_smep )
> >>> -            *ebx &= ~cpufeat_mask(X86_FEATURE_SMEP);
> >>> +        if ( count == 0 )
> >>> +        {
> >>> +            if ( !cpu_has_smep )
> >>> +                *ebx &= ~cpufeat_mask(X86_FEATURE_SMEP);
> >>> +
> >>> +            if ( !cpu_has_smap )
> >>> +                *ebx &= ~cpufeat_mask(X86_FEATURE_SMAP);
> >>> +
> >>> +            /* Don't expose MPX to hvm when VMX support is not available */
> >>> +            if ( !(vmx_vmexit_control & VM_EXIT_CLEAR_BNDCFGS) ||
> >>> +                 !(vmx_vmentry_control & VM_ENTRY_LOAD_BNDCFGS) )
> >>> +                *ebx &= ~cpufeat_mask(X86_FEATURE_MPX);
> >>>  
> >>> -        if ( (count == 0) && !cpu_has_smap )
> >>> -            *ebx &= ~cpufeat_mask(X86_FEATURE_SMAP);
> >>> +            /* Don't expose INVPCID to non-hap hvm. */
> >>> +            if ( !hap_enabled(d) )
> >>> +                *ebx &= ~cpufeat_mask(X86_FEATURE_INVPCID);
> >>>  
> >>> -        /* Don't expose MPX to hvm when VMX support is not available */
> >>> -        if ( (count == 0) &&
> >>> -             (!(vmx_vmexit_control & VM_EXIT_CLEAR_BNDCFGS) ||
> >>> -              !(vmx_vmentry_control & VM_ENTRY_LOAD_BNDCFGS)) )
> >>> -            *ebx &= ~cpufeat_mask(X86_FEATURE_MPX);
> >>> +            if ( !cpu_has_clflushopt )
> >>> +                *ebx &= ~cpufeat_mask(X86_FEATURE_CLFLUSHOPT);
> >>> +
> >>> +            if ( !cpu_has_clwb )
> >>> +                *ebx &= ~cpufeat_mask(X86_FEATURE_CLWB);
> >> I don't think we need this: Other than other things adjusted here,
> >> there's nothing disabling these two features when found available,
> >> and there are no extra conditions to consider. Otherwise, if we
> >> were to follow this route, quite a bit of code would need to be
> >> added to other case statements in this function. But that's all (I
> >> think) going to be taken care of by Andrew's CPUID leveling series.
> > 
> > My series does take care of all of this.
> > 
> > I would prefer that these two changes get taken as soon as they are
> > ready, so I can rebase.
> 
> If we don't need the change quoted above, your rebase will actually
> be easier to do.
> 
> Jan
>
I'll remove changes in hvm_cpuid() in the next version. Changes in
xen/include/asm-x86/cpufeature.h will be removed as well, because
there will be no use of them.

Haozhong

  reply	other threads:[~2016-01-08  8:27 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-30 11:48 [PATCH v2 0/2] add support for vNVDIMM - Part 1: enable instructions Haozhong Zhang
2015-12-30 11:48 ` [PATCH v2 1/2] x86/hvm: allow guest to use clflushopt and clwb Haozhong Zhang
2015-12-30 11:53   ` Andrew Cooper
2016-01-05  7:02   ` Tian, Kevin
2016-01-07 13:49   ` Jan Beulich
2016-01-07 14:01     ` Andrew Cooper
2016-01-07 14:34       ` Jan Beulich
2016-01-08  8:27         ` Haozhong Zhang [this message]
2016-01-08  8:39           ` Jan Beulich
2015-12-30 11:48 ` [PATCH v2 2/2] x86/hvm: add support for pcommit instruction Haozhong Zhang
2015-12-30 11:57   ` Andrew Cooper
2016-01-05  7:08   ` Tian, Kevin
2016-01-05  7:15     ` Zhang, Haozhong
2016-01-05  7:19       ` Tian, Kevin
2016-01-05  7:32         ` Zhang, Haozhong
2016-01-05  7:45           ` Tian, Kevin
2016-01-07 13:53   ` Jan Beulich
2016-01-08  1:15     ` Haozhong Zhang
2016-01-08  7:54       ` Jan Beulich
2016-01-08  7:58         ` Haozhong Zhang
2016-01-04 11:10 ` [PATCH v2 0/2] add support for vNVDIMM - Part 1: enable instructions Wei Liu

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=20160108082714.GC3828@hz-desktop.sh.intel.com \
    --to=haozhong.zhang@intel.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jun.nakajima@intel.com \
    --cc=keir@xen.org \
    --cc=kevin.tian@intel.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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).