The cpuidle_haltpoll driver, with the haltpoll governor, allows the guest vcpus to poll for a specified amount of time before halting.
This provides the following benefits to host side polling:
- The POLL flag is set while polling is performed, which allows a remote vCPU to avoid sending an IPI (and the associated cost of handling the IPI) when performing a wakeup.
- The VM-exit cost can be avoided.
The downside of guest side polling is that polling is performed even with other runnable tasks in the host.
The basic logic as follows: A global value,
guest_halt_poll_ns, is configured by the user, indicating the maximum amount of time polling is allowed. This value is fixed.
Each vcpu has an adjustable
guest_halt_poll_ns”), which is adjusted by the algorithm in response to events.
The module parameters can be set from the debugfs files in:
源码实现建议参考kvm performance optimization technologies, part two“Host/Guest halt poll”一节。