[libvirt] Fix wrong nodeinfo->mhz when cpufreq is enabled

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

 



Hi,

I've written a little patch to fix wrong nodeinfo->mhz when the Linux
kernel module cpufreq and a typical governor like ondemand are loaded.
nodeinfo->mhz is then too low as libvirt just reads /proc/cpuinfo,
entry "cpu MHz". This patch reads

        /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

if existing and corrects nodeinfo->mhz if the value found is higher.
Using cpu0 is a crude hack but as discussed on IRC, considering different
governors/maximum frequencies per cpu/core would require changing the
nodeinfo struct, which would break the API.

Some more info: https://bugzilla.redhat.com/show_bug.cgi?id=559762

Please have a careful look at my patch, my last C is quite some time ago.
I tried to stick to linuxNodeInfoCPUPopulate, but f.e., checking for
"&& *p == '\0'" after virStrToLong_ui doesn't work and I'm wondering why
scaling_max_freq may not be terminated with by NUL? I also hope the file
handling is correct, but please have a look.

There is still some todo: Some logging would be helpful, maybe one of you
could point out which function best to use?

This is my first patch, so hopefully it follows in the next mail ;-)


kr,
tom

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]