Re: [RFC] KVM: x86: Give host userspace control for MSR_RAPL_POWER_UNIT and MSR_PKG_POWER_STATUS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/18/2023 10:21 PM, Anthony Harivel wrote:
Allow userspace to update the MSR_RAPL_POWER_UNIT and
MSR_PKG_POWER_STATUS powercap registers. By default, these MSRs still
return 0.

This enables VMMs running on top of KVM with access to energy metrics
like /sys/devices/virtual/powercap/*/*/energy_uj to compute VMs power
values in proportion with other metrics (e.g. CPU %guest, steal time,
etc.) and periodically update the MSRs with ioctl KVM_SET_MSRS so that
the guest OS can consume them using power metering tools.

Cc: Paolo Bonzini <pbonzini@xxxxxxxxxx>
Cc: Christophe Fontaine <cfontain@xxxxxxxxxx>
Signed-off-by: Anthony Harivel <aharivel@xxxxxxxxxx>
---

Notes:
     The main goal of this patch is to bring a first step to give energy
     awareness to VMs.
As of today, KVM always report 0 in these MSRs since the entire host
     power consumption needs to be hidden from the guests. However, there is
     no fallback mechanism for VMs to measure their power usage.
The idea is to let the VMMs running on top of KVM periodically update
     those MSRs with representative values of the VM's power consumption.
If this solution is accepted, VMMs like QEMU will need to be patched to
     set proper values in these registers and enable power metering in
     guests.
I am submitting this as an RFC to get input/feedback from a broader
     audience who may be aware of potential side effects of such a mechanism.

Set aside how user space VMM emulate these 2 MSRs correctly, it can request the MSR READ to exit to user space via KVM_X86_SET_MSR_FILTER. So user space VMM can just enable the read filter of these 2 MSRs and provide the emulation itself.







[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux