History

KVM: polling: add architecture backend to disable polling

There are cases where halt polling is unwanted. For example when running KVM on an over committed LPAR we rather want to give back the CPU to neighbour LPARs instead of polling. Let us provide a callback that allows architectures to disable polling.

Christian Borntraeger committed 7 years ago

Commit cdd6ad31 parent 8ec2fa53 files · +14 −1Browse files

Unified · Split

3 files
  1. include/linux/kvm_host.h +10 −0
  2. virt/kvm/Kconfig +3 −0
  3. virt/kvm/kvm_main.c +1 −1
include/linux/kvm_host.h+10−0
@@ -1305,6 +1305,16 @@ static inline bool vcpu_valid_wakeup(struct kvm_vcpu *vcpu) · 1304 unmodified lines
13051305 }
13061306 #endif /* CONFIG_HAVE_KVM_INVALID_WAKEUPS */
13071307
1308+#ifdef CONFIG_HAVE_KVM_NO_POLL
1309+/* Callback that tells if we must not poll */
1310+bool kvm_arch_no_poll(struct kvm_vcpu *vcpu);
1311+#else
1312+static inline bool kvm_arch_no_poll(struct kvm_vcpu *vcpu)
1313+{
1314+ return false;
1315+}
1316+#endif /* CONFIG_HAVE_KVM_NO_POLL */
1317+
13081318 #ifdef CONFIG_HAVE_KVM_VCPU_ASYNC_IOCTL
13091319 long kvm_arch_vcpu_async_ioctl(struct file *filp,
13101320 unsigned int ioctl, unsigned long arg);
virt/kvm/Kconfig+3−0
@@ -57,3 +57,6 @@ config HAVE_KVM_VCPU_ASYNC_IOCTL · 56 unmodified lines
5757
5858 config HAVE_KVM_VCPU_RUN_PID_CHANGE
5959 bool
60+
61+config HAVE_KVM_NO_POLL
62+ bool
virt/kvm/kvm_main.c+1−1
@@ -2253,7 +2253,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) · 2252 unmodified lines
22532253 u64 block_ns;
22542254
22552255 start = cur = ktime_get();
2256− if (vcpu->halt_poll_ns) {
2256+ if (vcpu->halt_poll_ns && !kvm_arch_no_poll(vcpu)) {
22572257 ktime_t stop = ktime_add_ns(ktime_get(), vcpu->halt_poll_ns);
22582258
22592259 ++vcpu->stat.halt_attempted_poll;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t