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

Re: KVM max CPU speed to guest




On 13.01.22 01:41, Igor Cicimov wrote:
> Hi,
> 
> On 13 Jan 2022 07:33, basti <mailinglist@unix-solution.de> wrote:
> 
>     Hello,
> 
>     first of all the most modern CPU in the last 10 years (I gues) use so
>     called speed-stepping.
> 
>     As I can see I was wondering why that speed stepping is not set in a
>     KVM
>     guest, even if I use "host-passthrough" in the cpu config of the guest.
> 
>     virsh dumpxml almalinux | grep -i cpu
>       <vcpu placement='static'>2</vcpu>
>       <cpu mode='host-passthrough' check='none' migratable='on'/>
> 
>     The cpu on the "host" is:
> 
>     root@q2:~# lscpu
>     Architecture:                    x86_64
>     CPU op-mode(s):                  32-bit, 64-bit
>     Byte Order:                      Little Endian
>     Address sizes:                   36 bits physical, 48 bits virtual
>     CPU(s):                          4
>     On-line CPU(s) list:             0-3
>     Thread(s) per core:              1
>     Core(s) per socket:              4
>     Socket(s):                       1
>     NUMA node(s):                    1
>     Vendor ID:                       GenuineIntel
>     CPU family:                      6
>     Model:                           76
>     Model name:                      Intel(R) Celeron(R) CPU  N3160  @
>     1.60GHz
>     Stepping:                        4
>     CPU MHz:                         480.096
>     CPU max MHz:                     2240.0000
>     CPU min MHz:                     480.0000
>     BogoMIPS:                        3200.00
>     Virtualization:                  VT-x
>     L1d cache:                       96 KiB
>     L1i cache:                       128 KiB
>     L2 cache:                        2 MiB
>     NUMA node0 CPU(s):               0-3
>     Vulnerability Itlb multihit:     Not affected
>     Vulnerability L1tf:              Not affected
>     Vulnerability Mds:               Vulnerable: Clear CPU buffers
>     attempted, no microcode; SMT disabled
>     Vulnerability Meltdown:          Mitigation; PTI
>     Vulnerability Spec store bypass: Not affected
>     Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers
>     and __user pointer sanitization
>     Vulnerability Spectre v2:        Mitigation; Full generic retpoline,
>     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 dts acpi mmx fxsr sse sse2
>     ss ht
>     tm pbe syscall nx rdtsc
>                                      p lm constant_tsc arch_perfmon pebs
>     bts
>     rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid aperfmperf
>     tsc_known_freq pni pclmulqdq d
>                                      tes64 monitor ds_cpl vmx est tm2 ssse3
>     cx16 xtpr pdcm sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes rdrand
>     lahf_lm 3dnowprefetch epb
>                                       pti tpr_shadow vnmi flexpriority ept
>     vpid tsc_adjust smep erms dtherm ida arat
>     root@q2:~#
> 
>     So the max cpu speed should be 2240 MHz.
> 
>     On the guest it is:
> 
>     [root@almalinux ~]# lscpu
>     Architektur:             x86_64
>     CPU Operationsmodus:     32-bit, 64-bit
>     Byte-Reihenfolge:        Little Endian
>     CPU(s):                  2
>     Liste der Online-CPU(s): 0,1
>     Thread(s) pro Kern:      1
>     Kern(e) pro Socket:      1
>     Sockel:                  2
>     NUMA-Knoten:             1
>     Anbieterkennung:         GenuineIntel
>     BIOS Vendor ID:          QEMU
>     Prozessorfamilie:        6
>     Modell:                  76
>     Modellname:              Intel(R) Celeron(R) CPU  N3160  @ 1.60GHz
>     BIOS Model name:         pc-i440fx-3.1
>     Stepping:                4
>     CPU MHz:                 1600.000
>     BogoMIPS:                3200.00
>     Virtualisierung:         VT-x
>     Hypervisor-Anbieter:     KVM
>     Virtualisierungstyp:     voll
>     L1d Cache:               32K
>     L1i Cache:               32K
>     L2 Cache:                4096K
>     L3 Cache:                16384K
>     NUMA-Knoten0 CPU(s):     0,1
>     Markierungen:            fpu vme de pse tsc msr pae mce cx8 apic sep
>     mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx
>     rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid
>     tsc_known_freq pni pclmulqdq vmx ssse3 cx16 pdcm sse4_1 sse4_2 x2apic
>     movbe popcnt tsc_deadline_timer aes rdrand hypervisor lahf_lm
>     3dnowprefetch cpuid_fault pti tpr_shadow vnmi flexpriority ept vpid
>     tsc_adjust smep erms arat umip arch_capabilities
> 
>     So I can't use the 2240 MHz in the guest.
>     When I set the cpu governor to "performance" on the host, it doesn't
>     matter. The host only see 1600 MHz.
> 
>     What's wrong there and how should I fix this?
> 
> Might be related to cpufreq daemon, what does cpufreq-info command on
> the host say? The cpu freq would dynamically scale on the host so if the
> guest is idle then it will have lower freq allocated. The parameters for
> the cpufreq governor are under /sys/devices/system/cpu/cpufreq/ in case
> you want to play with the config.


On the host all is fine.
The Problem seem to be the guest, the cpu freq would *not* dynamically
scale on it.

I found this: https://bugzilla.redhat.com/show_bug.cgi?id=670104

On the host and on the guest I see constant_tsc in the cpu flags.


Reply to: