From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, x86@kernel.org,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Roman Kagan" <rkagan@virtuozzo.com>,
"K. Y. Srinivasan" <kys@microsoft.com>,
"Haiyang Zhang" <haiyangz@microsoft.com>,
"Stephen Hemminger" <sthemmin@microsoft.com>,
"Michael Kelley (EOSG)" <Michael.H.Kelley@microsoft.com>,
"Mohammed Gamal" <mmorsy@redhat.com>,
"Cathy Avery" <cavery@redhat.com>,
"Tianyu Lan" <Tianyu.Lan@microsoft.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: VMX: hyper-v: Enlightened MSR-Bitmap support
Date: Fri, 13 Apr 2018 16:23:37 +0200 [thread overview]
Message-ID: <87muy7423a.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <ef082ed6-1af9-a578-d9da-e0874cc4769c@redhat.com> (Paolo Bonzini's message of "Fri, 13 Apr 2018 15:52:30 +0200")
Paolo Bonzini <pbonzini@redhat.com> writes:
> On 12/04/2018 17:25, Vitaly Kuznetsov wrote:
>> @@ -5335,6 +5353,9 @@ static void __always_inline vmx_disable_intercept_for_msr(unsigned long *msr_bit
>> if (!cpu_has_vmx_msr_bitmap())
>> return;
>>
>> + if (static_branch_unlikely(&enable_emsr_bitmap))
>> + evmcs_touch_msr_bitmap();
>> +
>> /*
>> * See Intel PRM Vol. 3, 20.6.9 (MSR-Bitmap Address). Early manuals
>> * have the write-low and read-high bitmap offsets the wrong way round.
>> @@ -5370,6 +5391,9 @@ static void __always_inline vmx_enable_intercept_for_msr(unsigned long *msr_bitm
>> if (!cpu_has_vmx_msr_bitmap())
>> return;
>>
>> + if (static_branch_unlikely(&enable_emsr_bitmap))
>> + evmcs_touch_msr_bitmap();
>
> I'm not sure about the "unlikely". Can you just check current_evmcs
> instead (dropping the static key completely)?
current_evmcs is just a cast:
(struct hv_enlightened_vmcs *)this_cpu_read(current_vmcs)
so it is always not NULL here :-) We need to check enable_evmcs static
key first. Getting rid of the newly added enable_emsr_bitmap is, of
course, possible.
(Actually, we only call vmx_{dis,en}able_intercept_for_msr in the very
beginning of vCPUs life so this is not a hotpath and likeliness doesn't
really matter).
Will do v2 without the static key, thanks!
>
> The function, also, is small enough that inlining should be beneficial.
>
> Paolo
--
Vitaly
prev parent reply other threads:[~2018-04-13 14:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-12 15:25 [PATCH] KVM: x86: VMX: hyper-v: Enlightened MSR-Bitmap support Vitaly Kuznetsov
2018-04-13 6:55 ` Tianyu Lan
2018-04-13 13:52 ` Paolo Bonzini
2018-04-13 14:23 ` Vitaly Kuznetsov [this message]
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=87muy7423a.fsf@vitty.brq.redhat.com \
--to=vkuznets@redhat.com \
--cc=Michael.H.Kelley@microsoft.com \
--cc=Tianyu.Lan@microsoft.com \
--cc=cavery@redhat.com \
--cc=haiyangz@microsoft.com \
--cc=kvm@vger.kernel.org \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mmorsy@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rkagan@virtuozzo.com \
--cc=rkrcmar@redhat.com \
--cc=sthemmin@microsoft.com \
--cc=x86@kernel.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).