All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] controllers/cpuset_hotplug: skip unsupported Microsoft Hyper-V
@ 2021-06-22 14:59 Krzysztof Kozlowski
  2021-06-23  9:25 ` Petr Vorel
  2021-06-23  9:32 ` Petr Vorel
  0 siblings, 2 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2021-06-22 14:59 UTC (permalink / raw)
  To: ltp

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

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 .../kernel/controllers/cpuset/cpuset_funcs.sh | 25 +++++++++++++++++++
 .../include/cpuhotplug_testsuite.sh           |  2 ++
 2 files changed, 27 insertions(+)

diff --git a/testcases/kernel/controllers/cpuset/cpuset_funcs.sh b/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
index f3ba1d5ca931..397784a3f2ac 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
@@ -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
diff --git a/testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_testsuite.sh b/testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_testsuite.sh
index 291dc5ab2b7e..561b7cf85370 100644
--- a/testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_testsuite.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_testsuite.sh
@@ -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)"
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] controllers/cpuset_hotplug: skip unsupported Microsoft Hyper-V
  2021-06-22 14:59 [LTP] [PATCH] controllers/cpuset_hotplug: skip unsupported Microsoft Hyper-V Krzysztof Kozlowski
@ 2021-06-23  9:25 ` Petr Vorel
  2021-06-23  9:35   ` Krzysztof Kozlowski
  2021-06-23  9:32 ` Petr Vorel
  1 sibling, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2021-06-23  9:25 UTC (permalink / raw)
  To: ltp

Hi Krzysztof,

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

Reviewed-by: Petr Vorel <pvorel@suse.cz>

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] controllers/cpuset_hotplug: skip unsupported Microsoft Hyper-V
  2021-06-22 14:59 [LTP] [PATCH] controllers/cpuset_hotplug: skip unsupported Microsoft Hyper-V Krzysztof Kozlowski
  2021-06-23  9:25 ` Petr Vorel
@ 2021-06-23  9:32 ` Petr Vorel
  1 sibling, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2021-06-23  9:32 UTC (permalink / raw)
  To: ltp

Hi Krzysztof,

> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] controllers/cpuset_hotplug: skip unsupported Microsoft Hyper-V
  2021-06-23  9:25 ` Petr Vorel
@ 2021-06-23  9:35   ` Krzysztof Kozlowski
  2021-06-23 11:57     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2021-06-23  9:35 UTC (permalink / raw)
  To: ltp

On 23/06/2021 11:25, Petr Vorel wrote:
> Hi Krzysztof,
> 
>> 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]
> 
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> 
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] controllers/cpuset_hotplug: skip unsupported Microsoft Hyper-V
  2021-06-23  9:35   ` Krzysztof Kozlowski
@ 2021-06-23 11:57     ` Krzysztof Kozlowski
  2021-06-23 13:34       ` Petr Vorel
  0 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2021-06-23 11:57 UTC (permalink / raw)
  To: ltp

On 23/06/2021 11:35, Krzysztof Kozlowski wrote:
> On 23/06/2021 11:25, Petr Vorel wrote:
>> Hi Krzysztof,
>>
>>> 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]
>>
>> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>>
>> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] controllers/cpuset_hotplug: skip unsupported Microsoft Hyper-V
  2021-06-23 11:57     ` Krzysztof Kozlowski
@ 2021-06-23 13:34       ` Petr Vorel
  2021-06-23 14:59         ` Krzysztof Kozlowski
  0 siblings, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2021-06-23 13:34 UTC (permalink / raw)
  To: ltp

Hi Krzysztof,

> On 23/06/2021 11:35, Krzysztof Kozlowski wrote:
> > On 23/06/2021 11:25, Petr Vorel wrote:
> >> Hi Krzysztof,

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

> >> Reviewed-by: Petr Vorel <pvorel@suse.cz>

> >> 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).

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

> Best regards,
> Krzysztof

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] controllers/cpuset_hotplug: skip unsupported Microsoft Hyper-V
  2021-06-23 13:34       ` Petr Vorel
@ 2021-06-23 14:59         ` Krzysztof Kozlowski
  0 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2021-06-23 14:59 UTC (permalink / raw)
  To: ltp

On 23/06/2021 15:34, Petr Vorel wrote:
> Hi Krzysztof,
> 
>> On 23/06/2021 11:35, Krzysztof Kozlowski wrote:
>>> On 23/06/2021 11:25, Petr Vorel wrote:
>>>> Hi Krzysztof,
> 
>>>>> 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]
> 
>>>> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> 
>>>> 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).
> 
> 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.

> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-06-23 14:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22 14:59 [LTP] [PATCH] controllers/cpuset_hotplug: skip unsupported Microsoft Hyper-V Krzysztof Kozlowski
2021-06-23  9:25 ` Petr Vorel
2021-06-23  9:35   ` Krzysztof Kozlowski
2021-06-23 11:57     ` Krzysztof Kozlowski
2021-06-23 13:34       ` Petr Vorel
2021-06-23 14:59         ` Krzysztof Kozlowski
2021-06-23  9:32 ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.