kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/kvm: refine condition for checking vCPU preempted
@ 2023-02-15 12:12 lirongqing
  2023-03-15  0:15 ` Sean Christopherson
  0 siblings, 1 reply; 9+ messages in thread
From: lirongqing @ 2023-02-15 12:12 UTC (permalink / raw)
  To: kvm, x86

From: Li RongQing <lirongqing@baidu.com>

Check whether vcpu is preempted or not when HLT is trapped or there
is not realtime hint.
In other words, it is unnecessary to check preemption if HLT is not
intercepted and guest has realtime hint

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 arch/x86/kernel/kvm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 1cceac5..1a2744d 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -820,8 +820,10 @@ static void __init kvm_guest_init(void)
 		has_steal_clock = 1;
 		static_call_update(pv_steal_clock, kvm_steal_clock);
 
-		pv_ops.lock.vcpu_is_preempted =
-			PV_CALLEE_SAVE(__kvm_vcpu_is_preempted);
+		if (kvm_para_has_feature(KVM_FEATURE_PV_UNHALT) ||
+		     !kvm_para_has_hint(KVM_HINTS_REALTIME))
+			pv_ops.lock.vcpu_is_preempted =
+				PV_CALLEE_SAVE(__kvm_vcpu_is_preempted);
 	}
 
 	if (kvm_para_has_feature(KVM_FEATURE_PV_EOI))
-- 
2.9.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-04-06  7:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-15 12:12 [PATCH] x86/kvm: refine condition for checking vCPU preempted lirongqing
2023-03-15  0:15 ` Sean Christopherson
2023-03-15  3:49   ` Li,Rongqing
2023-03-15 15:26     ` Sean Christopherson
2023-03-16  3:48       ` Li,Rongqing
2023-03-16 17:00         ` Sean Christopherson
2023-03-30  8:15           ` Li,Rongqing
2023-03-30 19:26             ` Sean Christopherson
2023-04-06  7:26               ` Li,Rongqing

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).