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
1305}1305}
1306#endif /* CONFIG_HAVE_KVM_INVALID_WAKEUPS */1306#endif /* CONFIG_HAVE_KVM_INVALID_WAKEUPS */
1307 1307
1308#ifdef CONFIG_HAVE_KVM_NO_POLL
1309/* Callback that tells if we must not poll */
1310bool kvm_arch_no_poll(struct kvm_vcpu *vcpu);
1311#else
1312static inline bool kvm_arch_no_poll(struct kvm_vcpu *vcpu)
1313{
1314 return false;
1315}
1316#endif /* CONFIG_HAVE_KVM_NO_POLL */
1317
1308#ifdef CONFIG_HAVE_KVM_VCPU_ASYNC_IOCTL1318#ifdef CONFIG_HAVE_KVM_VCPU_ASYNC_IOCTL
1309long kvm_arch_vcpu_async_ioctl(struct file *filp,1319long kvm_arch_vcpu_async_ioctl(struct file *filp,
1310 unsigned int ioctl, unsigned long arg);1320 unsigned int ioctl, unsigned long arg);
virt/kvm/Kconfig+3−0
@@ -57,3 +57,6 @@ config HAVE_KVM_VCPU_ASYNC_IOCTL · 56 unmodified lines
57 57
58config HAVE_KVM_VCPU_RUN_PID_CHANGE58config HAVE_KVM_VCPU_RUN_PID_CHANGE
59 bool59 bool
60
61config 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
2253 u64 block_ns;2253 u64 block_ns;
2254 2254
2255 start = cur = ktime_get();2255 start = cur = ktime_get();
2256 if (vcpu->halt_poll_ns) {2256 if (vcpu->halt_poll_ns && !kvm_arch_no_poll(vcpu)) {
2257 ktime_t stop = ktime_add_ns(ktime_get(), vcpu->halt_poll_ns);2257 ktime_t stop = ktime_add_ns(ktime_get(), vcpu->halt_poll_ns);
2258 2258
2259 ++vcpu->stat.halt_attempted_poll;2259 ++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