Skip to content

KVM CPU frequency change hypercalls

Marcelo Tosatti kvm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 24 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3cpufreq: implement min/max/up/down functionsdrivers/cpufreq/cpufreq_userspace.c include/linux/cpufreq.h+179 -01 reply
2/3KVM: x86: introduce ioctl to allow frequency hypercallsarch/x86/include/asm/kvm_host.h arch/x86/include/uapi/asm/kvm.h arch/x86/kvm/x86.c +2 more+32 -04 replies
3/3KVM: x86: frequency change hypercallsDocumentation/virtual/kvm/hypercalls.txt arch/x86/kvm/x86.c include/uapi/linux/kvm_para.h+120 -14 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [patch 0/3] KVM CPU frequency change hypercalls

Implement KVM hypercalls for the guest
to issue frequency changes.

Current situation with DPDK and frequency changes is as follows:
An algorithm in the guest decides when to increase/decrease frequency based on the queue length of the device.

On the host, a power manager daemon is used to listen for frequency change requests (on another core) and issue these requests.

However frequency changes are performance sensitive events because:
On a change from low load condition to max load condition, the frequency should be raised as soon as possible. Sending a virtio-serial notification to another pCPU, waiting for that pCPU to initiate an IPI to the requestor pCPU to change frequency, is slower and more cache costly than a direct hypercall to host to switch the frequency.

If the pCPU where the power manager daemon is running is not busy spinning on requests from the isolated DPDK vcpus, there is also the cost of HLT wakeup for that pCPU.

Moreover, the daemon serves multiple VMs, meaning that the scheme is subject to additional delays from queueing of power change requests from VMs.

A direct hypercall from userspace is the fastest most direct method for the guest to change frequency and does not suffer from the issues above.

The usage scenario for this hypercalls is for pinned vCPUs <-> pCPUs.