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 Fri, Jan 20, 2023 at 5:48 PM Anthony Harivel <aharivel@xxxxxxxxxx> wrote:
> So I'm wondering if the contexts switching (KVM->userpace->KVM) to
> update all MSRs will cause performance issues?

How often do you anticipate them to be read by the guest?

> What I'm pretty sure is that updating the values should be done
> separately from the callback that consume the value. This would ensure
> the consistency of the values.
>
> In the hypothesis those MSRs are handled within KVM, we can read MSRs
> with rdmsrl_safe() but how can we get the percentage of CPU used by Qemu
> to get a proportional value of the counter?

If you are okay with only counting the time spent in the guest, i.e.
not in QEMU, you can snapshot the energy value when the vCPU starts
(kvm_arch_vcpu_load, kvm_sched_in) and update it when the vCPU stops
(kvm_sched_out, kvm_get_msr and post_kvm_run_save).

Paolo




[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