Re: [PATCH 2/2] selftest/bpf: Test returning zero from a perf bpf program suppresses SIGIO.

From: Jiri Olsa
Date: Tue Dec 05 2023 - 06:17:49 EST


On Mon, Dec 04, 2023 at 12:14:06PM -0800, Kyle Huey wrote:
> The test sets a hardware breakpoint and uses a bpf program to suppress the
> I/O availability signal if the ip matches the expected value.
>
> Signed-off-by: Kyle Huey <khuey@xxxxxxxxxxxx>
> ---
> .../selftests/bpf/prog_tests/perf_skip.c | 95 +++++++++++++++++++
> .../selftests/bpf/progs/test_perf_skip.c | 23 +++++
> 2 files changed, 118 insertions(+)
> create mode 100644 tools/testing/selftests/bpf/prog_tests/perf_skip.c
> create mode 100644 tools/testing/selftests/bpf/progs/test_perf_skip.c
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/perf_skip.c b/tools/testing/selftests/bpf/prog_tests/perf_skip.c
> new file mode 100644
> index 000000000000..b269a31669b7
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/perf_skip.c
> @@ -0,0 +1,95 @@
> +// SPDX-License-Identifier: GPL-2.0
> +#define _GNU_SOURCE
> +#include <test_progs.h>
> +#include "test_perf_skip.skel.h"
> +#include <linux/hw_breakpoint.h>
> +#include <sys/mman.h>
> +
> +#define BPF_OBJECT "test_perf_skip.bpf.o"
> +
> +static void handle_sig(int)
> +{
> + ASSERT_OK(1, "perf event not skipped");
> +}
> +
> +static noinline int test_function(void)
> +{
> + return 0;
> +}
> +
> +void serial_test_perf_skip(void)

does it need to be serial?

jirka