[libvirt] [PATCH 0/6] Improvements to CPU frequency reporting

A few steps towards eventually fixing https://bugzilla.redhat.com/show_bug.cgi?id=1206353 The commit message for patch 6/6 contains most of the rationale, previous patches are cleanups. If not for the new test case added with patch 1/6, the overall diffstat would be negative. Andrea Bolognani (6): tests: Add host CPU data for Moonshot (RHEL 7.4) util: Introduce virHostCPUGetInfoParseCPUInfo() util: Introduce virHostCPUGetInfoParseCPUFrequency() util: Tweak virHostCPUGetInfoParseCPUFrequency() util: Tweak s390(x) case for CPU frequency util: Don't report CPU frequency for ARM hosts src/util/virhostcpu.c | 151 ++++++++++----------- .../linux-aarch64-rhel74-moonshot.cpuinfo | 72 ++++++++++ .../linux-aarch64-rhel74-moonshot.expected | 1 + .../linux-armv6l-raspberrypi.expected | 2 +- .../linux-rhel74-moonshot/cpu/cpu0/node0 | 1 + .../linux-rhel74-moonshot/cpu/cpu0/online | 1 + .../cpu/cpu0/topology/core_id | 1 + .../cpu/cpu0/topology/core_siblings | 1 + .../cpu/cpu0/topology/core_siblings_list | 1 + .../cpu/cpu0/topology/physical_package_id | 1 + .../cpu/cpu0/topology/thread_siblings | 1 + .../cpu/cpu0/topology/thread_siblings_list | 1 + .../linux-rhel74-moonshot/cpu/cpu1/node0 | 1 + .../linux-rhel74-moonshot/cpu/cpu1/online | 1 + .../cpu/cpu1/topology/core_id | 1 + .../cpu/cpu1/topology/core_siblings | 1 + .../cpu/cpu1/topology/core_siblings_list | 1 + .../cpu/cpu1/topology/physical_package_id | 1 + .../cpu/cpu1/topology/thread_siblings | 1 + .../cpu/cpu1/topology/thread_siblings_list | 1 + .../linux-rhel74-moonshot/cpu/cpu2/node0 | 1 + .../linux-rhel74-moonshot/cpu/cpu2/online | 1 + .../cpu/cpu2/topology/core_id | 1 + .../cpu/cpu2/topology/core_siblings | 1 + .../cpu/cpu2/topology/core_siblings_list | 1 + .../cpu/cpu2/topology/physical_package_id | 1 + .../cpu/cpu2/topology/thread_siblings | 1 + .../cpu/cpu2/topology/thread_siblings_list | 1 + .../linux-rhel74-moonshot/cpu/cpu3/node0 | 1 + .../linux-rhel74-moonshot/cpu/cpu3/online | 1 + .../cpu/cpu3/topology/core_id | 1 + .../cpu/cpu3/topology/core_siblings | 1 + .../cpu/cpu3/topology/core_siblings_list | 1 + .../cpu/cpu3/topology/physical_package_id | 1 + .../cpu/cpu3/topology/thread_siblings | 1 + .../cpu/cpu3/topology/thread_siblings_list | 1 + .../linux-rhel74-moonshot/cpu/cpu4/node0 | 1 + .../linux-rhel74-moonshot/cpu/cpu4/online | 1 + .../cpu/cpu4/topology/core_id | 1 + .../cpu/cpu4/topology/core_siblings | 1 + .../cpu/cpu4/topology/core_siblings_list | 1 + .../cpu/cpu4/topology/physical_package_id | 1 + .../cpu/cpu4/topology/thread_siblings | 1 + .../cpu/cpu4/topology/thread_siblings_list | 1 + .../linux-rhel74-moonshot/cpu/cpu5/node0 | 1 + .../linux-rhel74-moonshot/cpu/cpu5/online | 1 + .../cpu/cpu5/topology/core_id | 1 + .../cpu/cpu5/topology/core_siblings | 1 + .../cpu/cpu5/topology/core_siblings_list | 1 + .../cpu/cpu5/topology/physical_package_id | 1 + .../cpu/cpu5/topology/thread_siblings | 1 + .../cpu/cpu5/topology/thread_siblings_list | 1 + .../linux-rhel74-moonshot/cpu/cpu6/node0 | 1 + .../linux-rhel74-moonshot/cpu/cpu6/online | 1 + .../cpu/cpu6/topology/core_id | 1 + .../cpu/cpu6/topology/core_siblings | 1 + .../cpu/cpu6/topology/core_siblings_list | 1 + .../cpu/cpu6/topology/physical_package_id | 1 + .../cpu/cpu6/topology/thread_siblings | 1 + .../cpu/cpu6/topology/thread_siblings_list | 1 + .../linux-rhel74-moonshot/cpu/cpu7/node0 | 1 + .../linux-rhel74-moonshot/cpu/cpu7/online | 1 + .../cpu/cpu7/topology/core_id | 1 + .../cpu/cpu7/topology/core_siblings | 1 + .../cpu/cpu7/topology/core_siblings_list | 1 + .../cpu/cpu7/topology/physical_package_id | 1 + .../cpu/cpu7/topology/thread_siblings | 1 + .../cpu/cpu7/topology/thread_siblings_list | 1 + .../linux-rhel74-moonshot/cpu/kernel_max | 1 + .../linux-rhel74-moonshot/cpu/offline | 1 + .../linux-rhel74-moonshot/cpu/online | 1 + .../linux-rhel74-moonshot/cpu/possible | 1 + .../linux-rhel74-moonshot/cpu/present | 1 + .../linux-rhel74-moonshot/node/has_cpu | 1 + .../linux-rhel74-moonshot/node/has_memory | 1 + .../linux-rhel74-moonshot/node/has_normal_memory | 1 + .../linux-rhel74-moonshot/node/node0/cpu0 | 1 + .../linux-rhel74-moonshot/node/node0/cpu1 | 1 + .../linux-rhel74-moonshot/node/node0/cpu2 | 1 + .../linux-rhel74-moonshot/node/node0/cpu3 | 1 + .../linux-rhel74-moonshot/node/node0/cpu4 | 1 + .../linux-rhel74-moonshot/node/node0/cpu5 | 1 + .../linux-rhel74-moonshot/node/node0/cpu6 | 1 + .../linux-rhel74-moonshot/node/node0/cpu7 | 1 + .../linux-rhel74-moonshot/node/node0/cpulist | 1 + .../linux-rhel74-moonshot/node/node0/cpumap | 1 + .../linux-rhel74-moonshot/node/online | 1 + .../linux-rhel74-moonshot/node/possible | 1 + tests/virhostcputest.c | 1 + 89 files changed, 230 insertions(+), 81 deletions(-) create mode 100644 tests/virhostcpudata/linux-aarch64-rhel74-moonshot.cpuinfo create mode 100644 tests/virhostcpudata/linux-aarch64-rhel74-moonshot.expected create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/node0 create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/online create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/core_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/core_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/core_siblings_list create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/physical_package_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/thread_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/thread_siblings_list create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/node0 create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/online create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/core_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/core_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/core_siblings_list create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/physical_package_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/thread_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/thread_siblings_list create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/node0 create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/online create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/core_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/core_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/core_siblings_list create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/physical_package_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/thread_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/thread_siblings_list create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/node0 create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/online create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/core_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/core_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/core_siblings_list create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/physical_package_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/thread_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/thread_siblings_list create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/node0 create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/online create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/core_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/core_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/core_siblings_list create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/physical_package_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/thread_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/thread_siblings_list create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/node0 create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/online create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/core_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/core_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/core_siblings_list create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/physical_package_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/thread_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/thread_siblings_list create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/node0 create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/online create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/core_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/core_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/core_siblings_list create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/physical_package_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/thread_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/thread_siblings_list create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/node0 create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/online create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/core_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/core_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/core_siblings_list create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/physical_package_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/thread_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/thread_siblings_list create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/kernel_max create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/offline create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/online create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/possible create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/present create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/node/has_cpu create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/node/has_memory create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/node/has_normal_memory create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu0 create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu1 create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu2 create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu3 create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu4 create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu5 create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu6 create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu7 create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpulist create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpumap create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/node/online create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/node/possible -- 2.14.3

Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- .../linux-aarch64-rhel74-moonshot.cpuinfo | 72 ++++++++++++++++++++++ .../linux-aarch64-rhel74-moonshot.expected | 1 + .../linux-rhel74-moonshot/cpu/cpu0/node0 | 1 + .../linux-rhel74-moonshot/cpu/cpu0/online | 1 + .../cpu/cpu0/topology/core_id | 1 + .../cpu/cpu0/topology/core_siblings | 1 + .../cpu/cpu0/topology/core_siblings_list | 1 + .../cpu/cpu0/topology/physical_package_id | 1 + .../cpu/cpu0/topology/thread_siblings | 1 + .../cpu/cpu0/topology/thread_siblings_list | 1 + .../linux-rhel74-moonshot/cpu/cpu1/node0 | 1 + .../linux-rhel74-moonshot/cpu/cpu1/online | 1 + .../cpu/cpu1/topology/core_id | 1 + .../cpu/cpu1/topology/core_siblings | 1 + .../cpu/cpu1/topology/core_siblings_list | 1 + .../cpu/cpu1/topology/physical_package_id | 1 + .../cpu/cpu1/topology/thread_siblings | 1 + .../cpu/cpu1/topology/thread_siblings_list | 1 + .../linux-rhel74-moonshot/cpu/cpu2/node0 | 1 + .../linux-rhel74-moonshot/cpu/cpu2/online | 1 + .../cpu/cpu2/topology/core_id | 1 + .../cpu/cpu2/topology/core_siblings | 1 + .../cpu/cpu2/topology/core_siblings_list | 1 + .../cpu/cpu2/topology/physical_package_id | 1 + .../cpu/cpu2/topology/thread_siblings | 1 + .../cpu/cpu2/topology/thread_siblings_list | 1 + .../linux-rhel74-moonshot/cpu/cpu3/node0 | 1 + .../linux-rhel74-moonshot/cpu/cpu3/online | 1 + .../cpu/cpu3/topology/core_id | 1 + .../cpu/cpu3/topology/core_siblings | 1 + .../cpu/cpu3/topology/core_siblings_list | 1 + .../cpu/cpu3/topology/physical_package_id | 1 + .../cpu/cpu3/topology/thread_siblings | 1 + .../cpu/cpu3/topology/thread_siblings_list | 1 + .../linux-rhel74-moonshot/cpu/cpu4/node0 | 1 + .../linux-rhel74-moonshot/cpu/cpu4/online | 1 + .../cpu/cpu4/topology/core_id | 1 + .../cpu/cpu4/topology/core_siblings | 1 + .../cpu/cpu4/topology/core_siblings_list | 1 + .../cpu/cpu4/topology/physical_package_id | 1 + .../cpu/cpu4/topology/thread_siblings | 1 + .../cpu/cpu4/topology/thread_siblings_list | 1 + .../linux-rhel74-moonshot/cpu/cpu5/node0 | 1 + .../linux-rhel74-moonshot/cpu/cpu5/online | 1 + .../cpu/cpu5/topology/core_id | 1 + .../cpu/cpu5/topology/core_siblings | 1 + .../cpu/cpu5/topology/core_siblings_list | 1 + .../cpu/cpu5/topology/physical_package_id | 1 + .../cpu/cpu5/topology/thread_siblings | 1 + .../cpu/cpu5/topology/thread_siblings_list | 1 + .../linux-rhel74-moonshot/cpu/cpu6/node0 | 1 + .../linux-rhel74-moonshot/cpu/cpu6/online | 1 + .../cpu/cpu6/topology/core_id | 1 + .../cpu/cpu6/topology/core_siblings | 1 + .../cpu/cpu6/topology/core_siblings_list | 1 + .../cpu/cpu6/topology/physical_package_id | 1 + .../cpu/cpu6/topology/thread_siblings | 1 + .../cpu/cpu6/topology/thread_siblings_list | 1 + .../linux-rhel74-moonshot/cpu/cpu7/node0 | 1 + .../linux-rhel74-moonshot/cpu/cpu7/online | 1 + .../cpu/cpu7/topology/core_id | 1 + .../cpu/cpu7/topology/core_siblings | 1 + .../cpu/cpu7/topology/core_siblings_list | 1 + .../cpu/cpu7/topology/physical_package_id | 1 + .../cpu/cpu7/topology/thread_siblings | 1 + .../cpu/cpu7/topology/thread_siblings_list | 1 + .../linux-rhel74-moonshot/cpu/kernel_max | 1 + .../linux-rhel74-moonshot/cpu/offline | 1 + .../linux-rhel74-moonshot/cpu/online | 1 + .../linux-rhel74-moonshot/cpu/possible | 1 + .../linux-rhel74-moonshot/cpu/present | 1 + .../linux-rhel74-moonshot/node/has_cpu | 1 + .../linux-rhel74-moonshot/node/has_memory | 1 + .../linux-rhel74-moonshot/node/has_normal_memory | 1 + .../linux-rhel74-moonshot/node/node0/cpu0 | 1 + .../linux-rhel74-moonshot/node/node0/cpu1 | 1 + .../linux-rhel74-moonshot/node/node0/cpu2 | 1 + .../linux-rhel74-moonshot/node/node0/cpu3 | 1 + .../linux-rhel74-moonshot/node/node0/cpu4 | 1 + .../linux-rhel74-moonshot/node/node0/cpu5 | 1 + .../linux-rhel74-moonshot/node/node0/cpu6 | 1 + .../linux-rhel74-moonshot/node/node0/cpu7 | 1 + .../linux-rhel74-moonshot/node/node0/cpulist | 1 + .../linux-rhel74-moonshot/node/node0/cpumap | 1 + .../linux-rhel74-moonshot/node/online | 1 + .../linux-rhel74-moonshot/node/possible | 1 + tests/virhostcputest.c | 1 + 87 files changed, 158 insertions(+) create mode 100644 tests/virhostcpudata/linux-aarch64-rhel74-moonshot.cpuinfo create mode 100644 tests/virhostcpudata/linux-aarch64-rhel74-moonshot.expected create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/node0 create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/online create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/core_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/core_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/core_siblings_list create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/physical_package_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/thread_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/thread_siblings_list create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/node0 create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/online create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/core_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/core_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/core_siblings_list create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/physical_package_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/thread_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/thread_siblings_list create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/node0 create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/online create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/core_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/core_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/core_siblings_list create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/physical_package_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/thread_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/thread_siblings_list create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/node0 create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/online create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/core_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/core_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/core_siblings_list create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/physical_package_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/thread_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/thread_siblings_list create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/node0 create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/online create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/core_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/core_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/core_siblings_list create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/physical_package_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/thread_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/thread_siblings_list create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/node0 create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/online create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/core_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/core_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/core_siblings_list create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/physical_package_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/thread_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/thread_siblings_list create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/node0 create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/online create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/core_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/core_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/core_siblings_list create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/physical_package_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/thread_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/thread_siblings_list create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/node0 create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/online create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/core_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/core_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/core_siblings_list create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/physical_package_id create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/thread_siblings create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/thread_siblings_list create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/kernel_max create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/offline create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/online create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/possible create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/cpu/present create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/node/has_cpu create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/node/has_memory create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/node/has_normal_memory create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu0 create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu1 create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu2 create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu3 create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu4 create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu5 create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu6 create mode 120000 tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu7 create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpulist create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpumap create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/node/online create mode 100644 tests/virhostcpudata/linux-rhel74-moonshot/node/possible diff --git a/tests/virhostcpudata/linux-aarch64-rhel74-moonshot.cpuinfo b/tests/virhostcpudata/linux-aarch64-rhel74-moonshot.cpuinfo new file mode 100644 index 000000000..ae528bf61 --- /dev/null +++ b/tests/virhostcpudata/linux-aarch64-rhel74-moonshot.cpuinfo @@ -0,0 +1,72 @@ +processor : 0 +BogoMIPS : 100.00 +Features : fp asimd evtstrm cpuid +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 1 + +processor : 1 +BogoMIPS : 100.00 +Features : fp asimd evtstrm cpuid +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 1 + +processor : 2 +BogoMIPS : 100.00 +Features : fp asimd evtstrm cpuid +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 1 + +processor : 3 +BogoMIPS : 100.00 +Features : fp asimd evtstrm cpuid +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 1 + +processor : 4 +BogoMIPS : 100.00 +Features : fp asimd evtstrm cpuid +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 1 + +processor : 5 +BogoMIPS : 100.00 +Features : fp asimd evtstrm cpuid +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 1 + +processor : 6 +BogoMIPS : 100.00 +Features : fp asimd evtstrm cpuid +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 1 + +processor : 7 +BogoMIPS : 100.00 +Features : fp asimd evtstrm cpuid +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 1 + diff --git a/tests/virhostcpudata/linux-aarch64-rhel74-moonshot.expected b/tests/virhostcpudata/linux-aarch64-rhel74-moonshot.expected new file mode 100644 index 000000000..24ff0ea0b --- /dev/null +++ b/tests/virhostcpudata/linux-aarch64-rhel74-moonshot.expected @@ -0,0 +1 @@ +CPUs: 8/8, MHz: 100, Nodes: 1, Sockets: 1, Cores: 8, Threads: 1 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/node0 b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/node0 new file mode 120000 index 000000000..222b6af32 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/node0 @@ -0,0 +1 @@ +../../node/node0 \ No newline at end of file diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/online b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/online new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/online @@ -0,0 +1 @@ +1 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/core_id b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/core_id new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/core_id @@ -0,0 +1 @@ +0 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/core_siblings b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/core_siblings new file mode 100644 index 000000000..fcd15acf9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/core_siblings @@ -0,0 +1 @@ +ff diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/core_siblings_list b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/core_siblings_list new file mode 100644 index 000000000..74fc2fb6b --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/core_siblings_list @@ -0,0 +1 @@ +0-7 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/physical_package_id b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/physical_package_id new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/physical_package_id @@ -0,0 +1 @@ +0 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/thread_siblings b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/thread_siblings new file mode 100644 index 000000000..8a0f05e16 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/thread_siblings @@ -0,0 +1 @@ +01 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/thread_siblings_list b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/thread_siblings_list new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu0/topology/thread_siblings_list @@ -0,0 +1 @@ +0 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/node0 b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/node0 new file mode 120000 index 000000000..222b6af32 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/node0 @@ -0,0 +1 @@ +../../node/node0 \ No newline at end of file diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/online b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/online new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/online @@ -0,0 +1 @@ +1 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/core_id b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/core_id new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/core_id @@ -0,0 +1 @@ +1 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/core_siblings b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/core_siblings new file mode 100644 index 000000000..fcd15acf9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/core_siblings @@ -0,0 +1 @@ +ff diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/core_siblings_list b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/core_siblings_list new file mode 100644 index 000000000..74fc2fb6b --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/core_siblings_list @@ -0,0 +1 @@ +0-7 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/physical_package_id b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/physical_package_id new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/physical_package_id @@ -0,0 +1 @@ +0 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/thread_siblings b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/thread_siblings new file mode 100644 index 000000000..9e22bcb8e --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/thread_siblings @@ -0,0 +1 @@ +02 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/thread_siblings_list b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/thread_siblings_list new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu1/topology/thread_siblings_list @@ -0,0 +1 @@ +1 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/node0 b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/node0 new file mode 120000 index 000000000..222b6af32 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/node0 @@ -0,0 +1 @@ +../../node/node0 \ No newline at end of file diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/online b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/online new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/online @@ -0,0 +1 @@ +1 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/core_id b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/core_id new file mode 100644 index 000000000..0cfbf0888 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/core_id @@ -0,0 +1 @@ +2 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/core_siblings b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/core_siblings new file mode 100644 index 000000000..fcd15acf9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/core_siblings @@ -0,0 +1 @@ +ff diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/core_siblings_list b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/core_siblings_list new file mode 100644 index 000000000..74fc2fb6b --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/core_siblings_list @@ -0,0 +1 @@ +0-7 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/physical_package_id b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/physical_package_id new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/physical_package_id @@ -0,0 +1 @@ +0 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/thread_siblings b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/thread_siblings new file mode 100644 index 000000000..64969239d --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/thread_siblings @@ -0,0 +1 @@ +04 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/thread_siblings_list b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/thread_siblings_list new file mode 100644 index 000000000..0cfbf0888 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu2/topology/thread_siblings_list @@ -0,0 +1 @@ +2 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/node0 b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/node0 new file mode 120000 index 000000000..222b6af32 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/node0 @@ -0,0 +1 @@ +../../node/node0 \ No newline at end of file diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/online b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/online new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/online @@ -0,0 +1 @@ +1 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/core_id b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/core_id new file mode 100644 index 000000000..00750edc0 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/core_id @@ -0,0 +1 @@ +3 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/core_siblings b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/core_siblings new file mode 100644 index 000000000..fcd15acf9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/core_siblings @@ -0,0 +1 @@ +ff diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/core_siblings_list b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/core_siblings_list new file mode 100644 index 000000000..74fc2fb6b --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/core_siblings_list @@ -0,0 +1 @@ +0-7 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/physical_package_id b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/physical_package_id new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/physical_package_id @@ -0,0 +1 @@ +0 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/thread_siblings b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/thread_siblings new file mode 100644 index 000000000..adb9de8ee --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/thread_siblings @@ -0,0 +1 @@ +08 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/thread_siblings_list b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/thread_siblings_list new file mode 100644 index 000000000..00750edc0 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu3/topology/thread_siblings_list @@ -0,0 +1 @@ +3 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/node0 b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/node0 new file mode 120000 index 000000000..222b6af32 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/node0 @@ -0,0 +1 @@ +../../node/node0 \ No newline at end of file diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/online b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/online new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/online @@ -0,0 +1 @@ +1 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/core_id b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/core_id new file mode 100644 index 000000000..b8626c4cf --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/core_id @@ -0,0 +1 @@ +4 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/core_siblings b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/core_siblings new file mode 100644 index 000000000..fcd15acf9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/core_siblings @@ -0,0 +1 @@ +ff diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/core_siblings_list b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/core_siblings_list new file mode 100644 index 000000000..74fc2fb6b --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/core_siblings_list @@ -0,0 +1 @@ +0-7 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/physical_package_id b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/physical_package_id new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/physical_package_id @@ -0,0 +1 @@ +0 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/thread_siblings b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/thread_siblings new file mode 100644 index 000000000..f599e28b8 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/thread_siblings @@ -0,0 +1 @@ +10 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/thread_siblings_list b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/thread_siblings_list new file mode 100644 index 000000000..b8626c4cf --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu4/topology/thread_siblings_list @@ -0,0 +1 @@ +4 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/node0 b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/node0 new file mode 120000 index 000000000..222b6af32 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/node0 @@ -0,0 +1 @@ +../../node/node0 \ No newline at end of file diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/online b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/online new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/online @@ -0,0 +1 @@ +1 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/core_id b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/core_id new file mode 100644 index 000000000..7ed6ff82d --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/core_id @@ -0,0 +1 @@ +5 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/core_siblings b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/core_siblings new file mode 100644 index 000000000..fcd15acf9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/core_siblings @@ -0,0 +1 @@ +ff diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/core_siblings_list b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/core_siblings_list new file mode 100644 index 000000000..74fc2fb6b --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/core_siblings_list @@ -0,0 +1 @@ +0-7 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/physical_package_id b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/physical_package_id new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/physical_package_id @@ -0,0 +1 @@ +0 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/thread_siblings b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/thread_siblings new file mode 100644 index 000000000..209e3ef4b --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/thread_siblings @@ -0,0 +1 @@ +20 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/thread_siblings_list b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/thread_siblings_list new file mode 100644 index 000000000..7ed6ff82d --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu5/topology/thread_siblings_list @@ -0,0 +1 @@ +5 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/node0 b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/node0 new file mode 120000 index 000000000..222b6af32 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/node0 @@ -0,0 +1 @@ +../../node/node0 \ No newline at end of file diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/online b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/online new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/online @@ -0,0 +1 @@ +1 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/core_id b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/core_id new file mode 100644 index 000000000..1e8b31496 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/core_id @@ -0,0 +1 @@ +6 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/core_siblings b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/core_siblings new file mode 100644 index 000000000..fcd15acf9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/core_siblings @@ -0,0 +1 @@ +ff diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/core_siblings_list b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/core_siblings_list new file mode 100644 index 000000000..74fc2fb6b --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/core_siblings_list @@ -0,0 +1 @@ +0-7 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/physical_package_id b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/physical_package_id new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/physical_package_id @@ -0,0 +1 @@ +0 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/thread_siblings b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/thread_siblings new file mode 100644 index 000000000..425151f3a --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/thread_siblings @@ -0,0 +1 @@ +40 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/thread_siblings_list b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/thread_siblings_list new file mode 100644 index 000000000..1e8b31496 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu6/topology/thread_siblings_list @@ -0,0 +1 @@ +6 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/node0 b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/node0 new file mode 120000 index 000000000..222b6af32 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/node0 @@ -0,0 +1 @@ +../../node/node0 \ No newline at end of file diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/online b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/online new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/online @@ -0,0 +1 @@ +1 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/core_id b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/core_id new file mode 100644 index 000000000..7f8f011eb --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/core_id @@ -0,0 +1 @@ +7 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/core_siblings b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/core_siblings new file mode 100644 index 000000000..fcd15acf9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/core_siblings @@ -0,0 +1 @@ +ff diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/core_siblings_list b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/core_siblings_list new file mode 100644 index 000000000..74fc2fb6b --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/core_siblings_list @@ -0,0 +1 @@ +0-7 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/physical_package_id b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/physical_package_id new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/physical_package_id @@ -0,0 +1 @@ +0 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/thread_siblings b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/thread_siblings new file mode 100644 index 000000000..d15a2cc44 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/thread_siblings @@ -0,0 +1 @@ +80 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/thread_siblings_list b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/thread_siblings_list new file mode 100644 index 000000000..7f8f011eb --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/cpu7/topology/thread_siblings_list @@ -0,0 +1 @@ +7 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/kernel_max b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/kernel_max new file mode 100644 index 000000000..50b0f7906 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/kernel_max @@ -0,0 +1 @@ +4095 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/offline b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/offline new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/offline @@ -0,0 +1 @@ + diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/online b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/online new file mode 100644 index 000000000..74fc2fb6b --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/online @@ -0,0 +1 @@ +0-7 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/possible b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/possible new file mode 100644 index 000000000..74fc2fb6b --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/possible @@ -0,0 +1 @@ +0-7 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/cpu/present b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/present new file mode 100644 index 000000000..74fc2fb6b --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/cpu/present @@ -0,0 +1 @@ +0-7 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/node/has_cpu b/tests/virhostcpudata/linux-rhel74-moonshot/node/has_cpu new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/node/has_cpu @@ -0,0 +1 @@ +0 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/node/has_memory b/tests/virhostcpudata/linux-rhel74-moonshot/node/has_memory new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/node/has_memory @@ -0,0 +1 @@ +0 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/node/has_normal_memory b/tests/virhostcpudata/linux-rhel74-moonshot/node/has_normal_memory new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/node/has_normal_memory @@ -0,0 +1 @@ +0 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu0 b/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu0 new file mode 120000 index 000000000..c841bea28 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu0 @@ -0,0 +1 @@ +../../cpu/cpu0 \ No newline at end of file diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu1 b/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu1 new file mode 120000 index 000000000..5f4536279 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu1 @@ -0,0 +1 @@ +../../cpu/cpu1 \ No newline at end of file diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu2 b/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu2 new file mode 120000 index 000000000..2dcca332c --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu2 @@ -0,0 +1 @@ +../../cpu/cpu2 \ No newline at end of file diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu3 b/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu3 new file mode 120000 index 000000000..c7690e5aa --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu3 @@ -0,0 +1 @@ +../../cpu/cpu3 \ No newline at end of file diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu4 b/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu4 new file mode 120000 index 000000000..9e77a64eb --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu4 @@ -0,0 +1 @@ +../../cpu/cpu4 \ No newline at end of file diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu5 b/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu5 new file mode 120000 index 000000000..cc07c3b97 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu5 @@ -0,0 +1 @@ +../../cpu/cpu5 \ No newline at end of file diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu6 b/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu6 new file mode 120000 index 000000000..2e7576354 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu6 @@ -0,0 +1 @@ +../../cpu/cpu6 \ No newline at end of file diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu7 b/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu7 new file mode 120000 index 000000000..09e3f79b4 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpu7 @@ -0,0 +1 @@ +../../cpu/cpu7 \ No newline at end of file diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpulist b/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpulist new file mode 100644 index 000000000..74fc2fb6b --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpulist @@ -0,0 +1 @@ +0-7 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpumap b/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpumap new file mode 100644 index 000000000..fcd15acf9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/node/node0/cpumap @@ -0,0 +1 @@ +ff diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/node/online b/tests/virhostcpudata/linux-rhel74-moonshot/node/online new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/node/online @@ -0,0 +1 @@ +0 diff --git a/tests/virhostcpudata/linux-rhel74-moonshot/node/possible b/tests/virhostcpudata/linux-rhel74-moonshot/node/possible new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/virhostcpudata/linux-rhel74-moonshot/node/possible @@ -0,0 +1 @@ +0 diff --git a/tests/virhostcputest.c b/tests/virhostcputest.c index d1208c373..d3ee18461 100644 --- a/tests/virhostcputest.c +++ b/tests/virhostcputest.c @@ -239,6 +239,7 @@ mymain(void) {"raspberrypi", VIR_ARCH_ARMV6L}, {"f21-mustang", VIR_ARCH_AARCH64}, {"rhelsa-3.19.0-mustang", VIR_ARCH_AARCH64}, + {"rhel74-moonshot", VIR_ARCH_AARCH64}, {"deconf-cpus", VIR_ARCH_PPC64}, /* subcores, default configuration */ {"subcores1", VIR_ARCH_PPC64}, -- 2.14.3

This handles only the /proc/cpuinfo part of virHostCPUGetInfo(). Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- src/util/virhostcpu.c | 60 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index c485a9721..4d5c56659 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -508,33 +508,17 @@ virHostCPUHasValidSubcoreConfiguration(int threads_per_subcore) return ret; } -int -virHostCPUGetInfoPopulateLinux(FILE *cpuinfo, - virArch arch, - unsigned int *cpus, - unsigned int *mhz, - unsigned int *nodes, - unsigned int *sockets, - unsigned int *cores, - unsigned int *threads) + +static int +virHostCPUGetInfoParseCPUInfo(FILE *cpuinfo, + virArch arch, + unsigned int *mhz) { - virBitmapPtr present_cpus_map = NULL; - virBitmapPtr online_cpus_map = NULL; char line[1024]; - DIR *nodedir = NULL; - struct dirent *nodedirent = NULL; - int nodecpus, nodecores, nodesockets, nodethreads, offline = 0; - int threads_per_subcore = 0; - unsigned int node; int ret = -1; - char *sysfs_nodedir = NULL; - char *sysfs_cpudir = NULL; - int direrr; *mhz = 0; - *cpus = *nodes = *sockets = *cores = *threads = 0; - /* Start with parsing CPU clock speed from /proc/cpuinfo */ while (fgets(line, sizeof(line), cpuinfo) != NULL) { if (ARCH_IS_X86(arch)) { char *buf = line; @@ -614,6 +598,40 @@ virHostCPUGetInfoPopulateLinux(FILE *cpuinfo, } } + ret = 0; + + cleanup: + return ret; +} + +int +virHostCPUGetInfoPopulateLinux(FILE *cpuinfo, + virArch arch, + unsigned int *cpus, + unsigned int *mhz, + unsigned int *nodes, + unsigned int *sockets, + unsigned int *cores, + unsigned int *threads) +{ + virBitmapPtr present_cpus_map = NULL; + virBitmapPtr online_cpus_map = NULL; + DIR *nodedir = NULL; + struct dirent *nodedirent = NULL; + int nodecpus, nodecores, nodesockets, nodethreads, offline = 0; + int threads_per_subcore = 0; + unsigned int node; + int ret = -1; + char *sysfs_nodedir = NULL; + char *sysfs_cpudir = NULL; + int direrr; + + *cpus = *nodes = *sockets = *cores = *threads = 0; + + /* Start with parsing CPU clock speed from /proc/cpuinfo */ + if (virHostCPUGetInfoParseCPUInfo(cpuinfo, arch, mhz) < 0) + goto cleanup; + /* Get information about what CPUs are present in the host and what * CPUs are online, so that we don't have to so for each node */ present_cpus_map = virHostCPUGetPresentBitmap(); -- 2.14.3

Andrea Bolognani <abologna@redhat.com> [2017-12-11, 05:40PM +0100]:
This handles only the /proc/cpuinfo part of virHostCPUGetInfo().
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- src/util/virhostcpu.c | 60 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 21 deletions(-)
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index c485a9721..4d5c56659 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -508,33 +508,17 @@ virHostCPUHasValidSubcoreConfiguration(int threads_per_subcore) return ret; }
-int -virHostCPUGetInfoPopulateLinux(FILE *cpuinfo, - virArch arch, - unsigned int *cpus, - unsigned int *mhz, - unsigned int *nodes, - unsigned int *sockets, - unsigned int *cores, - unsigned int *threads) + +static int +virHostCPUGetInfoParseCPUInfo(FILE *cpuinfo, + virArch arch, + unsigned int *mhz) { - virBitmapPtr present_cpus_map = NULL; - virBitmapPtr online_cpus_map = NULL; char line[1024]; - DIR *nodedir = NULL; - struct dirent *nodedirent = NULL; - int nodecpus, nodecores, nodesockets, nodethreads, offline = 0; - int threads_per_subcore = 0; - unsigned int node; int ret = -1; - char *sysfs_nodedir = NULL; - char *sysfs_cpudir = NULL; - int direrr;
*mhz = 0;
I wouldn't move this initialization.
- *cpus = *nodes = *sockets = *cores = *threads = 0;
- /* Start with parsing CPU clock speed from /proc/cpuinfo */ while (fgets(line, sizeof(line), cpuinfo) != NULL) { if (ARCH_IS_X86(arch)) { char *buf = line; @@ -614,6 +598,40 @@ virHostCPUGetInfoPopulateLinux(FILE *cpuinfo, } }
+ ret = 0; + + cleanup: + return ret; +} + +int +virHostCPUGetInfoPopulateLinux(FILE *cpuinfo, + virArch arch, + unsigned int *cpus, + unsigned int *mhz, + unsigned int *nodes, + unsigned int *sockets, + unsigned int *cores, + unsigned int *threads) +{ + virBitmapPtr present_cpus_map = NULL; + virBitmapPtr online_cpus_map = NULL; + DIR *nodedir = NULL; + struct dirent *nodedirent = NULL; + int nodecpus, nodecores, nodesockets, nodethreads, offline = 0; + int threads_per_subcore = 0; + unsigned int node; + int ret = -1; + char *sysfs_nodedir = NULL; + char *sysfs_cpudir = NULL; + int direrr; + + *cpus = *nodes = *sockets = *cores = *threads = 0; + + /* Start with parsing CPU clock speed from /proc/cpuinfo */ + if (virHostCPUGetInfoParseCPUInfo(cpuinfo, arch, mhz) < 0) + goto cleanup;
Why do we cleanup here and abandon the rest of the information? Since the information in /proc/cpuinfo is kind of volatile in its format, shouldn't we be liberal in what we accept? If we can't parse it, we just report mhz = 0, but gathering the rest of the information in this function is still valuable.
+ /* Get information about what CPUs are present in the host and what * CPUs are online, so that we don't have to so for each node */ present_cpus_map = virHostCPUGetPresentBitmap(); -- 2.14.3
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
-- IBM Systems Linux on z Systems & Virtualization Development ------------------------------------------------------------------------ IBM Deutschland Schönaicher Str. 220 71032 Böblingen Phone: +49 7031 16 1819 E-Mail: bwalk@de.ibm.com ------------------------------------------------------------------------ IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On Wed, 2017-12-13 at 08:32 +0100, Bjoern Walk wrote:
-int -virHostCPUGetInfoPopulateLinux(FILE *cpuinfo, - virArch arch, - unsigned int *cpus, - unsigned int *mhz, - unsigned int *nodes, - unsigned int *sockets, - unsigned int *cores, - unsigned int *threads) + +static int +virHostCPUGetInfoParseCPUInfo(FILE *cpuinfo, + virArch arch, + unsigned int *mhz) { - virBitmapPtr present_cpus_map = NULL; - virBitmapPtr online_cpus_map = NULL; char line[1024]; - DIR *nodedir = NULL; - struct dirent *nodedirent = NULL; - int nodecpus, nodecores, nodesockets, nodethreads, offline = 0; - int threads_per_subcore = 0; - unsigned int node; int ret = -1; - char *sysfs_nodedir = NULL; - char *sysfs_cpudir = NULL; - int direrr;
*mhz = 0;
I wouldn't move this initialization.
So you'd leave it in virHostCPUGetInfoPopulateLinux()? Why? With my approach, the value is changed only in virHostCPUGetInfoParseCPUInfo(), which makes IMHO more sense than spreading the code that changes it across two functions.
+ /* Start with parsing CPU clock speed from /proc/cpuinfo */ + if (virHostCPUGetInfoParseCPUInfo(cpuinfo, arch, mhz) < 0) + goto cleanup;
Why do we cleanup here and abandon the rest of the information? Since the information in /proc/cpuinfo is kind of volatile in its format, shouldn't we be liberal in what we accept? If we can't parse it, we just report mhz = 0, but gathering the rest of the information in this function is still valuable.
Most functions in libvirt either perform all tasks succesfully or return a failure, so failing here is in line both with that and with the existing behavior. -- Andrea Bolognani / Red Hat / Virtualization

Andrea Bolognani <abologna@redhat.com> [2017-12-13, 12:34PM +0100]:
So you'd leave it in virHostCPUGetInfoPopulateLinux()? Why?
I found it more important that all the initialization (cpu, nodes, etc.) is in one place. But it actually doesn't matter.
With my approach, the value is changed only in virHostCPUGetInfoParseCPUInfo(), which makes IMHO more sense than spreading the code that changes it across two functions.
+ /* Start with parsing CPU clock speed from /proc/cpuinfo */ + if (virHostCPUGetInfoParseCPUInfo(cpuinfo, arch, mhz) < 0) + goto cleanup;
Why do we cleanup here and abandon the rest of the information? Since the information in /proc/cpuinfo is kind of volatile in its format, shouldn't we be liberal in what we accept? If we can't parse it, we just report mhz = 0, but gathering the rest of the information in this function is still valuable.
Most functions in libvirt either perform all tasks succesfully or return a failure, so failing here is in line both with that and with the existing behavior.
So for example for S390 we have introduced CPU frequency information in /proc/cpuinfo only recently. That means that depending on your kernel version, you either read freq. info and the rest of the stuff or you discard the whole CPU. I found this highly unintuitive.
-- Andrea Bolognani / Red Hat / Virtualization
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
-- IBM Systems Linux on z Systems & Virtualization Development ------------------------------------------------------------------------ IBM Deutschland Schönaicher Str. 220 71032 Böblingen Phone: +49 7031 16 1819 E-Mail: bwalk@de.ibm.com ------------------------------------------------------------------------ IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On Wed, 2017-12-13 at 15:56 +0100, Bjoern Walk wrote:
Why do we cleanup here and abandon the rest of the information? Since the information in /proc/cpuinfo is kind of volatile in its format, shouldn't we be liberal in what we accept? If we can't parse it, we just report mhz = 0, but gathering the rest of the information in this function is still valuable.
Most functions in libvirt either perform all tasks succesfully or return a failure, so failing here is in line both with that and with the existing behavior.
So for example for S390 we have introduced CPU frequency information in /proc/cpuinfo only recently. That means that depending on your kernel version, you either read freq. info and the rest of the stuff or you discard the whole CPU. I found this highly unintuitive.
That's actually a very good reason! I ended up liking your approach to refactoring more than mine after all. So I made a couple of very small tweaks to it and I'm going to include it mostly as-is in my v2, coming in a minute. If you have a problem with any of my tweaks, just let me know. -- Andrea Bolognani / Red Hat / Virtualization

The algorithm used to extract the CPU frequency from /proc/cpuinfo is the same regardless of architecture, the only difference being the label used to identify the relevant field. Factor the parsing code out to a new helper and use it to implement virHostCPUGetInfoParseCPUInfo(), thus removing some duplication. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- src/util/virhostcpu.c | 105 +++++++++++++++++++------------------------------- 1 file changed, 40 insertions(+), 65 deletions(-) diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index 4d5c56659..85803d527 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -509,6 +509,40 @@ virHostCPUHasValidSubcoreConfiguration(int threads_per_subcore) } +static int +virHostCPUGetInfoParseCPUFrequency(const char *buf, + const char *label, + unsigned int *mhz) +{ + int ret = -1; + + if (STRPREFIX(buf, label)) { + char *p; + unsigned int ui; + + buf += strlen(label); + while (*buf && c_isspace(*buf)) + buf++; + + if (*buf != ':' || !buf[1]) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("parsing cpu MHz from cpuinfo")); + goto cleanup; + } + + if (virStrToLong_ui(buf+1, &p, 10, &ui) == 0 && + /* Accept trailing fractional part. */ + (*p == '\0' || *p == '.' || c_isspace(*p))) + *mhz = ui; + } + + ret = 0; + + cleanup: + return ret; +} + + static int virHostCPUGetInfoParseCPUInfo(FILE *cpuinfo, virArch arch, @@ -521,73 +555,14 @@ virHostCPUGetInfoParseCPUInfo(FILE *cpuinfo, while (fgets(line, sizeof(line), cpuinfo) != NULL) { if (ARCH_IS_X86(arch)) { - char *buf = line; - if (STRPREFIX(buf, "cpu MHz")) { - char *p; - unsigned int ui; - - buf += 7; - while (*buf && c_isspace(*buf)) - buf++; - - if (*buf != ':' || !buf[1]) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("parsing cpu MHz from cpuinfo")); - goto cleanup; - } - - if (virStrToLong_ui(buf+1, &p, 10, &ui) == 0 && - /* Accept trailing fractional part. */ - (*p == '\0' || *p == '.' || c_isspace(*p))) - *mhz = ui; - } + if (virHostCPUGetInfoParseCPUFrequency(line, "cpu MHz", mhz) < 0) + goto cleanup; } else if (ARCH_IS_PPC(arch)) { - char *buf = line; - if (STRPREFIX(buf, "clock")) { - char *p; - unsigned int ui; - - buf += 5; - while (*buf && c_isspace(*buf)) - buf++; - - if (*buf != ':' || !buf[1]) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("parsing cpu MHz from cpuinfo")); - goto cleanup; - } - - if (virStrToLong_ui(buf+1, &p, 10, &ui) == 0 && - /* Accept trailing fractional part. */ - (*p == '\0' || *p == '.' || c_isspace(*p))) - *mhz = ui; - /* No other interesting infos are available in /proc/cpuinfo. - * However, there is a line identifying processor's version, - * identification and machine, but we don't want it to be caught - * and parsed in next iteration, because it is not in expected - * format and thus lead to error. */ - } + if (virHostCPUGetInfoParseCPUFrequency(line, "clock", mhz) < 0) + goto cleanup; } else if (ARCH_IS_ARM(arch)) { - char *buf = line; - if (STRPREFIX(buf, "BogoMIPS")) { - char *p; - unsigned int ui; - - buf += 8; - while (*buf && c_isspace(*buf)) - buf++; - - if (*buf != ':' || !buf[1]) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("parsing cpu MHz from cpuinfo")); - goto cleanup; - } - - if (virStrToLong_ui(buf+1, &p, 10, &ui) == 0 - /* Accept trailing fractional part. */ - && (*p == '\0' || *p == '.' || c_isspace(*p))) - *mhz = ui; - } + if (virHostCPUGetInfoParseCPUFrequency(line, "BogoMIPS", mhz) < 0) + goto cleanup; } else if (ARCH_IS_S390(arch)) { /* s390x has no realistic value for CPU speed, * assign a value of zero to signify this */ -- 2.14.3

Andrea Bolognani <abologna@redhat.com> [2017-12-11, 05:40PM +0100]:
The algorithm used to extract the CPU frequency from /proc/cpuinfo is the same regardless of architecture, the only difference being the label used to identify the relevant field.
Factor the parsing code out to a new helper and use it to implement virHostCPUGetInfoParseCPUInfo(), thus removing some duplication.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- src/util/virhostcpu.c | 105 +++++++++++++++++++------------------------------- 1 file changed, 40 insertions(+), 65 deletions(-)
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index 4d5c56659..85803d527 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -509,6 +509,40 @@ virHostCPUHasValidSubcoreConfiguration(int threads_per_subcore) }
+static int +virHostCPUGetInfoParseCPUFrequency(const char *buf, + const char *label, + unsigned int *mhz) +{ + int ret = -1; + + if (STRPREFIX(buf, label)) {
I'd prefer negation and early exit to get rid of one indentation level. I also moved this conditional into the loop below. Save function calls.
+ char *p; + unsigned int ui; + + buf += strlen(label); + while (*buf && c_isspace(*buf)) + buf++; + + if (*buf != ':' || !buf[1]) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("parsing cpu MHz from cpuinfo")); + goto cleanup; + } + + if (virStrToLong_ui(buf+1, &p, 10, &ui) == 0 && + /* Accept trailing fractional part. */ + (*p == '\0' || *p == '.' || c_isspace(*p))) + *mhz = ui; + } + + ret = 0; + + cleanup: + return ret; +} + + static int virHostCPUGetInfoParseCPUInfo(FILE *cpuinfo, virArch arch, @@ -521,73 +555,14 @@ virHostCPUGetInfoParseCPUInfo(FILE *cpuinfo,
while (fgets(line, sizeof(line), cpuinfo) != NULL) { if (ARCH_IS_X86(arch)) {
Probably (hopefully?) the compiler can optimize, but I get a bit iffy if I see a loop invariant conditional inside a loop. I find this also harder to read.
- char *buf = line; - if (STRPREFIX(buf, "cpu MHz")) { - char *p; - unsigned int ui; - - buf += 7; - while (*buf && c_isspace(*buf)) - buf++; - - if (*buf != ':' || !buf[1]) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("parsing cpu MHz from cpuinfo")); - goto cleanup; - } - - if (virStrToLong_ui(buf+1, &p, 10, &ui) == 0 && - /* Accept trailing fractional part. */ - (*p == '\0' || *p == '.' || c_isspace(*p))) - *mhz = ui; - } + if (virHostCPUGetInfoParseCPUFrequency(line, "cpu MHz", mhz) < 0) + goto cleanup; } else if (ARCH_IS_PPC(arch)) { - char *buf = line; - if (STRPREFIX(buf, "clock")) { - char *p; - unsigned int ui; - - buf += 5; - while (*buf && c_isspace(*buf)) - buf++; - - if (*buf != ':' || !buf[1]) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("parsing cpu MHz from cpuinfo")); - goto cleanup; - } - - if (virStrToLong_ui(buf+1, &p, 10, &ui) == 0 && - /* Accept trailing fractional part. */ - (*p == '\0' || *p == '.' || c_isspace(*p))) - *mhz = ui; - /* No other interesting infos are available in /proc/cpuinfo. - * However, there is a line identifying processor's version, - * identification and machine, but we don't want it to be caught - * and parsed in next iteration, because it is not in expected - * format and thus lead to error. */ - } + if (virHostCPUGetInfoParseCPUFrequency(line, "clock", mhz) < 0) + goto cleanup; } else if (ARCH_IS_ARM(arch)) { - char *buf = line; - if (STRPREFIX(buf, "BogoMIPS")) { - char *p; - unsigned int ui; - - buf += 8; - while (*buf && c_isspace(*buf)) - buf++; - - if (*buf != ':' || !buf[1]) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("parsing cpu MHz from cpuinfo")); - goto cleanup; - } - - if (virStrToLong_ui(buf+1, &p, 10, &ui) == 0 - /* Accept trailing fractional part. */ - && (*p == '\0' || *p == '.' || c_isspace(*p))) - *mhz = ui; - } + if (virHostCPUGetInfoParseCPUFrequency(line, "BogoMIPS", mhz) < 0) + goto cleanup; } else if (ARCH_IS_S390(arch)) { /* s390x has no realistic value for CPU speed, * assign a value of zero to signify this */ -- 2.14.3
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
I attach my take on this refactorization for comparison. Feel free to take stuff you like. Or don't :) -- IBM Systems Linux on z Systems & Virtualization Development ------------------------------------------------------------------------ IBM Deutschland Schönaicher Str. 220 71032 Böblingen Phone: +49 7031 16 1819 E-Mail: bwalk@de.ibm.com ------------------------------------------------------------------------ IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On Wed, 2017-12-13 at 08:42 +0100, Bjoern Walk wrote:
I attach my take on this refactorization for comparison. Feel free to take stuff you like. Or don't :)
Some stuff I like, some I don't :) I'll take the former, leave the latter and post a v2 in a while. -- Andrea Bolognani / Red Hat / Virtualization

Just a couple of small cosmetic improvements, performed separately from the pure code motion which created the function. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- src/util/virhostcpu.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index 85803d527..e74125147 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -524,16 +524,19 @@ virHostCPUGetInfoParseCPUFrequency(const char *buf, while (*buf && c_isspace(*buf)) buf++; - if (*buf != ':' || !buf[1]) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("parsing cpu MHz from cpuinfo")); + if (buf[0] != ':' || !buf[1]) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing or invalid CPU frequency in %s"), + CPUINFO_PATH); goto cleanup; } - if (virStrToLong_ui(buf+1, &p, 10, &ui) == 0 && - /* Accept trailing fractional part. */ - (*p == '\0' || *p == '.' || c_isspace(*p))) + /* Accept an unsigned value, optionally followed by + * a fractional part (which gets discarded) */ + if (virStrToLong_ui(buf + 1, &p, 10, &ui) == 0 && + (*p == '\0' || *p == '.' || c_isspace(*p))) { *mhz = ui; + } } ret = 0; -- 2.14.3

We're going to use this branch for all architectures which don't have a way to report the CPU frequency, so remove references to any specific architecture. Avoid setting the output value again, too, since it is set to zero at the beginning of the function already. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- src/util/virhostcpu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index e74125147..3b478fc45 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -567,9 +567,7 @@ virHostCPUGetInfoParseCPUInfo(FILE *cpuinfo, if (virHostCPUGetInfoParseCPUFrequency(line, "BogoMIPS", mhz) < 0) goto cleanup; } else if (ARCH_IS_S390(arch)) { - /* s390x has no realistic value for CPU speed, - * assign a value of zero to signify this */ - *mhz = 0; + /* No reasonable way to obtain CPU frequency */ } else { VIR_WARN("Parser for /proc/cpuinfo needs to be adapted for your architecture"); break; -- 2.14.3

Some ARM platforms, such as the original Raspberry Pi, report the CPU frequency in the BogoMIPS field of /proc/cpuinfo, so libvirt parsed that field and returned it through its API. However, not only many more boards don't report any value there, but several - including ARMv8-based server hardware, and even the more recent Raspberry Pi 3 - use this field as originally intended: to report the BogoMIPS value instead of the CPU frequency. Since we have no way of detecting how the field is being used, it's better to report no information at all rather than something ludicrous like "your shiny 96-core aarch64 virtualization host's CPUs are running at a whopping 100 MHz". Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- src/util/virhostcpu.c | 5 +---- tests/virhostcpudata/linux-aarch64-rhel74-moonshot.expected | 2 +- tests/virhostcpudata/linux-armv6l-raspberrypi.expected | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index 3b478fc45..9bc213580 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -563,10 +563,7 @@ virHostCPUGetInfoParseCPUInfo(FILE *cpuinfo, } else if (ARCH_IS_PPC(arch)) { if (virHostCPUGetInfoParseCPUFrequency(line, "clock", mhz) < 0) goto cleanup; - } else if (ARCH_IS_ARM(arch)) { - if (virHostCPUGetInfoParseCPUFrequency(line, "BogoMIPS", mhz) < 0) - goto cleanup; - } else if (ARCH_IS_S390(arch)) { + } else if (ARCH_IS_S390(arch) || ARCH_IS_ARM(arch)) { /* No reasonable way to obtain CPU frequency */ } else { VIR_WARN("Parser for /proc/cpuinfo needs to be adapted for your architecture"); diff --git a/tests/virhostcpudata/linux-aarch64-rhel74-moonshot.expected b/tests/virhostcpudata/linux-aarch64-rhel74-moonshot.expected index 24ff0ea0b..6776aa6c2 100644 --- a/tests/virhostcpudata/linux-aarch64-rhel74-moonshot.expected +++ b/tests/virhostcpudata/linux-aarch64-rhel74-moonshot.expected @@ -1 +1 @@ -CPUs: 8/8, MHz: 100, Nodes: 1, Sockets: 1, Cores: 8, Threads: 1 +CPUs: 8/8, MHz: 0, Nodes: 1, Sockets: 1, Cores: 8, Threads: 1 diff --git a/tests/virhostcpudata/linux-armv6l-raspberrypi.expected b/tests/virhostcpudata/linux-armv6l-raspberrypi.expected index 146bd073e..1c4c713d5 100644 --- a/tests/virhostcpudata/linux-armv6l-raspberrypi.expected +++ b/tests/virhostcpudata/linux-armv6l-raspberrypi.expected @@ -1 +1 @@ -CPUs: 1/1, MHz: 697, Nodes: 1, Sockets: 1, Cores: 1, Threads: 1 +CPUs: 1/1, MHz: 0, Nodes: 1, Sockets: 1, Cores: 1, Threads: 1 -- 2.14.3

On Mon, Dec 11, 2017 at 05:40:36PM +0100, Andrea Bolognani wrote:
Some ARM platforms, such as the original Raspberry Pi, report the CPU frequency in the BogoMIPS field of /proc/cpuinfo, so libvirt parsed that field and returned it through its API.
However, not only many more boards don't report any value there, but several - including ARMv8-based server hardware, and even the more recent Raspberry Pi 3 - use this field as originally intended: to report the BogoMIPS value instead of the CPU frequency.
Since we have no way of detecting how the field is being used, it's better to report no information at all rather than something ludicrous like "your shiny 96-core aarch64 virtualization host's CPUs are running at a whopping 100 MHz".
Can we perhaps get useful freq data from sysfs instead ? I know my x86 machines report freq there, but I'm unsure if that reporting is x86-specific or not. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

On Mon, 2017-12-11 at 16:46 +0000, Daniel P. Berrange wrote:
On Mon, Dec 11, 2017 at 05:40:36PM +0100, Andrea Bolognani wrote:
Some ARM platforms, such as the original Raspberry Pi, report the CPU frequency in the BogoMIPS field of /proc/cpuinfo, so libvirt parsed that field and returned it through its API.
However, not only many more boards don't report any value there, but several - including ARMv8-based server hardware, and even the more recent Raspberry Pi 3 - use this field as originally intended: to report the BogoMIPS value instead of the CPU frequency.
Since we have no way of detecting how the field is being used, it's better to report no information at all rather than something ludicrous like "your shiny 96-core aarch64 virtualization host's CPUs are running at a whopping 100 MHz".
Can we perhaps get useful freq data from sysfs instead ? I know my x86 machines report freq there, but I'm unsure if that reporting is x86-specific or not.
The plan is to start using dmidecode(8) to retrieve the CPU frequency, since AIUI it's already doing some work to locate the information and process it and it would be quite pointless to duplicate all that in libvirt. Plus we're already using the tool for other stuff. I think that would only work on server-grade aarch64 hardware, though, because most other ARM hardware will simply not expose the information we need; even in that case, not reporting any CPU frequency is better than reporting a completely bogus value. So basically reporting the actual CPU frequency when possible is in my TODO list[1], but I believe there's value in merging this series as-is since it already improves significantly on the status quo. [1] https://bugzilla.redhat.com/show_bug.cgi?id=1206353 -- Andrea Bolognani / Red Hat / Virtualization

On Mon, Dec 11, 2017 at 06:14:54PM +0100, Andrea Bolognani wrote:
On Mon, 2017-12-11 at 16:46 +0000, Daniel P. Berrange wrote:
On Mon, Dec 11, 2017 at 05:40:36PM +0100, Andrea Bolognani wrote:
Some ARM platforms, such as the original Raspberry Pi, report the CPU frequency in the BogoMIPS field of /proc/cpuinfo, so libvirt parsed that field and returned it through its API.
However, not only many more boards don't report any value there, but several - including ARMv8-based server hardware, and even the more recent Raspberry Pi 3 - use this field as originally intended: to report the BogoMIPS value instead of the CPU frequency.
Since we have no way of detecting how the field is being used, it's better to report no information at all rather than something ludicrous like "your shiny 96-core aarch64 virtualization host's CPUs are running at a whopping 100 MHz".
Can we perhaps get useful freq data from sysfs instead ? I know my x86 machines report freq there, but I'm unsure if that reporting is x86-specific or not.
The plan is to start using dmidecode(8) to retrieve the CPU frequency, since AIUI it's already doing some work to locate the information and process it and it would be quite pointless to duplicate all that in libvirt. Plus we're already using the tool for other stuff.
I think that would only work on server-grade aarch64 hardware, though, because most other ARM hardware will simply not expose the information we need; even in that case, not reporting any CPU frequency is better than reporting a completely bogus value.
So basically reporting the actual CPU frequency when possible is in my TODO list[1], but I believe there's value in merging this series as-is since it already improves significantly on the status quo.
Sure, that's fine. I wasn't objecting to merging this series, just wondering where we might find the useful data in future. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

Andrea Bolognani <abologna@redhat.com> [2017-12-11, 05:40PM +0100]:
Some ARM platforms, such as the original Raspberry Pi, report the CPU frequency in the BogoMIPS field of /proc/cpuinfo, so libvirt parsed that field and returned it through its API.
However, not only many more boards don't report any value there, but several - including ARMv8-based server hardware, and even the more recent Raspberry Pi 3 - use this field as originally intended: to report the BogoMIPS value instead of the CPU frequency.
Since we have no way of detecting how the field is being used, it's better to report no information at all rather than something ludicrous like "your shiny 96-core aarch64 virtualization host's CPUs are running at a whopping 100 MHz".
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- src/util/virhostcpu.c | 5 +---- tests/virhostcpudata/linux-aarch64-rhel74-moonshot.expected | 2 +- tests/virhostcpudata/linux-armv6l-raspberrypi.expected | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index 3b478fc45..9bc213580 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -563,10 +563,7 @@ virHostCPUGetInfoParseCPUInfo(FILE *cpuinfo, } else if (ARCH_IS_PPC(arch)) { if (virHostCPUGetInfoParseCPUFrequency(line, "clock", mhz) < 0) goto cleanup; - } else if (ARCH_IS_ARM(arch)) { - if (virHostCPUGetInfoParseCPUFrequency(line, "BogoMIPS", mhz) < 0) - goto cleanup; - } else if (ARCH_IS_S390(arch)) { + } else if (ARCH_IS_S390(arch) || ARCH_IS_ARM(arch)) { /* No reasonable way to obtain CPU frequency */ } else { VIR_WARN("Parser for /proc/cpuinfo needs to be adapted for your architecture");
I'm a bit confused now. If we have a not supported arch, will this warning not get issued for every line in /proc/cpuinfo? It's the same for the original code.
diff --git a/tests/virhostcpudata/linux-aarch64-rhel74-moonshot.expected b/tests/virhostcpudata/linux-aarch64-rhel74-moonshot.expected index 24ff0ea0b..6776aa6c2 100644 --- a/tests/virhostcpudata/linux-aarch64-rhel74-moonshot.expected +++ b/tests/virhostcpudata/linux-aarch64-rhel74-moonshot.expected @@ -1 +1 @@ -CPUs: 8/8, MHz: 100, Nodes: 1, Sockets: 1, Cores: 8, Threads: 1 +CPUs: 8/8, MHz: 0, Nodes: 1, Sockets: 1, Cores: 8, Threads: 1 diff --git a/tests/virhostcpudata/linux-armv6l-raspberrypi.expected b/tests/virhostcpudata/linux-armv6l-raspberrypi.expected index 146bd073e..1c4c713d5 100644 --- a/tests/virhostcpudata/linux-armv6l-raspberrypi.expected +++ b/tests/virhostcpudata/linux-armv6l-raspberrypi.expected @@ -1 +1 @@ -CPUs: 1/1, MHz: 697, Nodes: 1, Sockets: 1, Cores: 1, Threads: 1 +CPUs: 1/1, MHz: 0, Nodes: 1, Sockets: 1, Cores: 1, Threads: 1 -- 2.14.3
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
-- IBM Systems Linux on z Systems & Virtualization Development ------------------------------------------------------------------------ IBM Deutschland Schönaicher Str. 220 71032 Böblingen Phone: +49 7031 16 1819 E-Mail: bwalk@de.ibm.com ------------------------------------------------------------------------ IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On Wed, 2017-12-13 at 08:45 +0100, Bjoern Walk wrote:
@@ -563,10 +563,7 @@ virHostCPUGetInfoParseCPUInfo(FILE *cpuinfo, } else if (ARCH_IS_PPC(arch)) { if (virHostCPUGetInfoParseCPUFrequency(line, "clock", mhz) < 0) goto cleanup; - } else if (ARCH_IS_ARM(arch)) { - if (virHostCPUGetInfoParseCPUFrequency(line, "BogoMIPS", mhz) < 0) - goto cleanup; - } else if (ARCH_IS_S390(arch)) { + } else if (ARCH_IS_S390(arch) || ARCH_IS_ARM(arch)) { /* No reasonable way to obtain CPU frequency */ } else { VIR_WARN("Parser for /proc/cpuinfo needs to be adapted for your architecture");
I'm a bit confused now. If we have a not supported arch, will this warning not get issued for every line in /proc/cpuinfo? It's the same for the original code.
Yeah, it would look that way :) -- Andrea Bolognani / Red Hat / Virtualization

Andrea Bolognani <abologna@redhat.com> [2017-12-11, 05:40PM +0100]:
A few steps towards eventually fixing
https://bugzilla.redhat.com/show_bug.cgi?id=1206353
The commit message for patch 6/6 contains most of the rationale, previous patches are cleanups. If not for the new test case added with patch 1/6, the overall diffstat would be negative.
The timings... I have a similar patch set in my queue that I wanted to send out today, but, well. I also have fixed frequency reporting on S390, which I will at least rebase on top of this. Before you push, I want to review this series and compare it with mine, but I can't make it today I'm afraid. I will find the time to do it tomorrow. Best, Bjoern -- IBM Systems Linux on z Systems & Virtualization Development ------------------------------------------------------------------------ IBM Deutschland Schönaicher Str. 220 71032 Böblingen Phone: +49 7031 16 1819 E-Mail: bwalk@de.ibm.com ------------------------------------------------------------------------ IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On Tue, 2017-12-12 at 12:52 +0100, Bjoern Walk wrote:
Andrea Bolognani <abologna@redhat.com> [2017-12-11, 05:40PM +0100]:
A few steps towards eventually fixing
https://bugzilla.redhat.com/show_bug.cgi?id=1206353
The commit message for patch 6/6 contains most of the rationale, previous patches are cleanups. If not for the new test case added with patch 1/6, the overall diffstat would be negative.
The timings... I have a similar patch set in my queue that I wanted to send out today, but, well. I also have fixed frequency reporting on S390, which I will at least rebase on top of this.
I'm sorry! Some amount of duplicated work is kind of unavoidable in a loosely-organized community project such as libvirt. Hopefully rebasing on top of my series is not too much work, considering most of it is just refactoring and cleanups.
Before you push, I want to review this series and compare it with mine, but I can't make it today I'm afraid. I will find the time to do it tomorrow.
I'd certainly appreciate that. The series doesn't have any ACKs yet, so there's no risk I'd push it before you can get to it :) -- Andrea Bolognani / Red Hat / Virtualization

Andrea Bolognani <abologna@redhat.com> [2017-12-12, 04:43PM +0100]:
On Tue, 2017-12-12 at 12:52 +0100, Bjoern Walk wrote:
Andrea Bolognani <abologna@redhat.com> [2017-12-11, 05:40PM +0100]:
A few steps towards eventually fixing
https://bugzilla.redhat.com/show_bug.cgi?id=1206353
The commit message for patch 6/6 contains most of the rationale, previous patches are cleanups. If not for the new test case added with patch 1/6, the overall diffstat would be negative.
The timings... I have a similar patch set in my queue that I wanted to send out today, but, well. I also have fixed frequency reporting on S390, which I will at least rebase on top of this.
I'm sorry! Some amount of duplicated work is kind of unavoidable in a loosely-organized community project such as libvirt.
No problem at all, I am glad that this code gets fixed by whoever, it certainly deserved it.
Hopefully rebasing on top of my series is not too much work, considering most of it is just refactoring and cleanups.
Should be no problem. I will wait for you to push this and then send out the S390 improvements.
Before you push, I want to review this series and compare it with mine, but I can't make it today I'm afraid. I will find the time to do it tomorrow.
I'd certainly appreciate that. The series doesn't have any ACKs yet, so there's no risk I'd push it before you can get to it :)
So, both our approached were fairly similar, with some bike-shedding differences. For patch 2-5: Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
-- Andrea Bolognani / Red Hat / Virtualization
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
-- IBM Systems Linux on z Systems & Virtualization Development ------------------------------------------------------------------------ IBM Deutschland Schönaicher Str. 220 71032 Böblingen Phone: +49 7031 16 1819 E-Mail: bwalk@de.ibm.com ------------------------------------------------------------------------ IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
participants (3)
-
Andrea Bolognani
-
Bjoern Walk
-
Daniel P. Berrange