* [PATCH] KVM: VMX: Remove redundant CPU_BASED_TPR_SHADOW check in nested_vmx_check_tpr_shadow_controls()
@ 2026-10-08 6:59 Peng Hao
0 siblings, 0 replies; only message in thread
From: Peng Hao @ 2026-10-08 6:59 UTC (permalink / raw)
To: pbonzini, seanjc; +Cc: kvm
The function returns early at the top if CPU_BASED_TPR_SHADOW is not set
in vmcs12, so any code that reaches the warn_on_missed_cc block is
guaranteed to have CPU_BASED_TPR_SHADOW set. The repeated check in the
if condition is always true and can be dropped.
Signed-off-by: Peng Hao <flyingpeng@tencent.com>
---
arch/x86/kvm/vmx/nested.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 151873407abd..a1f8adefbe35 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -619,7 +619,6 @@ static int nested_vmx_check_tpr_shadow_controls(struct kvm_vcpu *vcpu,
* if userspace hasn't yet configured memslots during state restore.
*/
if (warn_on_missed_cc && vcpu->wants_to_run &&
- nested_cpu_has(vmcs12, CPU_BASED_TPR_SHADOW) &&
!nested_cpu_has_vid(vmcs12) &&
!nested_cpu_has2(vmcs12, SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES) &&
!kvm_read_guest(vcpu->kvm, vtpr_gpa, &vtpr, sizeof(vtpr)) &&
--
2.43.7
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-08 6:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-08 6:59 [PATCH] KVM: VMX: Remove redundant CPU_BASED_TPR_SHADOW check in nested_vmx_check_tpr_shadow_controls() Peng Hao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox