From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] KVM: nVMX: nested TPR shadow/threshold emulation Date: Fri, 01 Aug 2014 08:35:03 +0200 Message-ID: <53DB3517.1010408@redhat.com> References: <1406721880-5490-1-git-send-email-wanpeng.li@linux.intel.com> <53D90D5A.3060404@redhat.com> <20140731080353.GA3033@kernel> <53DA0B91.1010703@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , Gleb Natapov , Bandan Das , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" To: "Zhang, Yang Z" , Wanpeng Li , Jan Kiszka Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org Il 01/08/2014 02:57, Zhang, Yang Z ha scritto: > > TPR_THRESHOLD will be likely written as zero, but the processor will > > never use it anyway. It's just a small optimization because > > nested_cpu_has(vmcs12, CPU_BASED_TPR_SHADOW) will almost always be true. > > Theoretically, you are right. But we should not expect all VMMs > follow it. It is not worth to violate the SDM just for saving two or > three instructions' cost. Yes, you do need an "if (cpu_has_vmx_tpr_shadow())" around the vmcs_write32. But still, checking nested_cpu_has is not strictly necessary. Right now they both are a single AND, but I have plans to change all of the cpu_has_*() checks to static keys. Paolo