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:57 PM CET, Paolo Bonzini wrote:
> 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?
>

The more often we can update the register, the more accurate we can be.
Not accurate in terms of consumption but in terms of time. Imagine
a burst of data that needs to be processed by a vCPU every 100ms, if we
update the registers every seconds we will never target which burst is
consuming the most. It's a total made up example but it gives an idea.
But we have to keep in mind that those energy counters are updated at
the average rate of ~1ms.


> > 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

I think this is great idea and would have worked perfectly if we were
able to get the individual core power consumption. However we are down
to, in the best case, to the power consumption of all Cores per package
(PP0/Core power plane). And in the server CPU Family (i.e Xeon), we only
have the Package power plane which include consumption of all cores in
the package plus the uncore power consumption (i.e. last level of caches
and memory controller; consumption of DRAM memory not included). So
depending on the workload of all the cores and the uses of the uncore
part, the energy counter of the package is increasing more or less
quicker between samples of the same period.

Anthony





[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