selftests/net: ignore timing errors in so_txtime if KSFT_MACHINE_SLOW
Subsystems (3)
PATCH 1/1 selftests/net: ignore timing errors in so_txtime if KSFT_MACHINE_SLOW
From: Willem de Bruijn <[email protected]>
This test is time sensitive. It may fail on virtual machines and for debug builds.
Continue to run in these environments to get code coverage. But optionally suppress failure for timing errors (only). This is controlled with environment variable KSFT_MACHINE_SLOW.
The test continues to return 0 (KSFT_PASS), rather than KSFT_XFAIL as previously discussed. Because making so_txtime.c return that and then making so_txtime.sh capture runs that pass that vs KSFT_FAIL and pass it on added a bunch of (fragile bash) boilerplate, while the result is interpreted the same as KSFT_PASS anyway.
--- tools/testing/selftests/net/so_txtime.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
tools/testing/selftests/net/so_txtime.c +5 -2
@@ -134,8 +134,11 @@ static void do_recv_one(int fdr, struct timed_send *ts)if (rbuf[0 ] != ts->data)error (1 ,0 ,"payload mismatch. expected %c" , ts->data); -if (llabs (tstop - texpect) > cfg_variance_us) -error (1 ,0 ,"exceeds variance (%d us)" , cfg_variance_us); +if (llabs (tstop - texpect) > cfg_variance_us) { +fprintf (stderr,"exceeds variance (%d us)\n" , cfg_variance_us); +if (!getenv ("KSFT_MACHINE_SLOW" )) +exit (1 ); + } }static void do_recv_verify_empty (int fdr)
Signature · 1 line
2.43.0.429.g432eaa2c6b-goog
Jakub Kicinski
maintainerQuoted 7 lines · On Thu, 1 Feb 2024 11:21:19 -0500 Willem de Bruijn wrote:
This test is time sensitive. It may fail on virtual machines and for debug builds.
Continue to run in these environments to get code coverage. But optionally suppress failure for timing errors (only). This is controlled with environment variable
KSFT_MACHINE_SLOW.
Quoted 5 lines
The test continues to return 0 (
KSFT_PASS), rather thanKSFT_XFAILas previously discussed. Because makingso_txtime.creturn that and then makingso_txtime.shcapture runs that pass that vsKSFT_FAILand pass it on added a bunch of (fragile bash) boilerplate, while the result is interpreted the same asKSFT_PASSanyway.
FWIW another idea that came up when talking to Matthieu - isolate the VMs which run time-sensitive tests to dedicated CPUs. Right now we kick off around 70 4 CPU VMs and let them battle for 72 cores. The machines don't look overloaded but there can be some latency spikes (CPU use diagram attached).
So the idea would be to have a handful of special VMs running on dedicated CPUs without any CPU time competition. That could help with latency spikes. But we'd probably need to annotate the tests which need some special treatment.
Probably too much work both to annotate tests and set up env, but I thought I'd bring it up here in case you had an opinion.
Quoted 20 lines · Jakub Kicinski
Quoted 7 lines · On Thu, 1 Feb 2024 11:21:19 -0500 Willem de Bruijn wrote:
This test is time sensitive. It may fail on virtual machines and for debug builds.
Continue to run in these environments to get code coverage. But optionally suppress failure for timing errors (only). This is controlled with environment variable
KSFT_MACHINE_SLOW.Quoted 5 lines
The test continues to return 0 (
KSFT_PASS), rather thanKSFT_XFAILas previously discussed. Because makingso_txtime.creturn that and then makingso_txtime.shcapture runs that pass that vsKSFT_FAILand pass it on added a bunch of (fragile bash) boilerplate, while the result is interpreted the same asKSFT_PASSanyway.FWIW another idea that came up when talking to Matthieu - isolate the VMs which run time-sensitive tests to dedicated CPUs. Right now we kick off around 70 4 CPU VMs and let them battle for 72 cores. The machines don't look overloaded but there can be some latency spikes (CPU use diagram attached).
Quoted 7 lines
So the idea would be to have a handful of special VMs running on dedicated CPUs without any CPU time competition. That could help with latency spikes. But we'd probably need to annotate the tests which need some special treatment.
Probably too much work both to annotate tests and set up env, but I thought I'd bring it up here in case you had an opinion.
I'm not sure whether the issue with timing in VMs is CPU affinity. Variance may just come from expensive hypercalls, even with a dedicated CPU. Though tests can tell.
There's still the debug builds, as well.
Paolo Abeni
maintainerQuoted 26 lines · Willem de Bruijn
Quoted 25 lines · Jakub Kicinski
Quoted 7 lines · On Thu, 1 Feb 2024 11:21:19 -0500 Willem de Bruijn wrote:
This test is time sensitive. It may fail on virtual machines and for debug builds.
Continue to run in these environments to get code coverage. But optionally suppress failure for timing errors (only). This is controlled with environment variable
KSFT_MACHINE_SLOW.Quoted 5 lines
The test continues to return 0 (
KSFT_PASS), rather thanKSFT_XFAILas previously discussed. Because makingso_txtime.creturn that and then makingso_txtime.shcapture runs that pass that vsKSFT_FAILand pass it on added a bunch of (fragile bash) boilerplate, while the result is interpreted the same asKSFT_PASSanyway.FWIW another idea that came up when talking to Matthieu - isolate the VMs which run time-sensitive tests to dedicated CPUs. Right now we kick off around 70 4 CPU VMs and let them battle for 72 cores. The machines don't look overloaded but there can be some latency spikes (CPU use diagram attached).
So the idea would be to have a handful of special VMs running on dedicated CPUs without any CPU time competition. That could help with latency spikes. But we'd probably need to annotate the tests which need some special treatment.
Quoted 6 lines
Quoted 2 lines
Probably too much work both to annotate tests and set up env, but I thought I'd bring it up here in case you had an opinion.
I'm not sure whether the issue with timing in VMs is CPU affinity. Variance may just come from expensive hypercalls, even with a dedicated CPU. Though tests can tell.
FTR, I think the CPU affinity setup is a bit too complex, and hard to reproduce for 3rd parties willing to investigate eventual future CI failures, I think the current env-variable-based approach would help with reproducibility.
Quoted 1 line
There's still the debug builds, as well.
I understand/hope you are investigating it?
Cheers,
Paolo
Hi Paolo, Willem, Jakub,
Quoted 30 lines · Paolo Abeni
Quoted 29 lines · Willem de Bruijn
Quoted 27 lines · Jakub Kicinski
Quoted 7 lines · On Thu, 1 Feb 2024 11:21:19 -0500 Willem de Bruijn wrote:
This test is time sensitive. It may fail on virtual machines and for debug builds.
Continue to run in these environments to get code coverage. But optionally suppress failure for timing errors (only). This is controlled with environment variable
KSFT_MACHINE_SLOW.Quoted 5 lines
The test continues to return 0 (
KSFT_PASS), rather thanKSFT_XFAILas previously discussed. Because makingso_txtime.creturn that and then makingso_txtime.shcapture runs that pass that vsKSFT_FAILand pass it on added a bunch of (fragile bash) boilerplate, while the result is interpreted the same asKSFT_PASSanyway.FWIW another idea that came up when talking to Matthieu - isolate the VMs which run time-sensitive tests to dedicated CPUs. Right now we kick off around 70 4 CPU VMs and let them battle for 72 cores. The machines don't look overloaded but there can be some latency spikes (CPU use diagram attached).
So the idea would be to have a handful of special VMs running on dedicated CPUs without any CPU time competition. That could help with latency spikes. But we'd probably need to annotate the tests which need some special treatment.
Probably too much work both to annotate tests and set up env, but I thought I'd bring it up here in case you had an opinion.
Quoted 8 lines
Quoted 3 lines
I'm not sure whether the issue with timing in VMs is CPU affinity. Variance may just come from expensive hypercalls, even with a dedicated CPU. Though tests can tell.
FTR, I think the CPU affinity setup is a bit too complex, and hard to reproduce for 3rd parties willing to investigate eventual future CI failures, I think the current env-variable-based approach would help with reproducibility.
I agree with you. Initially, with 70 VMs with 4 CPU cores, I thought it would have taken more CPU resources, especially when KVM is not used.
Looking at the screenshot provided by Jakub, the host doesn't seem overloaded, and the VM isolation is probably enough. Maybe only the first test(s) can be impacted?
At the end, now that the runner without KVM is no longer there, the situation should be improved :)
Quoted 1 line
Quoted 1 line
There's still the debug builds, as well.
For one MPTCP selftest checking the time to transfer some data, we increase the tolerance by looking at kallsyms:
grep -q ' kmemleak_init$\| lockdep_init$\| kasan_init$\|
prove_locking$' /proc/kallsyms
We can also look at KSFT_MACHINE_SLOW if it is the new standard.
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Quoted 10 lines · On Thu, 1 Feb 2024 11:21:19 -0500 you wrote:
From: Willem de Bruijn <[email protected]>
This test is time sensitive. It may fail on virtual machines and for debug builds.
Continue to run in these environments to get code coverage. But optionally suppress failure for timing errors (only). This is controlled with environment variable
KSFT_MACHINE_SLOW.[...]
Here is the summary with links:
- [net-next] selftests/net: ignore timing errors in so_txtime if KSFT_MACHINE_SLOW
https://git.kernel.org/netdev/net-next/c/c41dfb0dfbec
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html