All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
	Sergey Dyasli <sergey.dyasli@citrix.com>
Cc: Kevin Tian <kevin.tian@intel.com>,
	"jun.nakajima@intel.com" <jun.nakajima@intel.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH v2 1/4] x86/vmx: introduce vmwrite_safe()
Date: Tue, 7 Feb 2017 16:34:05 +0000	[thread overview]
Message-ID: <82363941-c419-6cf3-4a2a-9cc1b2aebba8@citrix.com> (raw)
In-Reply-To: <589A024302000078001374ED@prv-mh.provo.novell.com>

On 07/02/17 16:22, Jan Beulich wrote:
>>>> On 07.02.17 at 16:06, <sergey.dyasli@citrix.com> wrote:
>> If I understood correctly, you are suggesting the following change:
> Mostly.
>
>> --- a/xen/include/asm-x86/hvm/vmx/vmx.h
>> +++ b/xen/include/asm-x86/hvm/vmx/vmx.h
>> @@ -424,8 +424,8 @@ static inline unsigned long vmread_safe(unsigned long field,
>>      return ret;
>>  }
>>  
>> -static always_inline unsigned long vmwrite_safe(unsigned long field,
>> -                                                unsigned long value)
>> +static always_inline enum vmx_insn_errno vmwrite_safe(unsigned long field,
>> +                                                      unsigned long value)
>>  {
>>      unsigned long ret = 0;
>>      bool fail_invalid, fail_valid;
>> @@ -440,11 +440,16 @@ static always_inline unsigned long vmwrite_safe(unsigned long field,
>>                       [value] GAS_VMX_OP("rm", "c") (value));
>>  
>>      if ( unlikely(fail_invalid) )
>> +    {
>>          ret = VMX_INSN_FAIL_INVALID;
>> +    }
> No need to add braces here and ...
>
>>      else if ( unlikely(fail_valid) )
>> +    {
>>          __vmread(VM_INSTRUCTION_ERROR, &ret);
>> +        BUG_ON(ret >= ~0U);
>> +    }
>>  
>> -    return ret;
>> +    return (enum vmx_insn_errno) ret;
> ... no need for the cast here. (See Andrew's reply for the BUG_ON().)
>
>> And I have noticed one inconsistency: vmwrite_safe() is "always_inline"
>> while vmread_safe() is plain "inline". I believe that plain inline is
>> enough here, what do you think?
> I would assume plain inline to be enough, but maybe the VMX
> maintainers know why always_inline was used.

The always_inline was my doing IIRC, because the use of unlikely
sections caused GCC to create a separate identical functions in each
translation unit, in an attempt to minimise the quantity of out-of-line
code.

~Andrew

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

  reply	other threads:[~2017-02-07 16:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-06 14:57 [PATCH v2 0/4] x86/vvmx: correctly emulate VMREAD and VMWRITE Sergey Dyasli
2017-02-06 14:57 ` [PATCH v2 1/4] x86/vmx: introduce vmwrite_safe() Sergey Dyasli
2017-02-07  6:31   ` Tian, Kevin
2017-02-07 11:09   ` Jan Beulich
2017-02-07 11:59     ` Andrew Cooper
2017-02-07 13:18       ` Jan Beulich
2017-02-07 15:06     ` Sergey Dyasli
2017-02-07 15:22       ` Andrew Cooper
2017-02-07 16:22       ` Jan Beulich
2017-02-07 16:34         ` Andrew Cooper [this message]
2017-02-07 16:47           ` Jan Beulich
2017-02-06 14:57 ` [PATCH v2 2/4] x86/vmx: improve vmread_safe() Sergey Dyasli
2017-02-07  6:32   ` Tian, Kevin
2017-02-06 14:57 ` [PATCH v2 3/4] x86/vvmx: correctly emulate VMWRITE Sergey Dyasli
2017-02-07  6:37   ` Tian, Kevin
2017-02-06 14:57 ` [PATCH v2 4/4] x86/vvmx: correctly emulate VMREAD Sergey Dyasli
2017-02-07  6:52   ` Tian, Kevin
2017-02-07 15:56     ` Sergey Dyasli
2017-02-06 15:19 ` [PATCH v2 0/4] x86/vvmx: correctly emulate VMREAD and VMWRITE Andrew Cooper

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=82363941-c419-6cf3-4a2a-9cc1b2aebba8@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=sergey.dyasli@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 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.