All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>, Jinsong Liu <jinsong.liu@intel.com>
Cc: "xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
	"keir@xen.org" <keir@xen.org>,
	"Ian.Campbell@citrix.com" <Ian.Campbell@citrix.com>,
	"haoxudong.hao@gmail.com" <haoxudong.hao@gmail.com>
Subject: Re: X86: generic MSRs save/restore
Date: Fri, 13 Dec 2013 12:04:07 +0000	[thread overview]
Message-ID: <52AAF7B7.9040904@citrix.com> (raw)
In-Reply-To: <52AAE5B4020000780010CE4F@nat28.tlf.novell.com>

On 13/12/2013 09:47, Jan Beulich wrote:
>>>> On 13.12.13 at 08:57, "Liu, Jinsong" <jinsong.liu@intel.com> wrote:
>> --- a/xen/arch/x86/hvm/vmx/vmx.c
>> +++ b/xen/arch/x86/hvm/vmx/vmx.c
>> @@ -580,6 +580,50 @@ static int vmx_load_vmcs_ctxt(struct vcp
>>      return 0;
>>  }
>>  
>> +static unsigned int __init vmx_init_msr(void)
>> +{
>> +    return !!cpu_has_mpx;
>> +}
>> +
>> +static void vmx_save_msr(struct vcpu *v, struct hvm_msr *ctxt)
>> +{
>> +    vmx_vmcs_enter(v);
>> +
>> +    if ( cpu_has_mpx )
>> +    {
>> +        __vmread(GUEST_BNDCFGS, &ctxt->msr[ctxt->count].val);
>> +        if ( ctxt->msr[ctxt->count].val )
>>
>>
>> Isn't it better to remove if()?
> Definitely not: That way, if the hardware support MPX but the
> guest never used it, restoring the guest on an MPX-incapable
> host will be possible. And when the MSR is zero, restoring on an
> MPX-capable host will be correct too, as the respective VMCS
> field starts out zeroed.
>
> Jan
>

Furthermore, this looks as if is heading straight for an ABI breakage.

What guarantee is that that the MSRs shall aways be saved and restored
in this specific order forever more in the future?

I think ctxt->count needs to be replaced with an ABI constant.

~Andrew

  reply	other threads:[~2013-12-13 12:04 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-03 14:50 [PATCH v5 4/7] X86: generic MSRs save/restore Liu, Jinsong
2013-12-04 14:18 ` Jan Beulich
2013-12-13  7:50   ` Liu, Jinsong
2013-12-13  9:44     ` Jan Beulich
2013-12-13  7:57   ` Liu, Jinsong
2013-12-13  9:47     ` Jan Beulich
2013-12-13 12:04       ` Andrew Cooper [this message]
2013-12-13 12:26         ` Jan Beulich
2013-12-13 14:01     ` [PATCH v2] x86: " Jan Beulich
2013-12-13 17:44       ` Andrew Cooper
2013-12-16  3:12         ` Liu, Jinsong
2013-12-16  8:03         ` Jan Beulich
2013-12-16  3:01       ` Liu, Jinsong
2013-12-16  8:04         ` Jan Beulich
2013-12-16  8:39           ` Liu, Jinsong
2013-12-16  8:52             ` Jan Beulich
2013-12-16  9:13               ` Liu, Jinsong
2013-12-16  9:41                 ` Jan Beulich
2013-12-16  9:53                   ` Liu, Jinsong
2013-12-16 10:01                     ` Jan Beulich
2013-12-16 10:05                       ` Liu, Jinsong
2013-12-16 11:11                         ` Jan Beulich
2013-12-16 13:23                           ` Liu, Jinsong
2013-12-16 13:34                             ` Jan Beulich
2013-12-16 13:57                               ` Liu, Jinsong
2013-12-16 14:01                                 ` Liu, Jinsong
2013-12-18 12:20       ` Liu, Jinsong
2013-12-13 14:02     ` [PATCH v2] x86: MSR_IA32_BNDCFGS save/restore Jan Beulich
2013-12-13 17:57       ` Andrew Cooper
2013-12-16  3:22         ` Liu, Jinsong
2013-12-16  8:06         ` Jan Beulich
2013-12-16  3:23       ` Liu, Jinsong

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=52AAF7B7.9040904@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=haoxudong.hao@gmail.com \
    --cc=jinsong.liu@intel.com \
    --cc=keir@xen.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.