hotplug/cpu_hotplug: skip unsupported Microsoft Hyper-V
PATCH 1/1 hotplug/cpu_hotplug: skip unsupported Microsoft Hyper-V
Microsoft Hyper-V with Linux guests does not support CPU hotplug, even if enabled in kernel configuration. Quoting Ubuntu bug report from June 2018: "While Hyper-V may present all potential CPUs via ACPI MADT, CPU add/remove is not supported.". [1]
Detect the Hyper-V with systemd and if it succeeds, skip the test. This of course does not support all possible cases, e.g. running tests under Hyper-V without systemd will still fail, but it's a easy way to avoid test failure in common configuration.
Ideally the newly introduced tst_virt_hyperv should be added to testcases/lib but first the CPU hotplug tests would have to be converted to newlib.
[1] https://bugs.launchpad.net/ubuntu/+source/linux-azure/+bug/1776293
--- .../cpu_hotplug/functional/cpuhotplug01.sh | 4 ++++ .../cpu_hotplug/functional/cpuhotplug02.sh | 4 ++++ .../cpu_hotplug/functional/cpuhotplug03.sh | 4 ++++ .../cpu_hotplug/functional/cpuhotplug04.sh | 4 ++++ .../cpu_hotplug/functional/cpuhotplug05.sh | 4 ++++ .../cpu_hotplug/functional/cpuhotplug06.sh | 4 ++++ .../cpu_hotplug/functional/cpuhotplug07.sh | 4 ++++ .../cpu_hotplug/include/cpuhotplug_testsuite.sh | 15 +++++++++++++++ 8 files changed, 43 insertions(+)
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh +4 -0
@@ -111,6 +111,10 @@ LOOP_COUNT=1 tst_require_cmds perl +if tst_virt_hyperv ; then + tst_brkm TCONF "Microsoft Hyper-V detected, no support for CPU hotplug" +fi + if [ $(get_present_cpus_num) -lt 2 ]; then tst_brkm TCONF "system doesn't have required CPU hotplug support" fi
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh +4 -0
@@ -54,6 +54,10 @@ done LOOP_COUNT=1 +if tst_virt_hyperv ; then + tst_brkm TCONF "Microsoft Hyper-V detected, no support for CPU hotplug" +fi + if [ $(get_present_cpus_num) -lt 2 ]; then tst_brkm TCONF "system doesn't have required CPU hotplug support" fi
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh +4 -0
@@ -63,6 +63,10 @@ done LOOP_COUNT=1 +if tst_virt_hyperv ; then + tst_brkm TCONF "Microsoft Hyper-V detected, no support for CPU hotplug" +fi + cpus_num=$(get_present_cpus_num) if [ $cpus_num -lt 2 ]; then tst_brkm TCONF "system doesn't have required CPU hotplug support"
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh +4 -0
@@ -48,6 +48,10 @@ done LOOP_COUNT=1 +if tst_virt_hyperv ; then + tst_brkm TCONF "Microsoft Hyper-V detected, no support for CPU hotplug" +fi + cpus_num=$(get_present_cpus_num) if [ $cpus_num -lt 2 ]; then tst_brkm TCONF "system doesn't have required CPU hotplug support"
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh +4 -0
@@ -61,6 +61,10 @@ LOOP_COUNT=1 tst_require_cmds sar +if tst_virt_hyperv ; then + tst_brkm TCONF "Microsoft Hyper-V detected, no support for CPU hotplug" +fi + if [ $(get_present_cpus_num) -lt 2 ]; then tst_brkm TCONF "system doesn't have required CPU hotplug support" fi
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh +4 -0
@@ -49,6 +49,10 @@ done LOOP_COUNT=1 +if tst_virt_hyperv ; then + tst_brkm TCONF "Microsoft Hyper-V detected, no support for CPU hotplug" +fi + if top -v | grep -q htop; then tst_brkm TCONF "htop is used instead of top (workaround: alias top='/path/to/real/top')" fi
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh +4 -0
@@ -55,6 +55,10 @@ done LOOP_COUNT=1 +if tst_virt_hyperv ; then + tst_brkm TCONF "Microsoft Hyper-V detected, no support for CPU hotplug" +fi + if [ $(get_present_cpus_num) -lt 2 ]; then tst_brkm TCONF "system doesn't have required CPU hotplug support" fi
testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_testsuite.sh +15 -0
@@ -50,6 +50,21 @@ assert () # If condition false, fi } +# Detect whether running under hypervisor: Microsoft Hyper-V +# Return 0: running under Hyper-V +# Return 1: not running under Hyper-V (bare metal, other hypervisor or +# failure of detection) +tst_virt_hyperv() +{ + local v="$(systemd-detect-virt)" + # TODO: once converted to newlib, use tst_cmd_available + + [ $? -eq 0 ] || return 1 + [ "$v" = "microsoft" ] || return 1 + + return 0 +} + ############################################################ ## Process management ## ############################################################
Signature · 1 line
2.27.0
PATCH 1/1 hotplug/cpu_hotplug: skip unsupported Microsoft Hyper-V
Hi Krzysztof,
Quoted 9 lines
Microsoft Hyper-V with Linux guests does not support CPU hotplug, even if enabled in kernel configuration. Quoting Ubuntu bug report from June 2018: "While Hyper-V may present all potential CPUs via ACPI MADT, CPU add/remove is not supported.". [1]
Detect the Hyper-V with systemd and if it succeeds, skip the test. This of course does not support all possible cases, e.g. running tests under Hyper-V without systemd will still fail, but it's a easy way to avoid test failure in common configuration.
Good catch, thanks!
Quoted 3 lines
Ideally the newly introduced
tst_virt_hypervshould be added to testcases/lib but first the CPU hotplug tests would have to be converted to newlib.
+1, thanks for TODO.
Quoted 1 line
[1] https://bugs.launchpad.net/ubuntu/+source/linux-azure/+bug/1776293
Kind regards,
Petr