[PATCH 2/2] KVM: s390: provide kvm_arch_no_poll function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We do track the current steal time of the host CPUs. Let us use
this value to disable halt polling if the steal time goes beyond
a predefined value. (12.5% for now).

Signed-off-by: Christian Borntraeger <borntraeger@xxxxxxxxxx>
---
 arch/s390/include/asm/kvm_host.h | 6 ++++++
 arch/s390/kvm/Kconfig            | 1 +
 2 files changed, 7 insertions(+)

diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index a4962761e1dd..f699983a8d09 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -884,6 +884,12 @@ struct kvm_arch_async_pf {
 	unsigned long pfault_token;
 };
 
+static inline bool kvm_arch_no_poll(void)
+{
+	/* do not poll with more than 12.5% steal */
+	return S390_lowcore.avg_steal_timer > (TICK_USEC << 12) / 8;
+}
+
 bool kvm_arch_can_inject_async_page_present(struct kvm_vcpu *vcpu);
 
 void kvm_arch_async_page_ready(struct kvm_vcpu *vcpu,
diff --git a/arch/s390/kvm/Kconfig b/arch/s390/kvm/Kconfig
index 767453faacfc..e987e73738b5 100644
--- a/arch/s390/kvm/Kconfig
+++ b/arch/s390/kvm/Kconfig
@@ -31,6 +31,7 @@ config KVM
 	select HAVE_KVM_IRQFD
 	select HAVE_KVM_IRQ_ROUTING
 	select HAVE_KVM_INVALID_WAKEUPS
+	select HAVE_KVM_NO_POLL
 	select SRCU
 	select KVM_VFIO
 	---help---
-- 
2.17.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux