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.
Unified · Split
| @@ -1305,6 +1305,16 @@ static inline bool vcpu_valid_wakeup(struct kvm_vcpu *vcpu) · 1304 unmodified lines | ||
| 1305 | 1305 | } |
| 1306 | 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 */ | |
| 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 | + | |
| 1308 | 1318 | #ifdef CONFIG_HAVE_KVM_VCPU_ASYNC_IOCTL |
| 1309 | 1319 | long kvm_arch_vcpu_async_ioctl(struct file *filp, |
| 1310 | 1320 | unsigned int ioctl, unsigned long arg); |
| @@ -57,3 +57,6 @@ config HAVE_KVM_VCPU_ASYNC_IOCTL · 56 unmodified lines | ||
| 57 | 57 | |
| 58 | 58 | config HAVE_KVM_VCPU_RUN_PID_CHANGE |
| 59 | 59 | bool |
| 60 | + | |
| 61 | +config HAVE_KVM_NO_POLL | |
| 62 | + bool | |
| @@ -2253,7 +2253,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) · 2252 unmodified lines | ||
| 2253 | 2253 | u64 block_ns; |
| 2254 | 2254 | |
| 2255 | 2255 | start = cur = ktime_get(); |
| 2256 | − if (vcpu->halt_poll_ns) { | |
| 2256 | + if (vcpu->halt_poll_ns && !kvm_arch_no_poll(vcpu)) { | |
| 2257 | 2257 | ktime_t stop = ktime_add_ns(ktime_get(), vcpu->halt_poll_ns); |
| 2258 | 2258 | |
| 2259 | 2259 | ++vcpu->stat.halt_attempted_poll; |