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: <CAJ8uoz1Eo2Lsh0Gu4HED4cr7Ocqsd7=OjAf7wOrnvQ_tMa4Jgw@mail.gmail.com>
Date:   Thu, 30 Jun 2022 11:57:00 +0200
From:   Magnus Karlsson <magnus.karlsson@...il.com>
To:     Maciej Fijalkowski <maciej.fijalkowski@...el.com>
Cc:     bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Network Development <netdev@...r.kernel.org>,
        "Karlsson, Magnus" <magnus.karlsson@...el.com>
Subject: Re: [PATCH bpf-next 1/4] selftests: xsk: avoid bpf_link probe for
 existing xsk

On Wed, Jun 29, 2022 at 4:38 PM Maciej Fijalkowski
<maciej.fijalkowski@...el.com> wrote:
>
> Currently bpf_link probe is done for each call of xsk_socket__create().
> For cases where xsk context was previously created and current socket
> creation uses it, has_bpf_link will be overwritten, where it has already
> been initialized.
>
> Optimize this by moving the query to the xsk_create_ctx() so that when
> xsk_get_ctx() finds a ctx then no further bpf_link probes are needed.

This would be a good optimization to libxdp too.

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

> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
> ---
>  tools/testing/selftests/bpf/xsk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/xsk.c b/tools/testing/selftests/bpf/xsk.c
> index eb50c3f336f8..fa13d2c44517 100644
> --- a/tools/testing/selftests/bpf/xsk.c
> +++ b/tools/testing/selftests/bpf/xsk.c
> @@ -958,6 +958,7 @@ static struct xsk_ctx *xsk_create_ctx(struct xsk_socket *xsk,
>         ctx->fill = fill;
>         ctx->comp = comp;
>         list_add(&ctx->list, &umem->ctx_list);
> +       ctx->has_bpf_link = xsk_probe_bpf_link();
>         return ctx;
>  }
>
> @@ -1059,7 +1060,6 @@ int xsk_socket__create_shared(struct xsk_socket **xsk_ptr,
>                 }
>         }
>         xsk->ctx = ctx;
> -       xsk->ctx->has_bpf_link = xsk_probe_bpf_link();
>
>         if (rx && !rx_setup_done) {
>                 err = setsockopt(xsk->fd, SOL_XDP, XDP_RX_RING,
> --
> 2.27.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ