Skip to contentSkip to conversation

controllers/cpuset_hotplug: skip unsupported Microsoft Hyper-V

PATCH New Krzysztof Kozlowski 2 participants 7 messages Jun 22, 2021 – Jun 23, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 controllers/cpuset_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]

The test fails on Azure clouds with:

cpuset_hotplug 1 TINFO: /bin/echo: write error: Device or resource busy cpuset_hotplug 1 TFAIL: CPU#1 failed.
cpuset_hotplug 3 TINFO: /bin/echo: write error: Device or resource busy cpuset_hotplug 3 TFAIL: setup test environment(offline CPU#1) failed cpuset_hotplug 5 TINFO: /bin/echo: write error: Device or resource busy cpuset_hotplug 5 TFAIL: CPU#1 failed.
cpuset_hotplug 7 TINFO: /bin/echo: write error: Device or resource busy cpuset_hotplug 7 TFAIL: CPU#1 failed.
cpuset_hotplug 9 TINFO: /bin/echo: write error: Device or resource busy cpuset_hotplug 9 TFAIL: CPU#1 failed.
cpuset_hotplug 11 TINFO: /bin/echo: write error: Device or resource busy cpuset_hotplug 11 TFAIL: setup test environment(offline CPU#1) failed

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 tests would have to be converted to newlib.

[1] https://bugs.launchpad.net/ubuntu/+source/linux-azure/+bug/1776293

---
 .../kernel/controllers/cpuset/cpuset_funcs.sh | 25 +++++++++++++++++++
 .../include/cpuhotplug_testsuite.sh           |  2 ++
 2 files changed, 27 insertions(+)
testcases/kernel/controllers/cpuset/cpuset_funcs.sh +25 -0
index f3ba1d5ca931..397784a3f2ac 100755
@@ -63,6 +63,23 @@ HOTPLUG_CPU="1"
 SCHED_LB="/dev/cpuset/cpuset.sched_load_balance"
 SCHED_LB_VALUE="0"
 
+# 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)
+# TODO: move to newlib and remove duplication with:
+#       testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_testsuite.sh
+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
+}
+
 cpuset_log()
 {
 	tst_resm TINFO "$*"
@@ -134,6 +151,13 @@ cpuset_check()
 	tst_brkm TCONF "Cpuset is not supported"
 }
 
+machine_check()
+{
+	if tst_virt_hyperv; then
+		tst_brkm TCONF "Microsoft Hyper-V detected, no support for CPU hotplug"
+	fi
+}
+
 # optional parameters (pass both or none of them):
 # $1 - required number of cpus (default 2)
 # $2 - required number of memory nodes (default 2)
@@ -149,6 +173,7 @@ check()
 
 	nnodes_check ${2:-2}
 
+	machine_check
 }
 
 # Create /dev/cpuset & mount the cgroup file system with cpuset
testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_testsuite.sh +2 -0
index 291dc5ab2b7e..561b7cf85370 100644
@@ -54,6 +54,8 @@ assert ()                 #  If condition false,
 # Return 0: running under Hyper-V
 # Return 1: not running under Hyper-V (bare metal, other hypervisor or
 #           failure of detection)
+# TODO: move to newlib and remove duplication with:
+#       testcases/kernel/controllers/cpuset/cpuset_funcs.sh
 tst_virt_hyperv()
 {
 	local v="$(systemd-detect-virt)"
Signature · 1 line
2.27.0
#1 lore raw

PATCH 1/1 controllers/cpuset_hotplug: skip unsupported Microsoft Hyper-V

Hi Krzysztof,

Quoted 4 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]

LGTM. How many of tests will need tst_virt_hyperv? Although we don't touch legacy API, I'd make an exception and add it to both test.sh and tst_test.sh (ideally with an API extension, i.e. test could use SKIP_VIRT="hyperv", but that can wait till tests are converted).

Kind regards,
Petr

#2 lore raw

PATCH 1/1 controllers/cpuset_hotplug: skip unsupported Microsoft Hyper-V

Quoted 7 lines · Petr Vorel

Hi Krzysztof,

Quoted 4 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]

Quoted 6 lines

LGTM. How many of tests will need tst_virt_hyperv? Although we don't touch legacy API, I'd make an exception and add it to both test.sh and tst_test.sh (ideally with an API extension, i.e. test could use SKIP_VIRT="hyperv", but that can wait till tests are converted).

Around CPU hotplug that would be the last one I did not spot so far other failures but I also do not track all failures in nice way. Rather fixing them ad-hoc...

Best regards,
Krzysztof

#3 lore raw

PATCH 1/1 controllers/cpuset_hotplug: skip unsupported Microsoft Hyper-V

Quoted 10 lines · Krzysztof Kozlowski
Quoted 9 lines · Petr Vorel

Hi Krzysztof,

Quoted 4 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]

Quoted 8 lines
Quoted 4 lines

LGTM. How many of tests will need tst_virt_hyperv? Although we don't touch legacy API, I'd make an exception and add it to both test.sh and tst_test.sh (ideally with an API extension, i.e. test could use SKIP_VIRT="hyperv", but that can wait till tests are converted).

Around CPU hotplug that would be the last one I did not spot so far other failures but I also do not track all failures in nice way. Rather fixing them ad-hoc...

I just checked more and there are additional failures on Azure/HyperV with more nodes: cpuset_load_balance, cpuset_memory_pressure, cpuset_memory_spread and cpuset_sched_domains. These did not appear on smaller instances (e.g. 4 CPUs).

Best regards,
Krzysztof

#4 lore raw

PATCH 1/1 controllers/cpuset_hotplug: skip unsupported Microsoft Hyper-V

Hi Krzysztof,

Quoted 16 lines · Krzysztof Kozlowski
Quoted 14 lines · Petr Vorel
Quoted 13 lines

Hi Krzysztof,

Quoted 4 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]

LGTM. How many of tests will need tst_virt_hyperv? Although we don't touch legacy API, I'd make an exception and add it to both test.sh and tst_test.sh (ideally with an API extension, i.e. test could use SKIP_VIRT="hyperv", but that can wait till tests are converted).

Quoted 8 lines
Quoted 3 lines

Around CPU hotplug that would be the last one I did not spot so far other failures but I also do not track all failures in nice way. Rather fixing them ad-hoc...

I just checked more and there are additional failures on Azure/HyperV with more nodes: cpuset_load_balance, cpuset_memory_pressure, cpuset_memory_spread and cpuset_sched_domains. These did not appear on smaller instances (e.g. 4 CPUs).

Good to know. Does it mean we should check number of processors?

But even there were just these two and no additional change to tst_virt_hyperv(), we'd prefer to have them in test.sh and tst_test.sh. Could you please send v2, where you implement that?

Kind regards,
Petr

Quoted 2 lines

Best regards,
Krzysztof

#5 lore raw

PATCH 1/1 controllers/cpuset_hotplug: skip unsupported Microsoft Hyper-V

Quoted 22 lines · Petr Vorel

Hi Krzysztof,

Quoted 19 lines · Krzysztof Kozlowski
Quoted 18 lines · Petr Vorel
Quoted 7 lines

Hi Krzysztof,

Quoted 4 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]

Quoted 6 lines

LGTM. How many of tests will need tst_virt_hyperv? Although we don't touch legacy API, I'd make an exception and add it to both test.sh and tst_test.sh (ideally with an API extension, i.e. test could use SKIP_VIRT="hyperv", but that can wait till tests are converted).

Around CPU hotplug that would be the last one I did not spot so far other failures but I also do not track all failures in nice way. Rather fixing them ad-hoc...

Quoted 6 lines
Quoted 4 lines

I just checked more and there are additional failures on Azure/HyperV with more nodes: cpuset_load_balance, cpuset_memory_pressure, cpuset_memory_spread and cpuset_sched_domains. These did not appear on smaller instances (e.g. 4 CPUs).

Good to know. Does it mean we should check number of processors?

No, it should be the same case as here, I just did not hit that test on some of cloud instances (the tests are for CPU nodes > 1). I'll just find a proper instance to try to reproduce it there.

Quoted 3 lines

But even there were just these two and no additional change to tst_virt_hyperv(), we'd prefer to have them in test.sh and tst_test.sh. Could you please send v2, where you implement that?

I'll take a look.

Best regards,
Krzysztof

#6 lore raw

PATCH 1/1 controllers/cpuset_hotplug: skip unsupported Microsoft Hyper-V

In reply to Krzysztof Kozlowski

Hi Krzysztof,

Quoted 4 lines

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.

Yes, we use systemd-detect-virt also in lib/tst_virt.c. We could steal code from systemd (src/basic/virt.c), but as nobody has complained, this will have to wait for somebody who is not using systemd.

Kind regards,
Petr