From: Paolo Bonzini Subject: Re: [PATCH v4 2/5] KVM: x86: Add IBPB support Date: Wed, 31 Jan 2018 11:55:52 -0500 Message-ID: <7dbf6cad-f03d-640c-bc95-d82deaa30cb7@redhat.com> References: <1517404231-22406-1-git-send-email-karahmed@amazon.de> <1517404231-22406-3-git-send-email-karahmed@amazon.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: the arch/x86 maintainers , LKML , kvm list , Ashok Raj , Asit Mallick , Dave Hansen , Arjan Van De Ven , Tim Chen , Linus Torvalds , Andrea Arcangeli , Andi Kleen , Thomas Gleixner , Dan Williams , Jun Nakajima , Andy Lutomirski , Greg KH , Peter Zijlstra , David Woodhouse To: Jim Mattson , KarimAllah Ahmed Return-path: In-Reply-To: Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 31/01/2018 11:50, Jim Mattson wrote: >> + if (to_vmx(vcpu)->save_spec_ctrl_on_exit) { >> + nested_vmx_disable_intercept_for_msr( >> + msr_bitmap_l1, msr_bitmap_l0, >> + MSR_IA32_PRED_CMD, >> + MSR_TYPE_R); >> + } > I don't think this should be predicated on > "to_vmx(vcpu)->save_spec_ctrl_on_exit." Why not just > "guest_cpuid_has(vcpu, X86_FEATURE_IBPB)"? Also, the final argument to > nested_vmx_disable_intercept_for_msr should be MSR_TYPE_W rather than > MSR_TYPE_R. In fact this MSR can even be passed down unconditionally, since it needs no save/restore and has no ill performance effect on the sibling hyperthread. Only MSR_IA32_SPEC_CTRL needs to be conditional on "to_vmx(vcpu)->save_spec_ctrl_on_exit". Paolo