From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
andrii@kernel.org
Cc: netdev@vger.kernel.org, magnus.karlsson@intel.com,
bjorn@kernel.org,
Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Subject: [PATCH v5 bpf-next 5/6] selftests: xsk: make sure single threaded test terminates
Date: Tue, 30 Aug 2022 15:56:03 +0200 [thread overview]
Message-ID: <20220830135604.10173-6-maciej.fijalkowski@intel.com> (raw)
In-Reply-To: <20220830135604.10173-1-maciej.fijalkowski@intel.com>
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>
---
tools/testing/selftests/bpf/xskxceiver.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c
index 4f8a028f5433..8e157c462cd0 100644
--- a/tools/testing/selftests/bpf/xskxceiver.c
+++ b/tools/testing/selftests/bpf/xskxceiver.c
@@ -1345,6 +1345,11 @@ static void testapp_clean_xsk_umem(struct ifobject *ifobj)
munmap(ifobj->umem->buffer, umem_sz);
}
+static void handler(int signum)
+{
+ pthread_exit(NULL);
+}
+
static int testapp_validate_traffic_single_thread(struct test_spec *test, struct ifobject *ifobj,
enum test_type type)
{
@@ -1362,6 +1367,7 @@ static int testapp_validate_traffic_single_thread(struct test_spec *test, struct
test->ifobj_rx->shared_umem = false;
test->ifobj_tx->shared_umem = false;
+ signal(SIGUSR1, handler);
/* Spawn thread */
pthread_create(&t0, NULL, ifobj->func_ptr, test);
@@ -1371,6 +1377,7 @@ static int testapp_validate_traffic_single_thread(struct test_spec *test, struct
if (pthread_barrier_destroy(&barr))
exit_with_error(errno);
+ pthread_kill(t0, SIGUSR1);
pthread_join(t0, NULL);
if (test->total_steps == test->current_step || test->fail) {
--
2.34.1
next prev parent reply other threads:[~2022-08-30 13:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-30 13:55 [PATCH v5 bpf-next 0/6] selftests: xsk: real device testing support Maciej Fijalkowski
2022-08-30 13:55 ` [PATCH v5 bpf-next 1/6] selftests: xsk: query for native XDP support Maciej Fijalkowski
2022-08-30 13:56 ` [PATCH v5 bpf-next 2/6] selftests: xsk: introduce default Rx pkt stream Maciej Fijalkowski
2022-08-30 13:56 ` [PATCH v5 bpf-next 3/6] selftests: xsk: increase chars for interface name Maciej Fijalkowski
2022-08-31 8:55 ` Magnus Karlsson
2022-08-30 13:56 ` [PATCH v5 bpf-next 4/6] selftests: xsk: add support for executing tests on physical device Maciej Fijalkowski
2022-08-30 13:56 ` Maciej Fijalkowski [this message]
2022-08-31 8:55 ` [PATCH v5 bpf-next 5/6] selftests: xsk: make sure single threaded test terminates Magnus Karlsson
2022-08-30 13:56 ` [PATCH v5 bpf-next 6/6] selftests: xsk: add support for zero copy testing Maciej Fijalkowski
2022-08-31 20:59 ` [PATCH v5 bpf-next 0/6] selftests: xsk: real device testing support Daniel Borkmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220830135604.10173-6-maciej.fijalkowski@intel.com \
--to=maciej.fijalkowski@intel.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox