From e47ad3aa853a64bf4d2aab876e21384002f032a2 Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Tue, 17 Dec 2024 15:50:20 +1100 Subject: [PATCH] CI: Add a tool for displaying CPU flags and QEMU version As RHEL-10, and related OS projects (CentOS, RockyLinux, and AlmaLinux), need specific x86_84 machine levels, in this case x86_64-v3, It's helpful to see which CPUFlags are present in a given node and which version of QEMU is available. This adds a small tool to list the CPUFlags needed and those found. There are a few tools that will can do similar things but I didn't find one that covered what we need. Change-Id: Id8e4f679f6e781dce61d6ace151f3b639dc7edcc --- .zuul.d/jobs.yaml | 1 + playbooks/dib-nodepool/files/cpu-level.sh | 34 ++++++++++++++++++++ playbooks/dib-nodepool/node-information.yaml | 16 +++++++++ 3 files changed, 51 insertions(+) create mode 100644 playbooks/dib-nodepool/files/cpu-level.sh create mode 100644 playbooks/dib-nodepool/node-information.yaml diff --git a/.zuul.d/jobs.yaml b/.zuul.d/jobs.yaml index b9cf040ab..559a32c3e 100644 --- a/.zuul.d/jobs.yaml +++ b/.zuul.d/jobs.yaml @@ -79,6 +79,7 @@ Base job for DIB functional tests, which build and boot a node under nodepool, using source versions of dependencies such as nodepool, dib, openstacksdk and glean. + pre-run: playbooks/dib-nodepool/node-information.yaml parent: nodepool-functional-container-openstack-siblings-base post-run: playbooks/dib-nodepool/collect-openstack-logs.yaml vars: diff --git a/playbooks/dib-nodepool/files/cpu-level.sh b/playbooks/dib-nodepool/files/cpu-level.sh new file mode 100644 index 000000000..a6c4c0cf9 --- /dev/null +++ b/playbooks/dib-nodepool/files/cpu-level.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +function report_cpu_flags() { + local flag + + for flag; do + ## Note, it's important to keep a trailing space + case " ${flags} " in + *" ${flag} "*) + echo " ${flag} Found" + ;; + *) + echo " ${flag} NOT Found" + ;; + esac + done +} + +data=$(< /proc/cpuinfo) +flags="" +flags=$(grep "^flags[[:space:]]*:" <<< "${data}" | head -n 1) +flags="${flags#*:}" +flags="${flags## }" + +echo "${flags}" + +echo "x86_64-v1" +report_cpu_flags lm cmov cx8 fpu fxsr mmx syscall sse2 +echo "x86_64-v2" +report_cpu_flags cx16 lahf_lm popcnt sse4_1 sse4_2 ssse3 +echo "x86_64-v3" +report_cpu_flags avx avx2 bmi1 bmi2 f16c fma abm movbe xsave +echo "x86_64-v4" +report_cpu_flags avx512f avx512bw avx512cd avx512dq avx512vl diff --git a/playbooks/dib-nodepool/node-information.yaml b/playbooks/dib-nodepool/node-information.yaml new file mode 100644 index 000000000..8bbbf9ac5 --- /dev/null +++ b/playbooks/dib-nodepool/node-information.yaml @@ -0,0 +1,16 @@ +- hosts: all + tasks: + - name: Copy the cpu-level script into place + copy: + src: cpu-level.sh + dest: /tmp/cpu-level.sh + mode: + - name: Collect CPU flags for node + command: bash /tmp/cpu-level.sh + # NOTE(tonyb): This is interesting as QEMU gains the ability to emuluate + # newer machine types for example 7.2 is needed for haswell. + - name: Collect QEMU version + ignore_errors: true + shell: |- + qemu-kvm --version + qemu-system-$(arch) --version \ No newline at end of file