lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJ8uoz2=OgOvh3xj5mGizMU9jbmzQEzdF_-ftn+Tync4-9W1_w@mail.gmail.com>
Date:   Wed, 31 Aug 2022 10:55:40 +0200
From:   Magnus Karlsson <magnus.karlsson@...il.com>
To:     Maciej Fijalkowski <maciej.fijalkowski@...el.com>
Cc:     bpf@...r.kernel.org, ast@...nel.org, daniel@...earbox.net,
        andrii@...nel.org, netdev@...r.kernel.org,
        magnus.karlsson@...el.com, bjorn@...nel.org
Subject: Re: [PATCH v5 bpf-next 5/6] selftests: xsk: make sure single threaded
 test terminates

On Tue, Aug 30, 2022 at 4:14 PM Maciej Fijalkowski
<maciej.fijalkowski@...el.com> wrote:
>
> 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.

Acked-by: Magnus Karlsson <magnus.karlsson@...el.com>

> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@...el.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
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ