Skip to content

CPU frequency detection not maximum on Rocky 8 #5497

Closed

Description

@leolleeooleo
ISSUE TYPE
  • Improvement Request
COMPONENT NAME
agent
CLOUDSTACK VERSION
4.15.2.0
CONFIGURATION

N/A

OS / ENVIRONMENT

CentOS 8/Rocky 8

SUMMARY

CPU capability detection error.
Because cloudstack-agent detected CPU is running at low frequency,
Not the CPU Maximum frequency.
When start VM will show "Cannot deploy the VM to specified host 21; host has cpu capability? false, host has capacity? true"
While I override value in database, it works fine.
But restart cloudstack-agent will be override by new detect low frequency.

$mysql
update host set speed = 2660 where id = 21;
STEPS TO REPRODUCE
$ cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 44
model name      : Intel(R) Xeon(R) CPU           E5640  @ 2.67GHz
stepping        : 2
microcode       : 0x1f
cpu MHz         : 1595.704
cache size      : 12288 KB
physical id     : 1
siblings        : 8
core id         : 0
cpu cores       : 4
apicid          : 32
initial apicid  : 32
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
wp              : yes
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 ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 popcnt aes lahf_lm pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid dtherm ida arat flush_l1d
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips        : 5320.07
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:

image

EXPECTED RESULTS
cpu frequency * core * cpu.overprovisioning.factor = CPU Total
2.66 GHz * 16 * 32 = 1361.92 GHz
ACTUAL RESULTS
cpu frequency * core * cpu.overprovisioning.factor = CPU Total
1595.704 MHz * 16 * 32 = 817 GHz

Activity

  1. yadvr commented on Sep 22, 2021

    @yadvr
    Member
  2. added this to the 4.16.0.0 milestone on Sep 22, 2021
  3. davidjumani commented on Sep 23, 2021

    @davidjumani
    Contributor

    This could be OS related, in the env I've tested, the CPU Mhz matches the CPU Max frequency

    [# cat /proc/cpuinfo 
    
    processor	: 0
    vendor_id	: GenuineIntel
    cpu family	: 6
    model		: 85
    model name	: Intel(R) Xeon(R) Gold 5218R CPU @ 2.10GHz
    stepping	: 7
    microcode	: 0x5003003
    cpu MHz		: 2100.000             <---- Matches ^^
    cache size	: 28160 KB
    physical id	: 0
    siblings	: 1
    core id		: 0
    cpu cores	: 1
    apicid		: 0
    initial apicid	: 0
    fpu		: yes
    fpu_exception	: yes
    cpuid level	: 22
    wp		: yes
    flags		: 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 pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq vmx ssse3 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 ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xsaves arat pku ospke md_clear flush_l1d arch_capabilities
    bugs		: spectre_v1 spectre_v2 spec_store_bypass swapgs itlb_multihit
    bogomips	: 4200.00
    clflush size	: 64
    cache_alignment	: 64
    address sizes	: 43 bits physical, 48 bits virtual
    power management:
    

    Also, Cloudstack fetches the CPU speed from libvirt
    https://github.com/apache/cloudstack/blob/main/plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/utils/linux/KVMHostInfo.java#L93

  4. leolleeooleo commented on Sep 23, 2021

    @leolleeooleo
    ContributorAuthor

    The file /proc/cpuinfo in CentOS 7 was Max frequency,
    CentOS 8 and Rocky 8 are not always Max frequency, depend on idle or busy.

    I get the log from here
    https://github.com/apache/cloudstack/blob/4.15.2.0/plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/utils/linux/KVMHostInfo.java#L85

    tail -f /var/log/cloudstack/agent/agent.log
    2021-09-23 16:17:43,954 INFO  [utils.linux.KVMHostInfo] (Agent-Handler-1:null) (logid:) Could not read cpuinfo_max_freq, falling back on libvirt
    

    And I had try (CentOS 7, CentOS 8, Rocky 8 are same)
    and this only on Dell PowerEdge R410 and R610, others hardware are fine.

    $ cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
    cat: /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq: No such file or directory
    

    Director tree on Rocky 8 (Dell PowerEdge R410)

    $ tree /sys/devices/system/cpu/cpu0
    /sys/devices/system/cpu/cpu0
    ├── cache
    │   ├── index0
    │   │   ├── coherency_line_size
    │   │   ├── id
    │   │   ├── level
    │   │   ├── number_of_sets
    │   │   ├── physical_line_partition
    │   │   ├── shared_cpu_list
    │   │   ├── shared_cpu_map
    │   │   ├── size
    │   │   ├── type
    │   │   ├── uevent
    │   │   └── ways_of_associativity
    │   ├── index1
    │   │   ├── coherency_line_size
    │   │   ├── id
    │   │   ├── level
    │   │   ├── number_of_sets
    │   │   ├── physical_line_partition
    │   │   ├── shared_cpu_list
    │   │   ├── shared_cpu_map
    │   │   ├── size
    │   │   ├── type
    │   │   ├── uevent
    │   │   └── ways_of_associativity
    │   ├── index2
    │   │   ├── coherency_line_size
    │   │   ├── id
    │   │   ├── level
    │   │   ├── number_of_sets
    │   │   ├── physical_line_partition
    │   │   ├── shared_cpu_list
    │   │   ├── shared_cpu_map
    │   │   ├── size
    │   │   ├── type
    │   │   ├── uevent
    │   │   └── ways_of_associativity
    │   ├── index3
    │   │   ├── coherency_line_size
    │   │   ├── id
    │   │   ├── level
    │   │   ├── number_of_sets
    │   │   ├── physical_line_partition
    │   │   ├── shared_cpu_list
    │   │   ├── shared_cpu_map
    │   │   ├── size
    │   │   ├── type
    │   │   ├── uevent
    │   │   └── ways_of_associativity
    │   └── uevent
    ├── cpuidle
    │   ├── state0
    │   │   ├── above
    │   │   ├── below
    │   │   ├── default_status
    │   │   ├── desc
    │   │   ├── disable
    │   │   ├── latency
    │   │   ├── name
    │   │   ├── power
    │   │   ├── residency
    │   │   ├── time
    │   │   └── usage
    │   ├── state1
    │   │   ├── above
    │   │   ├── below
    │   │   ├── default_status
    │   │   ├── desc
    │   │   ├── disable
    │   │   ├── latency
    │   │   ├── name
    │   │   ├── power
    │   │   ├── residency
    │   │   ├── s2idle
    │   │   │   ├── time
    │   │   │   └── usage
    │   │   ├── time
    │   │   └── usage
    │   ├── state2
    │   │   ├── above
    │   │   ├── below
    │   │   ├── default_status
    │   │   ├── desc
    │   │   ├── disable
    │   │   ├── latency
    │   │   ├── name
    │   │   ├── power
    │   │   ├── residency
    │   │   ├── s2idle
    │   │   │   ├── time
    │   │   │   └── usage
    │   │   ├── time
    │   │   └── usage
    │   ├── state3
    │   │   ├── above
    │   │   ├── below
    │   │   ├── default_status
    │   │   ├── desc
    │   │   ├── disable
    │   │   ├── latency
    │   │   ├── name
    │   │   ├── power
    │   │   ├── residency
    │   │   ├── s2idle
    │   │   │   ├── time
    │   │   │   └── usage
    │   │   ├── time
    │   │   └── usage
    │   └── state4
    │       ├── above
    │       ├── below
    │       ├── default_status
    │       ├── desc
    │       ├── disable
    │       ├── latency
    │       ├── name
    │       ├── power
    │       ├── residency
    │       ├── s2idle
    │       │   ├── time
    │       │   └── usage
    │       ├── time
    │       └── usage
    ├── crash_notes
    ├── crash_notes_size
    ├── driver -> ../../../../bus/cpu/drivers/processor
    ├── firmware_node -> ../../../LNXSYSTM:00/LNXCPU:00
    ├── hotplug
    │   ├── fail
    │   ├── state
    │   └── target
    ├── microcode
    │   ├── processor_flags
    │   └── version
    ├── node0 -> ../../node/node0
    ├── online
    ├── power
    │   ├── autosuspend_delay_ms
    │   ├── control
    │   ├── pm_qos_resume_latency_us
    │   ├── runtime_active_time
    │   ├── runtime_status
    │   └── runtime_suspended_time
    ├── subsystem -> ../../../../bus/cpu
    ├── thermal_throttle
    │   └── core_throttle_count
    ├── topology
    │   ├── core_cpus
    │   ├── core_cpus_list
    │   ├── core_id
    │   ├── core_siblings
    │   ├── core_siblings_list
    │   ├── die_cpus
    │   ├── die_cpus_list
    │   ├── die_id
    │   ├── package_cpus
    │   ├── package_cpus_list
    │   ├── physical_package_id
    │   ├── thread_siblings
    │   └── thread_siblings_list
    └── uevent
    
    24 directories, 137 files
    
  5. changed the title [-]CPU frequency detection not maxmum on Rocky 8[/-] [+]CPU frequency detection not maximum on Rocky 8[/+] on Sep 23, 2021
  6. leolleeooleo commented on Sep 23, 2021

    @leolleeooleo
    ContributorAuthor

    On CentOS 7

    $ virsh nodeinfo
    CPU model:           x86_64
    CPU(s):              16
    CPU frequency:       2660 MHz
    CPU socket(s):       1
    Core(s) per socket:  4
    Thread(s) per core:  2
    NUMA cell(s):        2
    Memory size:         98814940 KiB
    

    On Rocky 8

    $ virsh nodeinfo
    CPU model:           x86_64
    CPU(s):              16
    CPU frequency:       1596 MHz
    CPU socket(s):       1
    Core(s) per socket:  4
    Thread(s) per core:  2
    NUMA cell(s):        2
    Memory size:         98699544 KiB
    
  7. davidjumani commented on Sep 23, 2021

    @davidjumani
    Contributor

    When it is unable to find the cpuinfo_max_freq file, it falls back on the data reported by libvirt.
    It looks like a non cloudstack issue since it only faces the problem on specific hardware and OS
    As a workaround we can look into a different way of fetching the max cpu in the agent

  8. leolleeooleo commented on Sep 23, 2021

    @leolleeooleo
    ContributorAuthor

    Here are I can get the maximum frequency

    $ lshw
         *-cpu:0
              description: CPU
              product: Intel(R) Xeon(R) CPU           E5640  @ 2.67GHz
              vendor: Intel Corp.
              physical id: 400
              bus info: cpu@0
              version: 6.44.2
              slot: CPU1
              size: 2666MHz                                                    <---------here
              capacity: 3600MHz
              width: 64 bits
              clock: 1565MHz
              capabilities: lm fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ht tm pbe syscall nx pdpe1gb rdtscp x86-64 constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 popcnt aes lahf_lm pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid dtherm ida arat flush_l1d
    
    $ dmidecode -t processor
    # dmidecode 3.2
    Getting SMBIOS data from sysfs.
    SMBIOS 2.6 present.
    
    Handle 0x0400, DMI type 4, 40 bytes
    Processor Information
            Socket Designation: CPU1
            Type: Central Processor
            Family: Xeon
            Manufacturer: Intel
            ID: C2 06 02 00 FF FB EB BF
            Signature: Type 0, Family 6, Model 44, Stepping 2
            Flags:
                    FPU (Floating-point unit on-chip)
                    VME (Virtual mode extension)
                    DE (Debugging extension)
                    PSE (Page size extension)
                    TSC (Time stamp counter)
                    MSR (Model specific registers)
                    PAE (Physical address extension)
                    MCE (Machine check exception)
                    CX8 (CMPXCHG8 instruction supported)
                    APIC (On-chip APIC hardware supported)
                    SEP (Fast system call)
                    MTRR (Memory type range registers)
                    PGE (Page global enable)
                    MCA (Machine check architecture)
                    CMOV (Conditional move instruction supported)
                    PAT (Page attribute table)
                    PSE-36 (36-bit page size extension)
                    CLFSH (CLFLUSH instruction supported)
                    DS (Debug store)
                    ACPI (ACPI supported)
                    MMX (MMX technology supported)
                    FXSR (FXSAVE and FXSTOR instructions supported)
                    SSE (Streaming SIMD extensions)
                    SSE2 (Streaming SIMD extensions 2)
                    SS (Self-snoop)
                    HTT (Multi-threading)
                    TM (Thermal monitor supported)
                    PBE (Pending break enabled)
            Version: Intel(R) Xeon(R) CPU           E5640  @ 2.67GHz
            Voltage: 1.2 V
            External Clock: 5860 MHz
            Max Speed: 3600 MHz
            Current Speed: 2666 MHz                                                    <---------here
            Status: Populated, Enabled
            Upgrade: Socket LGA1366
            L1 Cache Handle: 0x0700
            L2 Cache Handle: 0x0701
            L3 Cache Handle: 0x0702
            Serial Number: Not Specified
            Asset Tag: Not Specified
            Part Number: Not Specified
            Core Count: 4
            Core Enabled: 4
            Thread Count: 8
            Characteristics:
                    64-bit capable
    
    Handle 0x0401, DMI type 4, 40 bytes
    Processor Information
            Socket Designation: CPU2
            Type: Central Processor
            Family: Xeon
            Manufacturer: Intel
            ID: C2 06 02 00 FF FB EB BF
            Signature: Type 0, Family 6, Model 44, Stepping 2
            Flags:
                    FPU (Floating-point unit on-chip)
                    VME (Virtual mode extension)
                    DE (Debugging extension)
                    PSE (Page size extension)
                    TSC (Time stamp counter)
                    MSR (Model specific registers)
                    PAE (Physical address extension)
                    MCE (Machine check exception)
                    CX8 (CMPXCHG8 instruction supported)
                    APIC (On-chip APIC hardware supported)
                    SEP (Fast system call)
                    MTRR (Memory type range registers)
                    PGE (Page global enable)
                    MCA (Machine check architecture)
                    CMOV (Conditional move instruction supported)
                    PAT (Page attribute table)
                    PSE-36 (36-bit page size extension)
                    CLFSH (CLFLUSH instruction supported)
                    DS (Debug store)
                    ACPI (ACPI supported)
                    MMX (MMX technology supported)
                    FXSR (FXSAVE and FXSTOR instructions supported)
                    SSE (Streaming SIMD extensions)
                    SSE2 (Streaming SIMD extensions 2)
                    SS (Self-snoop)
                    HTT (Multi-threading)
                    TM (Thermal monitor supported)
                    PBE (Pending break enabled)
            Version: Intel(R) Xeon(R) CPU           E5640  @ 2.67GHz
            Voltage: 1.2 V
            External Clock: 5860 MHz
            Max Speed: 3600 MHz
            Current Speed: 2666 MHz
            Status: Populated, Idle
            Upgrade: Socket LGA1366
            L1 Cache Handle: 0x0703
            L2 Cache Handle: 0x0704
            L3 Cache Handle: 0x0705
            Serial Number: Not Specified
            Asset Tag: Not Specified
            Part Number: Not Specified
            Core Count: 4
            Core Enabled: 4
            Thread Count: 8
            Characteristics:
                    64-bit capable
    
  9. leolleeooleo commented on Sep 23, 2021

    @leolleeooleo
    ContributorAuthor

    Maybe I found the problem is.

    Dell Server BIOS has Power Management Profile setting.
    It is set to Active Power Controller (Dell designed, BIOS controlled processor frequency scaling).
    I'll try to set it to OS Control (Operating system controlled processor frequency scaling).

  10. leolleeooleo commented on Sep 24, 2021

    @leolleeooleo
    ContributorAuthor

    While I set Power Management Profile to OS Control, it can get maximum frequency.

    $ cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
    2661000
    
    $ lscpu
    Architecture:        x86_64
    CPU op-mode(s):      32-bit, 64-bit
    Byte Order:          Little Endian
    CPU(s):              16
    On-line CPU(s) list: 0-15
    Thread(s) per core:  2
    Core(s) per socket:  4
    Socket(s):           2
    NUMA node(s):        2
    Vendor ID:           GenuineIntel
    CPU family:          6
    Model:               44
    Model name:          Intel(R) Xeon(R) CPU           E5640  @ 2.67GHz
    Stepping:            2
    CPU MHz:             1684.177
    CPU max MHz:         2661.0000
    CPU min MHz:         1596.0000
    BogoMIPS:            5320.06
    Virtualization:      VT-x
    L1d cache:           32K
    L1i cache:           32K
    L2 cache:            256K
    L3 cache:            12288K
    NUMA node0 CPU(s):   0,2,4,6,8,10,12,14
    NUMA node1 CPU(s):   1,3,5,7,9,11,13,15
    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 ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 popcnt aes lahf_lm epb pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid dtherm ida arat flush_l1d
    
    

    And lscpu could not get maximum frequency while Power Management Profile is set to Active Power Controller.

    $ lscpu
    Architecture:        x86_64
    CPU op-mode(s):      32-bit, 64-bit
    Byte Order:          Little Endian
    CPU(s):              16
    On-line CPU(s) list: 0-15
    Thread(s) per core:  2
    Core(s) per socket:  4
    Socket(s):           2
    NUMA node(s):        2
    Vendor ID:           GenuineIntel
    CPU family:          6
    Model:               44
    Model name:          Intel(R) Xeon(R) CPU           E5640  @ 2.67GHz
    Stepping:            2
    CPU MHz:             1596.041
    BogoMIPS:            5319.87
    Virtualization:      VT-x
    L1d cache:           32K
    L1i cache:           32K
    L2 cache:            256K
    L3 cache:            12288K
    NUMA node0 CPU(s):   0,2,4,6,8,10,12,14
    NUMA node1 CPU(s):   1,3,5,7,9,11,13,15
    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 ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 popcnt aes lahf_lm pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid dtherm ida arat flush_l1d
    
    
  11. davidjumani commented on Sep 24, 2021

    @davidjumani
    Contributor

    Thanks for the update @eolleeooleo @nvazquez I'll add a note about the power management profile in the docs

  12. tetra12 commented on Nov 8, 2021

    @tetra12

    Having the same issue on Ubuntu 20.04.3 with the latest Kernel 5.14.17
    Probably, I'm having a hardware-kernel issue, so will downgrade a Kernel version a bit

    My setup

    Kernel: 5.14.17
    CloudStack 4.16.0.0-snapshot.20211108 
    libvirtd (libvirt) 6.0.0
    

    I simply don't have that path at all!

    root@kvm0:/var/log/cloudstack/agent# ls /sys/devices/
    LNXSYSTM:00  breakpoint  isa  kprobe  msr  pci0000:00  platform  pnp0  software  system  tracepoint  uprobe  virtual
    
    root@kvm0:/var/log/cloudstack/agent# lscpu 
    Architecture:                    x86_64
    CPU op-mode(s):                  32-bit, 64-bit
    Byte Order:                      Little Endian
    Address sizes:                   40 bits physical, 48 bits virtual
    CPU(s):                          2
    On-line CPU(s) list:             0,1
    Thread(s) per core:              1
    Core(s) per socket:              1
    Socket(s):                       2
    NUMA node(s):                    1
    Vendor ID:                       GenuineIntel
    CPU family:                      6
    Model:                           44
    Model name:                      Westmere E56xx/L56xx/X56xx (IBRS update)
    Stepping:                        1
    CPU MHz:                         2266.638
    BogoMIPS:                        4533.27
    Virtualization:                  VT-x
    Hypervisor vendor:               KVM
    Virtualization type:             full
    L1d cache:                       64 KiB
    L1i cache:                       64 KiB
    L2 cache:                        8 MiB
    L3 cache:                        32 MiB
    NUMA node0 CPU(s):               0,1
    
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions