I have installed XCP-ng 8.2.1 on some testing HW (Lenovo SR650). I created Ubuntu 20.04 VM on it and am running some performance tests.
I am able to monitor CPU frequency in Hypervisor via xenpm command:
[13:50 test-xcp-ng ~]# xenpm get-cpufreq-average | grep 'frequency: '
average cpu frequency: 1134540
average cpu frequency: 2227060
average cpu frequency: 1449690
average cpu frequency: 2248070
average cpu frequency: 1428680
average cpu frequency: 1869890
average cpu frequency: 2143020
average cpu frequency: 1764840
average cpu frequency: 2290090
average cpu frequency: 1554740
average cpu frequency: 2584230
average cpu frequency: 1050500
average cpu frequency: 2206050
average cpu frequency: 1071510
average cpu frequency: 1890900
average cpu frequency: 1050500
average cpu frequency: 1134540
average cpu frequency: 1113530
average cpu frequency: 1113530
average cpu frequency: 1092520
average cpu frequency: 1113530
average cpu frequency: 1113530
average cpu frequency: 1134540
average cpu frequency: 1092520
average cpu frequency: 1113530
average cpu frequency: 1113530
average cpu frequency: 1155550
average cpu frequency: 1134540
average cpu frequency: 1155550
average cpu frequency: 1155550
average cpu frequency: 1176560
average cpu frequency: 1176560
But /proc/cpuinfo
in Ubuntu VM shows only fixed CPU frequency:
root@test-vm:~# cat /proc/cpuinfo | grep -i mhz
cpu MHz : 2095.211
cpu MHz : 2095.211
cpu MHz : 2095.211
cpu MHz : 2095.211
Adding also lscpu
output (again same MHz as above):
root@test-vm:~# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 46 bits physical, 48 bits virtual
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 4
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Silver 4216 CPU @ 2.10GHz
Stepping: 7
CPU MHz: 2095.211
BogoMIPS: 4190.29
Hypervisor vendor: Xen
Virtualization type: full
L1d cache: 128 KiB
L1i cache: 128 KiB
L2 cache: 4 MiB
L3 cache: 88 MiB
NUMA node0 CPU(s): 0-3
Vulnerability Itlb multihit: KVM: Vulnerable
Vulnerability L1tf: Mitigation; PTE Inversion
Vulnerability Mds: Mitigation; Clear CPU buffers; SMT Host state unknown
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP disabled, RSB filling
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush acpi mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl cpuid pni pclmulqdq sss
e3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti intel_ppin ssbd ibrs ibp
b stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt clwb xsaveopt xsavec xgetbv1 xsaves pku ospke md_clear flush_l1d
In some cloud providers (e.g. AWS EC2), CPU frequency that is visible in /proc/cpuinfo
looks like current CPU frequency (looks "live" - changing on every run):
root@aws-instance:~# cat /proc/cpuinfo | grep -i mhz
cpu MHz : 3499.906
cpu MHz : 3500.627
cpu MHz : 3499.477
cpu MHz : 3501.732
cpu MHz : 3499.307
cpu MHz : 3499.868
cpu MHz : 3500.009
cpu MHz : 3499.829
root@aws-instance:~# cat /proc/cpuinfo | grep -i mhz
cpu MHz : 3500.867
cpu MHz : 3500.318
cpu MHz : 3500.907
cpu MHz : 3499.985
cpu MHz : 3500.236
cpu MHz : 3500.225
cpu MHz : 3499.921
cpu MHz : 3501.104
root@aws-instance:~# cat /proc/cpuinfo | grep -i mhz
cpu MHz : 3500.423
cpu MHz : 3500.150
cpu MHz : 3500.372
cpu MHz : 3500.026
cpu MHz : 3501.071
cpu MHz : 3500.911
cpu MHz : 3500.316
cpu MHz : 3500.048
I would like to monitor current CPU frequency in my Ubuntu VM that is running in XCP-ng hypervisor, similar to what I can see in AWS EC2 instance. Is that possible?