All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Yury Norov <ynorov@caviumnetworks.com>,
	Jan Dakinevich <jan.dakinevich@gmail.com>
Cc: kvm@vger.kernel.org, rkrcmar@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: nVMX: expose INS/OUTS information support
Date: Mon, 5 Sep 2016 15:27:23 +0200	[thread overview]
Message-ID: <f027aa22-b7ee-88a4-4b1d-6bef77bd5a16@redhat.com> (raw)
In-Reply-To: <20160905091913.GA22817@yury-N73SV>



On 05/09/2016 11:19, Yury Norov wrote:
>> >  
>> > +static inline bool cpu_has_vmx_basic_inout(void)
> inline is useless. See Documentation/CodingStyle, Chapter 15

No, it's not.  See Documentation/CodingStyle, Chapter 15: "While the use
of inlines can be appropriate (for example as a means of replacing
macros, see Chapter 12), it very often is not".

>> > +{
>> > +	return	(((u64)vmcs_config.basic_cap << 32) & VMX_BASIC_INOUT);
> You can shift VMX_BASIC_INOUT (at compile time) and avoid the shifting of 
> vmcs_config.basic_cap at runtime.

Not really since VMX_BASIC_INOUT comes from the processor manual.

It's ironic that your first remark places a lot of trust in the
compiler, while the second places none.  The compiler is happy to
optimize away the left-shift/bitwise-AND pair to this:

	movq	%rdi, %rax
	shrq	$22, %rax
	andl	$1, %eax

where 22 is the order of VMX_BASIC_INOUT's only set bit, minus 32.

Paolo

  reply	other threads:[~2016-09-05 13:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-04 18:23 [PATCH] KVM: nVMX: expose INS/OUTS information support Jan Dakinevich
2016-09-05  9:19 ` Yury Norov
2016-09-05 13:27   ` Paolo Bonzini [this message]
2016-09-05 13:27 ` Paolo Bonzini
2016-09-05 14:47   ` [PATCH v2] " Jan Dakinevich
2016-09-05 14:50     ` Paolo Bonzini

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=f027aa22-b7ee-88a4-4b1d-6bef77bd5a16@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jan.dakinevich@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rkrcmar@redhat.com \
    --cc=ynorov@caviumnetworks.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 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.