From: Paolo Bonzini <pbonzini@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>, Feng Wu <feng.wu@intel.com>
Cc: gleb@redhat.com, hpa@zytor.com, kvm@vger.kernel.org
Subject: Re: [PATCH v4 2/4] KVM: Add SMAP support when setting CR4
Date: Fri, 11 Apr 2014 20:14:06 -0400 [thread overview]
Message-ID: <5348854E.4010007@redhat.com> (raw)
In-Reply-To: <20140410201234.GB26092@amt.cnet>
Il 10/04/2014 16:12, Marcelo Tosatti ha scritto:
> On Tue, Apr 01, 2014 at 05:46:34PM +0800, Feng Wu wrote:
>> This patch adds SMAP handling logic when setting CR4 for guests
>>
>> Thanks a lot to Paolo Bonzini for his suggestion to use the branchless
>> way to detect SMAP violation.
>>
>> Signed-off-by: Feng Wu <feng.wu@intel.com>
>>
>> @@ -110,10 +118,30 @@ static inline bool is_write_protection(struct kvm_vcpu *vcpu)
>> * Will a fault with a given page-fault error code (pfec) cause a permission
>> * fault with the given access (in ACC_* format)?
>> */
>> -static inline bool permission_fault(struct kvm_mmu *mmu, unsigned pte_access,
>> - unsigned pfec)
>> +static inline bool permission_fault(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu,
>> + unsigned pte_access, unsigned pfec)
>> {
>> - return (mmu->permissions[pfec >> 1] >> pte_access) & 1;
>> + int cpl = kvm_x86_ops->get_cpl(vcpu);
>> + unsigned long rflags = kvm_x86_ops->get_rflags(vcpu);
>
> Some branches added here (can't think of anything useful to avoid them).
Yeah, but most of them should be well predicted.
Paolo
next prev parent reply other threads:[~2014-04-12 0:14 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-01 9:46 [PATCH v4 0/4] KVM: enable Intel SMAP for KVM Feng Wu
2014-04-01 9:46 ` [PATCH v4 1/4] KVM: Remove SMAP bit from CR4_RESERVED_BITS Feng Wu
2014-04-01 9:46 ` [PATCH v4 2/4] KVM: Add SMAP support when setting CR4 Feng Wu
2014-04-10 20:12 ` Marcelo Tosatti
2014-04-12 0:14 ` Paolo Bonzini [this message]
2014-04-01 9:46 ` [PATCH v4 3/4] KVM: Disable SMAP for guests in EPT realmode and EPT unpaging mode Feng Wu
2014-04-01 9:46 ` [PATCH v4 4/4] KVM: expose SMAP feature to guest Feng Wu
2014-04-03 16:46 ` [PATCH v4 0/4] KVM: enable Intel SMAP for KVM Paolo Bonzini
2014-04-04 2:22 ` Wu, Feng
2014-04-04 7:27 ` Paolo Bonzini
2014-04-08 1:06 ` Wu, Feng
2014-04-08 20:38 ` Paolo Bonzini
2014-04-10 20:01 ` Marcelo Tosatti
2014-04-12 0:16 ` Paolo Bonzini
2014-04-12 0:17 ` Paolo Bonzini
2014-04-13 21:57 ` Marcelo Tosatti
2014-04-13 22:48 ` H. Peter Anvin
2014-04-10 20:16 ` Marcelo Tosatti
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=5348854E.4010007@redhat.com \
--to=pbonzini@redhat.com \
--cc=feng.wu@intel.com \
--cc=gleb@redhat.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.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 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).