Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/xsk: Make sure single threaded test terminates

For single threaded poll tests call pthread_kill() from main thread so
that we are sure worker thread has finished its job and it is possible
to proceed with next test types from test suite. It was observed that on
some platforms it takes a bit longer for worker thread to exit and next
test case sees device as busy in this case.

Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Magnus Karlsson <magnus.karlsson@intel.com>
Link: https://lore.kernel.org/bpf/20220901114813.16275-6-maciej.fijalkowski@intel.com

authored by

Maciej Fijalkowski and committed by
Daniel Borkmann
c29fe883 a693ff3e

+7
+7
tools/testing/selftests/bpf/xskxceiver.c
··· 1345 1345 munmap(ifobj->umem->buffer, umem_sz); 1346 1346 } 1347 1347 1348 + static void handler(int signum) 1349 + { 1350 + pthread_exit(NULL); 1351 + } 1352 + 1348 1353 static int testapp_validate_traffic_single_thread(struct test_spec *test, struct ifobject *ifobj, 1349 1354 enum test_type type) 1350 1355 { ··· 1367 1362 test->ifobj_rx->shared_umem = false; 1368 1363 test->ifobj_tx->shared_umem = false; 1369 1364 1365 + signal(SIGUSR1, handler); 1370 1366 /* Spawn thread */ 1371 1367 pthread_create(&t0, NULL, ifobj->func_ptr, test); 1372 1368 ··· 1377 1371 if (pthread_barrier_destroy(&barr)) 1378 1372 exit_with_error(errno); 1379 1373 1374 + pthread_kill(t0, SIGUSR1); 1380 1375 pthread_join(t0, NULL); 1381 1376 1382 1377 if (test->total_steps == test->current_step || test->fail) {