diff mbox series

[net-next] selftests/net: ignore timing errors in so_txtime if KSFT_MACHINE_SLOW

Message ID 20240201162130.2278240-1-willemdebruijn.kernel@gmail.com
State New
Headers show
Series [net-next] selftests/net: ignore timing errors in so_txtime if KSFT_MACHINE_SLOW | expand

Commit Message

Willem de Bruijn Feb. 1, 2024, 4:21 p.m. UTC
From: Willem de Bruijn <willemb@google.com>

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.

Signed-off-by: Willem de Bruijn <willemb@google.com>
---
 tools/testing/selftests/net/so_txtime.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Jakub Kicinski Feb. 2, 2024, 11:39 p.m. UTC | #1
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.
> 
> 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.

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.
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/so_txtime.c b/tools/testing/selftests/net/so_txtime.c
index 2672ac0b6d1f..8457b7ccbc09 100644
--- a/tools/testing/selftests/net/so_txtime.c
+++ b/tools/testing/selftests/net/so_txtime.c
@@ -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)