All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hao Luo <haoluo@google.com>
To: Andrii Nakryiko <andrii@kernel.org>
Cc: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
	kernel-team@fb.com
Subject: Re: [PATCH bpf-next 4/4] selftests/bpf: few fixes for selftests/bpf built in release mode
Date: Tue, 16 Aug 2022 14:34:36 -0700	[thread overview]
Message-ID: <CA+khW7jdztV3XgdVJy7t8jwr8iheTMjQMYnioLBVX3xxBRRKjw@mail.gmail.com> (raw)
In-Reply-To: <20220816001929.369487-5-andrii@kernel.org>

On Mon, Aug 15, 2022 at 8:52 PM Andrii Nakryiko <andrii@kernel.org> wrote:
>
> Fix few issues found when building and running test_progs in release
> mode.
>
> First, potentially uninitialized idx variable in xskxceiver,
> force-initialize to zero to satisfy compiler.
>
> Few instances of defining uprobe trigger functions break in release mode
> unless marked as noinline, due to being static. Add noinline to make
> sure everything works.
>
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
> ---

I can't say for the noinline change, I trust it works. The fix for
uninitialized use looks good to me.

Acked-by: Hao Luo <haoluo@google.com>


>  tools/testing/selftests/bpf/prog_tests/attach_probe.c | 6 +++---
>  tools/testing/selftests/bpf/prog_tests/bpf_cookie.c   | 2 +-
>  tools/testing/selftests/bpf/prog_tests/task_pt_regs.c | 2 +-
>  tools/testing/selftests/bpf/xskxceiver.c              | 2 +-
>  4 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/attach_probe.c b/tools/testing/selftests/bpf/prog_tests/attach_probe.c
> index 0b899d2d8ea7..9566d9d2f6ee 100644
> --- a/tools/testing/selftests/bpf/prog_tests/attach_probe.c
> +++ b/tools/testing/selftests/bpf/prog_tests/attach_probe.c
> @@ -6,19 +6,19 @@
>  volatile unsigned short uprobe_ref_ctr __attribute__((unused)) __attribute((section(".probes")));
>
>  /* uprobe attach point */
> -static void trigger_func(void)
> +static noinline void trigger_func(void)
>  {
>         asm volatile ("");
>  }
>
>  /* attach point for byname uprobe */
> -static void trigger_func2(void)
> +static noinline void trigger_func2(void)
>  {
>         asm volatile ("");
>  }
>
>  /* attach point for byname sleepable uprobe */
> -static void trigger_func3(void)
> +static noinline void trigger_func3(void)
>  {
>         asm volatile ("");
>  }
> diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_cookie.c b/tools/testing/selftests/bpf/prog_tests/bpf_cookie.c
> index 2974b44f80fa..2be2d61954bc 100644
> --- a/tools/testing/selftests/bpf/prog_tests/bpf_cookie.c
> +++ b/tools/testing/selftests/bpf/prog_tests/bpf_cookie.c
> @@ -13,7 +13,7 @@
>  #include "kprobe_multi.skel.h"
>
>  /* uprobe attach point */
> -static void trigger_func(void)
> +static noinline void trigger_func(void)
>  {
>         asm volatile ("");
>  }
> diff --git a/tools/testing/selftests/bpf/prog_tests/task_pt_regs.c b/tools/testing/selftests/bpf/prog_tests/task_pt_regs.c
> index 61935e7e056a..f000734a3d1f 100644
> --- a/tools/testing/selftests/bpf/prog_tests/task_pt_regs.c
> +++ b/tools/testing/selftests/bpf/prog_tests/task_pt_regs.c
> @@ -4,7 +4,7 @@
>  #include "test_task_pt_regs.skel.h"
>
>  /* uprobe attach point */
> -static void trigger_func(void)
> +static noinline void trigger_func(void)
>  {
>         asm volatile ("");
>  }
> diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c
> index 20b44ab32a06..14b4737b223c 100644
> --- a/tools/testing/selftests/bpf/xskxceiver.c
> +++ b/tools/testing/selftests/bpf/xskxceiver.c
> @@ -922,7 +922,7 @@ static int __send_pkts(struct ifobject *ifobject, u32 *pkt_nb, struct pollfd *fd
>  {
>         struct xsk_socket_info *xsk = ifobject->xsk;
>         bool use_poll = ifobject->use_poll;
> -       u32 i, idx, ret, valid_pkts = 0;
> +       u32 i, idx = 0, ret, valid_pkts = 0;
>
>         while (xsk_ring_prod__reserve(&xsk->tx, BATCH_SIZE, &idx) < BATCH_SIZE) {
>                 if (use_poll) {
> --
> 2.30.2
>

  reply	other threads:[~2022-08-16 21:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-16  0:19 [PATCH bpf-next 0/4] Preparatory libbpf fixes and clean ups Andrii Nakryiko
2022-08-16  0:19 ` [PATCH bpf-next 1/4] libbpf: fix potential NULL dereference when parsing ELF Andrii Nakryiko
2022-08-16 21:31   ` Hao Luo
2022-08-16  0:19 ` [PATCH bpf-next 2/4] libbpf: streamline bpf_attr and perf_event_attr initialization Andrii Nakryiko
2022-08-16 21:33   ` Hao Luo
2022-08-16 21:54     ` Andrii Nakryiko
2022-08-16  0:19 ` [PATCH bpf-next 3/4] libbpf: clean up deprecated and legacy aliases Andrii Nakryiko
2022-08-16 21:33   ` Hao Luo
2022-08-16 21:55     ` Andrii Nakryiko
2022-08-16  0:19 ` [PATCH bpf-next 4/4] selftests/bpf: few fixes for selftests/bpf built in release mode Andrii Nakryiko
2022-08-16 21:34   ` Hao Luo [this message]
2022-08-16 21:58     ` Andrii Nakryiko
2022-08-17 21:00 ` [PATCH bpf-next 0/4] Preparatory libbpf fixes and clean ups patchwork-bot+netdevbpf

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=CA+khW7jdztV3XgdVJy7t8jwr8iheTMjQMYnioLBVX3xxBRRKjw@mail.gmail.com \
    --to=haoluo@google.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.