All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v9 bpf-next 0/3] bpf: sharing bpf runtime stats with
@ 2020-04-30  7:15 Song Liu
  2020-04-30  7:15 ` [PATCH v9 bpf-next 1/3] bpf: sharing bpf runtime stats with BPF_ENABLE_STATS Song Liu
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Song Liu @ 2020-04-30  7:15 UTC (permalink / raw)
  To: bpf, netdev; +Cc: ast, daniel, kernel-team, Song Liu

run_time_ns is a useful stats for BPF programs. However, it is gated by
sysctl kernel.bpf_stats_enabled. When multiple user space tools are
toggling kernl.bpf_stats_enabled at the same time, they may confuse each
other.

Solve this problem with a new BPF command BPF_ENABLE_STATS.

Changes v8 => v9:
  1. Clean up in selftest (Andrii).
  2. Not using static variable in test program (Andrii).

Changes v7 => v8:
  1. Change name BPF_STATS_RUNTIME_CNT => BPF_STATS_RUN_TIME (Alexei).
  2. Add CHECK_ATTR to bpf_enable_stats() (Alexei).
  3. Rebase (Andrii).
  4. Simplfy the selftest (Alexei).

Changes v6 => v7:
  1. Add test to verify run_cnt matches count measured by the program.

Changes v5 => v6:
  1. Simplify test program (Yonghong).
  2. Rebase (with some conflicts).

Changes v4 => v5:
  1. Use memset to zero bpf_attr in bpf_enable_stats() (Andrii).

Changes v3 => v4:
  1. Add libbpf support and selftest;
  2. Avoid cleaning trailing space.

Changes v2 => v3:
  1. Rename the command to BPF_ENABLE_STATS, and make it extendible.
  2. fix commit log;
  3. remove unnecessary headers.

Song Liu (3):
  bpf: sharing bpf runtime stats with BPF_ENABLE_STATS
  libbpf: add support for command BPF_ENABLE_STATS
  bpf: add selftest for BPF_ENABLE_STATS

 include/linux/bpf.h                           |  1 +
 include/uapi/linux/bpf.h                      | 11 ++++
 kernel/bpf/syscall.c                          | 57 +++++++++++++++++++
 kernel/sysctl.c                               | 36 +++++++++++-
 tools/include/uapi/linux/bpf.h                | 11 ++++
 tools/lib/bpf/bpf.c                           | 10 ++++
 tools/lib/bpf/bpf.h                           |  1 +
 tools/lib/bpf/libbpf.map                      |  1 +
 .../selftests/bpf/prog_tests/enable_stats.c   | 45 +++++++++++++++
 .../selftests/bpf/progs/test_enable_stats.c   | 18 ++++++
 10 files changed, 190 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/enable_stats.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_enable_stats.c

--
2.24.1

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-06-21  3:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30  7:15 [PATCH v9 bpf-next 0/3] bpf: sharing bpf runtime stats with Song Liu
2020-04-30  7:15 ` [PATCH v9 bpf-next 1/3] bpf: sharing bpf runtime stats with BPF_ENABLE_STATS Song Liu
2020-04-30  7:15 ` [PATCH v9 bpf-next 2/3] libbpf: add support for command BPF_ENABLE_STATS Song Liu
2020-05-02 20:00   ` Alexei Starovoitov
2020-05-04 17:45     ` Song Liu
2020-05-04 18:32       ` Andrii Nakryiko
2020-05-10  1:03       ` Alexei Starovoitov
2020-06-21  3:07       ` Andrii Nakryiko
2020-04-30  7:15 ` [PATCH v9 bpf-next 3/3] bpf: add selftest for BPF_ENABLE_STATS Song Liu
2020-04-30 18:16   ` Andrii Nakryiko
2020-05-01 17:56 ` [PATCH v9 bpf-next 0/3] bpf: sharing bpf runtime stats with Alexei Starovoitov

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.