Re: [RFC bpf-next 0/1] bpf: Add page cache iterator

2021-04-08 Thread Daniel Xu
On Thu, Apr 08, 2021 at 04:13:32PM -0700, Darrick J. Wong wrote: > On Wed, Apr 07, 2021 at 02:46:10PM -0700, Daniel Xu wrote: > > There currently does not exist a way to answer the question: "What is in > > the page cache?". There are various heuristics and counters but

Re: [RFC bpf-next 1/1] bpf: Introduce iter_pagecache

2021-04-08 Thread Daniel Xu
On Thu, Apr 08, 2021 at 04:45:37PM +, Al Viro wrote: > On Wed, Apr 07, 2021 at 02:46:11PM -0700, Daniel Xu wrote: > > > +static void fini_seq_pagecache(void *priv_data) > > +{ > > + struct bpf_iter_seq_pagecache_info *info = priv_data; > > + struct radix_

Re: [RFC bpf-next 1/1] bpf: Introduce iter_pagecache

2021-04-08 Thread Daniel Xu
On Thu, Apr 08, 2021 at 10:19:35AM +0200, Christian Brauner wrote: > On Wed, Apr 07, 2021 at 02:46:11PM -0700, Daniel Xu wrote: > > This commit introduces the bpf page cache iterator. This iterator allows > > users to run a bpf prog against each page in the "page cache".

Re: [RFC bpf-next 1/1] bpf: Introduce iter_pagecache

2021-04-08 Thread Daniel Xu
On Thu, Apr 08, 2021 at 07:14:01AM +0100, Matthew Wilcox wrote: > On Wed, Apr 07, 2021 at 02:46:11PM -0700, Daniel Xu wrote: > > +struct bpf_iter_seq_pagecache_info { > > + struct mnt_namespace *ns; > > + struct radix_tree_root superblocks; > > Why are you ad

Re: [RFC bpf-next 0/1] bpf: Add page cache iterator

2021-04-08 Thread Daniel Xu
Hi Christian, thanks for taking a look. On Thu, Apr 08, 2021 at 09:51:17AM +0200, Christian Brauner wrote: > On Wed, Apr 07, 2021 at 02:46:10PM -0700, Daniel Xu wrote: > > There currently does not exist a way to answer the question: "What is in > > the page cache?". The

[RFC bpf-next 1/1] bpf: Introduce iter_pagecache

2021-04-07 Thread Daniel Xu
n the caller's mount namespace. Signed-off-by: Daniel Xu --- kernel/bpf/Makefile | 2 +- kernel/bpf/pagecache_iter.c | 293 2 files changed, 294 insertions(+), 1 deletion(-) create mode 100644 kernel/bpf/pagecache_iter.c diff --git a/kernel/bpf/M

[RFC bpf-next 0/1] bpf: Add page cache iterator

2021-04-07 Thread Daniel Xu
ace can more easily tell which pages are duplicate Daniel Xu (1): bpf: Introduce iter_pagecache kernel/bpf/Makefile | 2 +- kernel/bpf/pagecache_iter.c | 293 2 files changed, 294 insertions(+), 1 deletion(-) create mode 100644 kernel/b

Re: [PATCH -tip v2 00/10] kprobes: Fix stacktrace with kretprobes

2021-03-12 Thread Daniel Xu
ntroduced to the series. > > Daniel, can you also test this again? I and Josh discussed a bit different > method and I've implemented it on this version. Works great, thanks! Tested-by: Daniel Xu > > This actually changes the kretprobe behavisor a bit, now the instraction

Re: [PATCH -tip 0/5] kprobes: Fix stacktrace in kretprobes

2021-03-10 Thread Daniel Xu
n-graph > tracer in the unwind_next_frame(). > > Signed-off-by: Masami Hiramatsu > I applied your original patchset + Josh's patch + this patch and can confirm it works for bpftrace + kretprobes. Tested-by: Daniel Xu

Re: [PATCH -tip 0/5] kprobes: Fix stacktrace in kretprobes

2021-03-09 Thread Daniel Xu
Hi Masami, Just want to clarify a few points: On Mon, Mar 08, 2021 at 11:52:10AM +0900, Masami Hiramatsu wrote: > On Sun, 7 Mar 2021 13:23:33 -0800 > Daniel Xu wrote: > To help your understanding, let me explain. > > If we have a code here > > caller_func: > 0x00

Re: [PATCH -tip 0/5] kprobes: Fix stacktrace in kretprobes

2021-03-07 Thread Daniel Xu
On Sat, Mar 06, 2021 at 10:13:57AM +0900, Masami Hiramatsu wrote: > On Fri, 5 Mar 2021 11:16:45 -0800 > Daniel Xu wrote: > > > Hi Masami, > > > > On Sat, Mar 06, 2021 at 12:38:57AM +0900, Masami Hiramatsu wrote: > > > Hello, > > > > > > H

Re: [PATCH] x86: kprobes: orc: Fix ORC walks in kretprobes

2021-03-05 Thread Daniel Xu
On Fri, Mar 05, 2021 at 01:32:44PM -0600, Josh Poimboeuf wrote: > On Fri, Mar 05, 2021 at 11:25:15AM -0800, Daniel Xu wrote: > > > BTW, is this a regression? or CONFIG_UNWINDER_ORC has this issue before? > > > It seems that the above commit just changed the default unwind

Re: [PATCH] x86: kprobes: orc: Fix ORC walks in kretprobes

2021-03-05 Thread Daniel Xu
On Fri, Mar 05, 2021 at 07:58:09PM +0900, Masami Hiramatsu wrote: > On Fri, 5 Mar 2021 18:28:06 +0900 > Masami Hiramatsu wrote: > > > Hi Daniel, > > > > On Thu, 4 Mar 2021 16:07:52 -0800 > > Daniel Xu wrote: > > > > > Getting a stack trace

Re: [PATCH -tip 0/5] kprobes: Fix stacktrace in kretprobes

2021-03-05 Thread Daniel Xu
Hi Masami, On Sat, Mar 06, 2021 at 12:38:57AM +0900, Masami Hiramatsu wrote: > Hello, > > Here is a series of patches for kprobes and stacktracer to fix the kretprobe > entries in the kernel stack. This was reported by Daniel Xu. I thought that > was in the bpftrace, but it i

[PATCH] x86: kprobes: orc: Fix ORC walks in kretprobes

2021-03-04 Thread Daniel Xu
call_64+51 entry_SYSCALL_64_after_hwframe+68 ]: 12 Fixes: fc72ae40e303 ("x86/unwind: Make CONFIG_UNWINDER_ORC=y the default in kconfig for 64-bit") Signed-off-by: Daniel Xu --- arch/x86/kernel/unwind_orc.c | 53 +++- kernel/kprobes.c

Re: Broken kretprobe stack traces

2021-03-04 Thread Daniel Xu
On Wed, Mar 3, 2021, at 6:18 PM, Daniel Xu wrote: > On Wed, Mar 03, 2021 at 03:37:40PM -0500, Steven Rostedt wrote: > > On Wed, 03 Mar 2021 12:13:08 -0800 > > "Daniel Xu" wrote: > > > > > On Wed, Mar 3, 2021, at 11:58 AM, Daniel Xu wrote: > > > &

Re: Broken kretprobe stack traces

2021-03-03 Thread Daniel Xu
On Wed, Mar 03, 2021 at 03:37:40PM -0500, Steven Rostedt wrote: > On Wed, 03 Mar 2021 12:13:08 -0800 > "Daniel Xu" wrote: > > > On Wed, Mar 3, 2021, at 11:58 AM, Daniel Xu wrote: > > > On Wed, Mar 03, 2021 at 09:26:04AM -0500, Steven Rostedt wrote: > &g

Re: Broken kretprobe stack traces

2021-03-03 Thread Daniel Xu
On Wed, Mar 03, 2021 at 01:48:28PM +0900, Masami Hiramatsu wrote: > Hi Daniel, > > On Tue, 02 Mar 2021 17:15:13 -0800 > "Daniel Xu" wrote: > > > Hi Masami, > > > > Jakub reported a bug with kretprobe stack traces -- wondering if you've > > g

Re: Broken kretprobe stack traces

2021-03-03 Thread Daniel Xu
On Wed, Mar 03, 2021 at 09:26:04AM -0500, Steven Rostedt wrote: > On Wed, 3 Mar 2021 13:48:28 +0900 > Masami Hiramatsu wrote: > > > > > > > > > I think (can't prove) this used to work: > > Would be good to find out if it did. I'm installing some older kernels now to check. Will report

Re: Broken kretprobe stack traces

2021-03-03 Thread Daniel Xu
On Wed, Mar 3, 2021, at 11:58 AM, Daniel Xu wrote: > On Wed, Mar 03, 2021 at 09:26:04AM -0500, Steven Rostedt wrote: > > On Wed, 3 Mar 2021 13:48:28 +0900 > > Masami Hiramatsu wrote: > > > > > > > > > > > > > I think (can't prove) t

Re: Why do kprobes and uprobes singlestep?

2021-03-03 Thread Daniel Xu
On Tue, Mar 02, 2021 at 06:18:23PM -0800, Alexei Starovoitov wrote: > On Tue, Mar 2, 2021 at 5:46 PM Andy Lutomirski wrote: > > > > > > > On Mar 2, 2021, at 5:22 PM, Alexei Starovoitov > > > wrote: > > > > > > On Tue, Mar 2, 2021 at 1:02 PM Andy Lutomirski > > > wrote: > > >> > > >> > >

Broken kretprobe stack traces

2021-03-03 Thread Daniel Xu
Hi Masami, Jakub reported a bug with kretprobe stack traces -- wondering if you've gotten any bug reports related to stack traces being broken for kretprobes. I think (can't prove) this used to work: # bpftrace -e 'kretprobe:__tcp_retransmit_skb { @[kstack()] = count() }' Attaching 1

[PATCH bpf v7 2/2] selftest/bpf: Test bpf_probe_read_user_str() strips trailing bytes after NUL

2020-11-17 Thread Daniel Xu
bpf_probe_read_user_str() again. Acked-by: Song Liu Acked-by: Andrii Nakryiko Signed-off-by: Daniel Xu --- .../bpf/prog_tests/probe_read_user_str.c | 71 +++ .../bpf/progs/test_probe_read_user_str.c | 25 +++ 2 files changed, 96 insertions(+) create mode 100644 tools/testing/selftests

[PATCH bpf v7 1/2] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-17 Thread Daniel Xu
ernel} and probe_read_{user, kernel}_str helpers") Signed-off-by: Daniel Xu --- As mentioned in the v6 discussion, I didn't think it would make a lot of sense to put a comment in kernel/bpf/hashtab.c:alloc_htab_elem . I opted to add the comment to bpf_probe_read_user_str_common() b/c it

[PATCH bpf v7 0/2] Fix bpf_probe_read_user_str() overcopying

2020-11-17 Thread Daniel Xu
tialized memory v3 -> v4: * directly pass userspace pointer to prog * test more strings of different length v2 -> v3: * set pid filter before attaching prog in selftest * use long instead of int as bpf_probe_read_user_str() retval * style changes v1 -> v2: * add Fixes: tag * add se

Re: [PATCH bpf v6 1/2] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-16 Thread Daniel Xu
Hi Linus, On Mon, Nov 16, 2020 at 02:15:52PM -0800, Linus Torvalds wrote: > On Mon, Nov 16, 2020 at 1:17 PM Daniel Xu wrote: > > > > Based on on-list discussion and some off-list discussion with Alexei, > > I'd like to propose the v4-style patch without the `(*out & ~mas

[PATCH bpf v6 1/2] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-16 Thread Daniel Xu
ernel} and probe_read_{user, kernel}_str helpers") Signed-off-by: Daniel Xu --- Based on on-list discussion and some off-list discussion with Alexei, I'd like to propose the v4-style patch without the `(*out & ~mask)` bit. We can't really zero out the rest of the buffer due to ABI issues

[PATCH bpf v6 0/2] Fix bpf_probe_read_user_str() overcopying

2020-11-16 Thread Daniel Xu
v4: * directly pass userspace pointer to prog * test more strings of different length v2 -> v3: * set pid filter before attaching prog in selftest * use long instead of int as bpf_probe_read_user_str() retval * style changes v1 -> v2: * add Fixes: tag * add selftest Daniel Xu (2): lib/strncpy_fr

[PATCH bpf v6 2/2] selftest/bpf: Test bpf_probe_read_user_str() strips trailing bytes after NUL

2020-11-16 Thread Daniel Xu
bpf_probe_read_user_str() again. Acked-by: Song Liu Acked-by: Andrii Nakryiko Signed-off-by: Daniel Xu --- .../bpf/prog_tests/probe_read_user_str.c | 71 +++ .../bpf/progs/test_probe_read_user_str.c | 25 +++ 2 files changed, 96 insertions(+) create mode 100644 tools/testing/selftests

Re: [PATCH bpf v5 0/2] Fix bpf_probe_read_user_str() overcopying

2020-11-12 Thread Daniel Xu
On Wed Nov 11, 2020 at 3:22 PM PST, Andrii Nakryiko wrote: > On Wed, Nov 11, 2020 at 2:46 PM Daniel Xu wrote: > > > > 6ae08ae3dea2 ("bpf: Add probe_read_{user, kernel} and probe_read_{user, > > kernel}_str helpers") introduced a subtle bug where > > bpf_pr

[PATCH bpf v5 1/2] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-11 Thread Daniel Xu
{user, kernel} and probe_read_{user, kernel}_str helpers") Signed-off-by: Daniel Xu --- lib/strncpy_from_user.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c index e6d5fcc2cdf3..83180742e729 100644

Re: [selftest/bpf] b83590ee1a: BUG:KASAN:slab-out-of-bounds_in_l

2020-11-11 Thread Daniel Xu
bae607b0524632b7793 ("[PATCH bpf v3 2/2] > > selftest/bpf: Test bpf_probe_read_user_str() strips trailing bytes after > > NUL") > > url: > > https://github.com/0day-ci/linux/commits/Daniel-Xu/Fix-bpf_probe_read_user_str-overcopying/20201106-033210 > > base: https

[PATCH bpf v5 0/2] Fix bpf_probe_read_user_str() overcopying

2020-11-11 Thread Daniel Xu
different length v2 -> v3: * set pid filter before attaching prog in selftest * use long instead of int as bpf_probe_read_user_str() retval * style changes v1 -> v2: * add Fixes: tag * add selftest Daniel Xu (2): lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminato

[PATCH bpf v5 2/2] selftest/bpf: Test bpf_probe_read_user_str() strips trailing bytes after NUL

2020-11-11 Thread Daniel Xu
bpf_probe_read_user_str() again. Acked-by: Song Liu Acked-by: Andrii Nakryiko Signed-off-by: Daniel Xu --- .../bpf/prog_tests/probe_read_user_str.c | 71 +++ .../bpf/progs/test_probe_read_user_str.c | 25 +++ 2 files changed, 96 insertions(+) create mode 100644 tools/testing/selftests

Re: [lib/strncpy_from_user.c] 00a4ef91e8: BUG:KASAN:slab-out-of-bounds_in_s

2020-11-06 Thread Daniel Xu
om_user.c: Don't overcopy bytes after NUL terminator") > > url: > > https://github.com/0day-ci/linux/commits/Daniel-Xu/lib-strncpy_from_user-c-Don-t-overcopy-bytes-after-NUL-terminator/20201104-103306 > > base: https://git.kernel.org/cgit/linux/kernel/git/bpf/bpf-next.git master [

[PATCH bpf v4 1/2] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-05 Thread Daniel Xu
ernel} and probe_read_{user, kernel}_str helpers") Signed-off-by: Daniel Xu --- lib/strncpy_from_user.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c index e6d5fcc2cdf3..82a67dde136b 100644 --- a/lib/strncpy_f

[PATCH bpf v4 0/2] Fix bpf_probe_read_user_str() overcopying

2020-11-05 Thread Daniel Xu
e attaching prog in selftest * use long instead of int as bpf_probe_read_user_str() retval * style changes v1 -> v2: * add Fixes: tag * add selftest Daniel Xu (2): lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator selftest/bpf: Test bpf_probe_read_user_str() strips trailing bytes

[PATCH bpf v4 2/2] selftest/bpf: Test bpf_probe_read_user_str() strips trailing bytes after NUL

2020-11-05 Thread Daniel Xu
bpf_probe_read_user_str() again. Signed-off-by: Daniel Xu --- .../bpf/prog_tests/probe_read_user_str.c | 71 +++ .../bpf/progs/test_probe_read_user_str.c | 25 +++ 2 files changed, 96 insertions(+) create mode 100644 tools/testing/selftests/bpf/prog_tests/probe_read_user_str.c create

Re: [PATCH bpf v2 2/2] selftest/bpf: Test bpf_probe_read_user_str() strips trailing bytes after NUL

2020-11-05 Thread Daniel Xu
On Thu Nov 5, 2020 at 3:31 PM PST, Song Liu wrote: > > > > On Nov 5, 2020, at 3:22 PM, Daniel Xu wrote: > > > > On Thu Nov 5, 2020 at 1:32 PM PST, Andrii Nakryiko wrote: > >> On Wed, Nov 4, 2020 at 8:51 PM Daniel Xu wrote: > > [...] > >>

Re: [PATCH bpf v2 2/2] selftest/bpf: Test bpf_probe_read_user_str() strips trailing bytes after NUL

2020-11-05 Thread Daniel Xu
On Thu Nov 5, 2020 at 1:32 PM PST, Andrii Nakryiko wrote: > On Wed, Nov 4, 2020 at 8:51 PM Daniel Xu wrote: [...] > > diff --git a/tools/testing/selftests/bpf/progs/test_probe_read_user_str.c > > b/tools/testing/selftests/bpf/progs/test_probe_read_user_str.c > > new file

[PATCH bpf v3 0/2] Fix bpf_probe_read_user_str() overcopying

2020-11-05 Thread Daniel Xu
ges v1 -> v2: * add Fixes: tag * add selftest Daniel Xu (2): lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator selftest/bpf: Test bpf_probe_read_user_str() strips trailing bytes after NUL lib/strncpy_from_user.c | 9 ++- .../bpf/prog_tests/probe

[PATCH bpf v3 1/2] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-05 Thread Daniel Xu
ernel} and probe_read_{user, kernel}_str helpers") Signed-off-by: Daniel Xu --- lib/strncpy_from_user.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c index e6d5fcc2cdf3..82a67dde136b 100644 --- a/lib/strncpy_f

[PATCH bpf v3 2/2] selftest/bpf: Test bpf_probe_read_user_str() strips trailing bytes after NUL

2020-11-05 Thread Daniel Xu
bpf_probe_read_user_str() again. Signed-off-by: Daniel Xu --- .../bpf/prog_tests/probe_read_user_str.c | 60 +++ .../bpf/progs/test_probe_read_user_str.c | 34 +++ 2 files changed, 94 insertions(+) create mode 100644 tools/testing/selftests/bpf/prog_tests/probe_read_user_str.c

Re: [PATCH bpf v2 2/2] selftest/bpf: Test bpf_probe_read_user_str() strips trailing bytes after NUL

2020-11-05 Thread Daniel Xu
On Thu Nov 5, 2020 at 10:30 AM PST, Song Liu wrote: > > > > On Nov 4, 2020, at 6:25 PM, Daniel Xu wrote: > > > > Previously, bpf_probe_read_user_str() could potentially overcopy the > > trailing bytes after the NUL due to how do_strncpy_from_user() does the

Re: [PATCH bpf v2 1/2] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-05 Thread Daniel Xu
On Thu Nov 5, 2020 at 10:16 AM PST, Song Liu wrote: > > > > On Nov 4, 2020, at 6:25 PM, Daniel Xu wrote: > > > > do_strncpy_from_user() may copy some extra bytes after the NUL > > We have multiple use of "NUL" here, should be "NULL"? > >

[PATCH bpf v2 1/2] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-04 Thread Daniel Xu
ernel} and probe_read_{user, kernel}_str helpers") Signed-off-by: Daniel Xu --- lib/strncpy_from_user.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c index e6d5fcc2cdf3..d084189eb05c 100644 --- a/lib/strncpy_f

[PATCH bpf v2 2/2] selftest/bpf: Test bpf_probe_read_user_str() strips trailing bytes after NUL

2020-11-04 Thread Daniel Xu
bpf_probe_read_user_str() again. Signed-off-by: Daniel Xu --- .../bpf/prog_tests/probe_read_user_str.c | 60 +++ .../bpf/progs/test_probe_read_user_str.c | 34 +++ 2 files changed, 94 insertions(+) create mode 100644 tools/testing/selftests/bpf/prog_tests/probe_read_user_str.c

[PATCH bpf v2 0/2] Fix bpf_probe_read_user_str() overcopying

2020-11-04 Thread Daniel Xu
s map keys, as seemingly identical strings can occupy multiple entries in a map. This patchset fixes the issue and introduces a selftest to prevent future regressions. Daniel Xu (2): lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator selftest/bpf: Test bpf_probe_read_user_str() strip

Re: [PATCH bpf-next] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-04 Thread Daniel Xu
On Wed Nov 4, 2020 at 2:36 PM PST, Daniel Borkmann wrote: > On 11/4/20 9:18 PM, Daniel Xu wrote: > > On Wed Nov 4, 2020 at 8:24 AM PST, Daniel Borkmann wrote: > >> On 11/4/20 3:29 AM, Daniel Xu wrote: > >>> do_strncpy_from_user() may copy some extra bytes

Re: [PATCH bpf-next] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-04 Thread Daniel Xu
Hi Daniel, On Wed Nov 4, 2020 at 8:24 AM PST, Daniel Borkmann wrote: > On 11/4/20 3:29 AM, Daniel Xu wrote: > > do_strncpy_from_user() may copy some extra bytes after the NUL > > terminator into the destination buffer. This usually does not matter for > > normal string oper

[PATCH bpf-next] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-03 Thread Daniel Xu
bytes after the NUL terminator, it can result in seemingly identical strings occupying multiple slots in a BPF map. This behavior is subtle and totally unexpected by the user. This commit uses the proper word-at-a-time APIs to avoid overcopying. Signed-off-by: Daniel Xu --- lib/strncpy_from_user.c

Re: [PATCH bpf-next] libbpf: Export bpf_object__load_vmlinux_btf

2020-05-27 Thread Daniel Xu
Hi Andrii, On Tue May 26, 2020 at 3:09 PM PST, Andrii Nakryiko wrote: > On Tue, May 26, 2020 at 7:09 PM Daniel Xu wrote: > > > > Right now the libbpf model encourages loading the entire object at once. > > In this model, libbpf handles loading BTF from vmlinux for us

[PATCH bpf-next] libbpf: Export bpf_object__load_vmlinux_btf

2020-05-26 Thread Daniel Xu
, there was perviously no way to load BTF on-demand. This commit exports the bpf_object__load_vmlinux_btf such that we are able to load BTF on demand. Signed-off-by: Daniel Xu --- tools/lib/bpf/libbpf.c | 2 +- tools/lib/bpf/libbpf.h | 1 + tools/lib/bpf/libbpf.map | 1 + 3 files changed, 3 insertions(+), 1

Re: [PATCH bpf-next 1/5] perf/core: Add PERF_FORMAT_LOST read_format

2019-09-27 Thread Daniel Xu
Hi Jiri, On Tue Sep 24, 2019 at 10:33 AM Jiri Olsa wrote: > On Tue, Sep 17, 2019 at 06:30:52AM -0700, Daniel Xu wrote: > > SNIP > > > + PERF_FORMAT_MAX = 1U << 5, /* non-ABI */ > > }; > > > > #define PERF_ATTR_SIZE_VER064

Re: [PATCH bpf-next 1/5] perf/core: Add PERF_FORMAT_LOST read_format

2019-09-17 Thread Daniel Xu
On Tue Sep 17, 2019 at 10:32 PM kbuild test robot wrote: > All errors (new ones prefixed by >>): > >kernel/events/core.c: In function 'perf_event_lost': > >> kernel/events/core.c:4753:11: error: implicit declaration of function > >> 'perf_kprobe_missed'; did you mean 'perf_release'? > >>

[PATCH bpf-next 2/5] perf/core: Sync perf_event.h to tools

2019-09-17 Thread Daniel Xu
Signed-off-by: Daniel Xu --- tools/include/uapi/linux/perf_event.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/include/uapi/linux/perf_event.h b/tools/include/uapi/linux/perf_event.h index 7198ddd0c6b1..bd874c7257f0 100644 --- a/tools/include/uapi/linux

[PATCH bpf-next 4/5] libbpf: Set read_format PERF_FORMAT_LOST on kprobe perf fds

2019-09-17 Thread Daniel Xu
There is no way to get the nmissed count from kprobes that are created using the perf API. The previous commits added read_format support for this count. Enable it in this commit. Signed-off-by: Daniel Xu --- tools/lib/bpf/libbpf.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions

[PATCH bpf-next 5/5] libbpf: Add selftest for PERF_FORMAT_LOST perf read_format

2019-09-17 Thread Daniel Xu
Signed-off-by: Daniel Xu --- .../selftests/bpf/prog_tests/attach_probe.c | 32 ++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/prog_tests/attach_probe.c b/tools/testing/selftests/bpf/prog_tests/attach_probe.c index 5ecc267d98b0

[PATCH bpf-next 1/5] perf/core: Add PERF_FORMAT_LOST read_format

2019-09-17 Thread Daniel Xu
infrastructure and misses from ringbuffer infrastructure. Signed-off-by: Daniel Xu --- include/linux/trace_events.h| 1 + include/uapi/linux/perf_event.h | 5 - kernel/events/core.c| 39 ++--- kernel/trace/trace_kprobe.c | 8 +++ 4 files changed

[PATCH bpf-next 3/5] libbpf: Add helpers to extract perf fd from bpf_link

2019-09-17 Thread Daniel Xu
it clear to users what they can expect to extract from what type of link. Acked-by: Song Liu Acked-by: Andrii Nakryiko Signed-off-by: Daniel Xu --- tools/lib/bpf/libbpf.c | 21 + tools/lib/bpf/libbpf.h | 13 + tools/lib/bpf/libbpf.map | 3 +++ 3 files changed

[PATCH bpf-next 0/5] Add PERF_FORMAT_LOST read_format

2019-09-17 Thread Daniel Xu
hing while reading the code so please let me know if I am mistaken. Daniel Xu (5): perf/core: Add PERF_FORMAT_LOST read_format perf/core: Sync perf_event.h to tools libbpf: Add helpers to extract perf fd from bpf_link libbpf: Set read_format PERF_FORMAT_LOST on kprobe perf fds libbpf: Ad

Re: [PATCH v3 bpf-next 1/4] tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE ioctl

2019-08-22 Thread Daniel Xu
On Thu Aug 22, 2019 at 11:05 AM Peter Zijlstra wrote: > On Thu, Aug 22, 2019 at 07:54:16AM +, Song Liu wrote: > > Hi Peter, > > > > > On Aug 22, 2019, at 12:47 AM, Peter Zijlstra wrote: > > > > > > On Wed, Aug 21, 2019 at 06:43:49PM +, Yonghong Song wrote: > > >> On 8/21/19 11:31 AM,

[PATCH v4 bpf-next 2/4] libbpf: Add helpers to extract perf fd from bpf_link

2019-08-20 Thread Daniel Xu
it clear to users what they can expect to extract from what type of link. Acked-by: Song Liu Acked-by: Andrii Nakryiko Signed-off-by: Daniel Xu --- tools/lib/bpf/libbpf.c | 21 + tools/lib/bpf/libbpf.h | 13 + tools/lib/bpf/libbpf.map | 3 +++ 3 files changed, 37

[PATCH v4 bpf-next 4/4] tracing/probe: Add self test for PERF_EVENT_IOC_QUERY_PROBE

2019-08-20 Thread Daniel Xu
Acked-by: Andrii Nakryiko Signed-off-by: Daniel Xu --- .../selftests/bpf/prog_tests/attach_probe.c | 115 ++ 1 file changed, 115 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/attach_probe.c b/tools/testing/selftests/bpf/prog_tests/attach_probe.c index

[PATCH v4 bpf-next 3/4] tracing/probe: Sync perf_event.h to tools

2019-08-20 Thread Daniel Xu
Signed-off-by: Daniel Xu --- tools/include/uapi/linux/perf_event.h | 23 +++ 1 file changed, 23 insertions(+) diff --git a/tools/include/uapi/linux/perf_event.h b/tools/include/uapi/linux/perf_event.h index 7198ddd0c6b1..8783d29a807a 100644 --- a/tools/include/uapi/linux

[PATCH v4 bpf-next 1/4] tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE ioctl

2019-08-20 Thread Daniel Xu
but leave the possibility open for other probes like tracepoint. Signed-off-by: Daniel Xu --- include/linux/trace_events.h| 2 ++ include/uapi/linux/perf_event.h | 23 +++ kernel/events/core.c| 20 kernel/trace/trace_kprobe.c | 25

[PATCH v4 bpf-next 0/4] tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE

2019-08-20 Thread Daniel Xu
rom ioctl struct - Split out libbpf.h sync to tools dir to separate commit Daniel Xu (4): tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE ioctl libbpf: Add helpers to extract perf fd from bpf_link tracing/probe: Sync perf_event.h to tools tracing/probe: Add self test for PERF_EVENT_IOC_QU

Re: [PATCH v3 bpf-next 1/4] tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE ioctl

2019-08-20 Thread Daniel Xu
Hi Peter, On Tue Aug 20, 2019 at 4:45 PM Peter Zijlstra wrote: > On Fri, Aug 16, 2019 at 03:31:46PM -0700, Daniel Xu wrote: > > It's useful to know [uk]probe's nmissed and nhit stats. For example with > > tracing tools, it's important to know when events may have been lost. > &

Re: [PATCH v3 bpf-next 1/4] tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE ioctl

2019-08-19 Thread Daniel Xu
On Mon Aug 19, 2019 at 6:26 PM Alexei Starovoitov wrote: > On Fri, Aug 16, 2019 at 3:33 PM Daniel Xu wrote: > > > > It's useful to know [uk]probe's nmissed and nhit stats. For example with > > tracing tools, it's important to know when events may have been lost. > >

Re: [PATCH v3 bpf-next 2/4] libbpf: Add helpers to extract perf fd from bpf_link

2019-08-19 Thread Daniel Xu
On Mon, Aug 19, 2019, at 10:45 AM, Andrii Nakryiko wrote: > On Fri, Aug 16, 2019 at 3:32 PM Daniel Xu wrote: > > > > It is sometimes necessary to perform ioctl's on the underlying perf fd. > > There is not currently a way to extract the fd given a bpf_link, so add a

[PATCH v3 bpf-next 3/4] tracing/probe: Sync perf_event.h to tools

2019-08-16 Thread Daniel Xu
Signed-off-by: Daniel Xu --- tools/include/uapi/linux/perf_event.h | 23 +++ 1 file changed, 23 insertions(+) diff --git a/tools/include/uapi/linux/perf_event.h b/tools/include/uapi/linux/perf_event.h index 7198ddd0c6b1..8783d29a807a 100644 --- a/tools/include/uapi/linux

[PATCH v3 bpf-next 1/4] tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE ioctl

2019-08-16 Thread Daniel Xu
but leave the possibility open for other probes like tracepoint. Signed-off-by: Daniel Xu --- include/linux/trace_events.h| 12 include/uapi/linux/perf_event.h | 23 +++ kernel/events/core.c| 20 kernel/trace/trace_kprobe.c

[PATCH v3 bpf-next 2/4] libbpf: Add helpers to extract perf fd from bpf_link

2019-08-16 Thread Daniel Xu
it clear to users what they can expect to extract from what type of link. Acked-by: Song Liu Signed-off-by: Daniel Xu --- tools/lib/bpf/libbpf.c | 21 + tools/lib/bpf/libbpf.h | 13 + tools/lib/bpf/libbpf.map | 4 3 files changed, 38 insertions(+) diff --git

[PATCH v3 bpf-next 0/4] tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE

2019-08-16 Thread Daniel Xu
iptive cover letter - Make API more generic and support uprobes as well - Use casters/getters for libbpf instead of single getter - Fix typos - Remove size field from ioctl struct - Split out libbpf.h sync to tools dir to separate commit Daniel Xu (4): tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE

[PATCH v3 bpf-next 4/4] tracing/probe: Add self test for PERF_EVENT_IOC_QUERY_PROBE

2019-08-16 Thread Daniel Xu
Acked-by: Andrii Nakryiko Signed-off-by: Daniel Xu --- .../selftests/bpf/prog_tests/attach_probe.c | 106 ++ 1 file changed, 106 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/attach_probe.c b/tools/testing/selftests/bpf/prog_tests/attach_probe.c index

Re: [PATCH v2 bpf-next 1/4] tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE ioctl

2019-08-13 Thread Daniel Xu
On Tue, Aug 13, 2019, at 2:47 PM, Song Liu wrote: > On Fri, Aug 9, 2019 at 2:48 PM Daniel Xu wrote: > > > > It's useful to know [uk]probe's nmissed and nhit stats. For example with > > tracing tools, it's important to know when events may have been lost. > > debugfs

Re: [PATCH v2 bpf-next 1/4] tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE ioctl

2019-08-12 Thread Daniel Xu
On Mon, Aug 12, 2019, at 8:57 AM, Andrii Nakryiko wrote: > On Fri, Aug 9, 2019 at 2:47 PM Daniel Xu wrote: > > > > It's useful to know [uk]probe's nmissed and nhit stats. For example with > > tracing tools, it's important to know when events may have been lost. > >

Re: [PATCH v2 bpf-next 0/4] tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE

2019-08-09 Thread Daniel Xu
On Fri, Aug 9, 2019, at 2:47 PM, Daniel Xu wrote: > It's useful to know [uk]probe's nmissed and nhit stats. For example with > tracing tools, it's important to know when events may have been lost. > debugfs currently exposes a control file to get this information, but > it is no

[PATCH v2 bpf-next 3/4] tracing/probe: Sync perf_event.h to tools

2019-08-09 Thread Daniel Xu
Signed-off-by: Daniel Xu --- tools/include/uapi/linux/perf_event.h | 19 +++ 1 file changed, 19 insertions(+) diff --git a/tools/include/uapi/linux/perf_event.h b/tools/include/uapi/linux/perf_event.h index 7198ddd0c6b1..65faa9b2a3b4 100644 --- a/tools/include/uapi/linux

[PATCH v2 bpf-next 4/4] tracing/probe: Add self test for PERF_EVENT_IOC_QUERY_PROBE

2019-08-09 Thread Daniel Xu
Signed-off-by: Daniel Xu --- .../selftests/bpf/prog_tests/attach_probe.c | 102 ++ 1 file changed, 102 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/attach_probe.c b/tools/testing/selftests/bpf/prog_tests/attach_probe.c index 5ecc267d98b0..bb53103ddb66

[PATCH v2 bpf-next 0/4] tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE

2019-08-09 Thread Daniel Xu
ync to tools dir to separate commit Daniel Xu (4): tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE ioctl libbpf: Add helpers to extract perf fd from bpf_link tracing/probe: Sync perf_event.h to tools tracing/probe: Add self test for PERF_EVENT_IOC_QUERY_PROBE include/linux/trace_event

[PATCH v2 bpf-next 1/4] tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE ioctl

2019-08-09 Thread Daniel Xu
but leave the possibility open for other probes like tracepoint. Signed-off-by: Daniel Xu --- include/linux/trace_events.h| 12 include/uapi/linux/perf_event.h | 19 +++ kernel/events/core.c| 20 kernel/trace/trace_kprobe.c

[PATCH v2 bpf-next 2/4] libbpf: Add helpers to extract perf fd from bpf_link

2019-08-09 Thread Daniel Xu
it clear to users what they can expect to extract from what type of link. Signed-off-by: Daniel Xu --- tools/lib/bpf/libbpf.c | 19 +++ tools/lib/bpf/libbpf.h | 8 tools/lib/bpf/libbpf.map | 6 ++ 3 files changed, 33 insertions(+) diff --git a/tools/lib/bpf/libbpf.c b