From: Paolo Bonzini Subject: Re: [PATCH] KVM: x86: VMX: hyper-v: Enlightened MSR-Bitmap support Date: Fri, 13 Apr 2018 15:52:30 +0200 Message-ID: References: <20180412152508.27617-1-vkuznets@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: x86@kernel.org, =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Roman Kagan , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley (EOSG)" , Mohammed Gamal , Cathy Avery , Tianyu Lan , linux-kernel@vger.kernel.org To: Vitaly Kuznetsov , kvm@vger.kernel.org Return-path: In-Reply-To: <20180412152508.27617-1-vkuznets@redhat.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org 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)? The function, also, is small enough that inlining should be beneficial. Paolo