[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230316170149.4106586-1-jolsa@kernel.org>
Date: Thu, 16 Mar 2023 18:01:40 +0100
From: Jiri Olsa <jolsa@...nel.org>
To: Alexei Starovoitov <ast@...nel.org>,
Andrii Nakryiko <andrii@...nel.org>,
Hao Luo <haoluo@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Matthew Wilcox <willy@...radead.org>
Cc: bpf@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-perf-users@...r.kernel.org, Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>,
Stanislav Fomichev <sdf@...gle.com>,
Daniel Borkmann <daniel@...earbox.net>,
Namhyung Kim <namhyung@...il.com>,
Dave Chinner <david@...morbit.com>
Subject: [PATCHv3 bpf-next 0/9] mm/bpf/perf: Store build id in file object
hi,
this patchset adds build id object pointer to struct file object.
We have several use cases for build id to be used in BPF programs
[2][3].
Having build id pointer stored directly in file object allows to get
build id reliably regardless of the execution context as described
in [3].
Previous iteration [1] stored build id pointer into inode, but it
became clear that struct file object is better place, because we read
the build id when the file is mmap-ed and as Dave Chinner said [4]:
> Yes, the problem being that we can cache hundreds of millions of
> inodes in memory, and only a very small subset of them are going to
> have open files associated with them. And an even smaller subset are
> going to be mmapped.
thanks,
jirka
v3 changes:
- moved build id back to file object (discussed in [4])
- drop patch 4, it's not needed [Andrii]
- added ack to patch 7 [Andrii]
- replaced BUILD_ID_SIZE_MAX macro with enum [Andrii]
- few re-formatting fixes [Andrii]
v2 changes:
- store build id under inode [Matthew Wilcox]
- use urandom_read and liburandom_read.so for test [Andrii]
- add libelf-based helper to fetch build ID from elf [Andrii]
- store build id or error we got when reading it [Andrii]
- use full name i_build_id [Andrii]
- several tests fixes [Andrii]
[1] https://lore.kernel.org/bpf/20230228093206.821563-1-jolsa@kernel.org/
[2] https://lore.kernel.org/bpf/CA+khW7juLEcrTOd7iKG3C_WY8L265XKNo0iLzV1fE=o-cyeHcQ@mail.gmail.com/
[3] https://lore.kernel.org/bpf/ZABf26mV0D0LS7r%2F@krava/
[4] https://lore.kernel.org/bpf/20230228220714.GJ2825702@dread.disaster.area/
---
Jiri Olsa (9):
mm: Store build id in file object
perf: Use file object build id in perf_event_mmap_event
bpf: Use file object build id in stackmap
bpf: Switch BUILD_ID_SIZE_MAX to enum
selftests/bpf: Add read_buildid function
selftests/bpf: Add err.h header
selftests/bpf: Replace extract_build_id with read_build_id
selftests/bpf: Add iter_task_vma_buildid test
selftests/bpf: Add file_build_id test
fs/file_table.c | 3 +++
include/linux/buildid.h | 21 ++++++++++++++++++-
include/linux/fs.h | 7 +++++++
kernel/bpf/stackmap.c | 24 +++++++++++++++++++++-
kernel/events/core.c | 43 ++++++++++++++++++++++++++++++++++----
lib/buildid.c | 42 +++++++++++++++++++++++++++++++++++++
mm/Kconfig | 9 ++++++++
mm/mmap.c | 18 ++++++++++++++++
tools/testing/selftests/bpf/Makefile | 7 ++++++-
tools/testing/selftests/bpf/no_build_id.c | 6 ++++++
tools/testing/selftests/bpf/prog_tests/bpf_iter.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/testing/selftests/bpf/prog_tests/file_build_id.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/testing/selftests/bpf/prog_tests/stacktrace_build_id.c | 19 +++++++----------
tools/testing/selftests/bpf/prog_tests/stacktrace_build_id_nmi.c | 17 ++++++---------
tools/testing/selftests/bpf/progs/bpf_iter_task_vma_buildid.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++
tools/testing/selftests/bpf/progs/err.h | 18 ++++++++++++++++
tools/testing/selftests/bpf/progs/file_build_id.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/testing/selftests/bpf/progs/profiler.inc.h | 3 +--
tools/testing/selftests/bpf/test_progs.c | 25 ----------------------
tools/testing/selftests/bpf/test_progs.h | 11 +++++++++-
tools/testing/selftests/bpf/trace_helpers.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/testing/selftests/bpf/trace_helpers.h | 5 +++++
22 files changed, 608 insertions(+), 58 deletions(-)
create mode 100644 tools/testing/selftests/bpf/no_build_id.c
create mode 100644 tools/testing/selftests/bpf/prog_tests/file_build_id.c
create mode 100644 tools/testing/selftests/bpf/progs/bpf_iter_task_vma_buildid.c
create mode 100644 tools/testing/selftests/bpf/progs/err.h
create mode 100644 tools/testing/selftests/bpf/progs/file_build_id.c
Powered by blists - more mailing lists