[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181209220821.6hljqvemjl454cyx@ast-mbp.dhcp.thefacebook.com>
Date: Sun, 9 Dec 2018 14:08:23 -0800
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Martin KaFai Lau <kafai@...com>
Cc: netdev@...r.kernel.org, Alexei Starovoitov <ast@...com>,
Daniel Borkmann <daniel@...earbox.net>, kernel-team@...com
Subject: Re: [PATCH bpf-next 0/7] Introduce bpf_line_info
On Fri, Dec 07, 2018 at 04:42:24PM -0800, Martin KaFai Lau wrote:
> This patch series introduces the bpf_line_info. Please see individual patch
> for details.
>
> It will be useful for introspection purpose, like:
>
> [root@...h-fb-vm1 bpf]# ~/devshare/fb-kernel/linux/tools/bpf/bpftool/bpftool prog dump jited pinned /sys/fs/bpf/test_btf_haskv
> [...]
> int test_long_fname_2(struct dummy_tracepoint_args * arg):
> bpf_prog_44a040bf25481309_test_long_fname_2:
> ; static int test_long_fname_2(struct dummy_tracepoint_args *arg)
> 0: push %rbp
> 1: mov %rsp,%rbp
> 4: sub $0x30,%rsp
> b: sub $0x28,%rbp
> f: mov %rbx,0x0(%rbp)
> 13: mov %r13,0x8(%rbp)
> 17: mov %r14,0x10(%rbp)
> 1b: mov %r15,0x18(%rbp)
> 1f: xor %eax,%eax
> 21: mov %rax,0x20(%rbp)
> 25: xor %esi,%esi
> ; int key = 0;
> 27: mov %esi,-0x4(%rbp)
> ; if (!arg->sock)
> 2a: mov 0x8(%rdi),%rdi
> ; if (!arg->sock)
> 2e: cmp $0x0,%rdi
> 32: je 0x0000000000000070
> 34: mov %rbp,%rsi
> ; counts = bpf_map_lookup_elem(&btf_map, &key);
> 37: add $0xfffffffffffffffc,%rsi
> 3b: movabs $0xffff8881139d7480,%rdi
> 45: add $0x110,%rdi
> 4c: mov 0x0(%rsi),%eax
> 4f: cmp $0x4,%rax
> 53: jae 0x000000000000005e
> 55: shl $0x3,%rax
> 59: add %rdi,%rax
> 5c: jmp 0x0000000000000060
> 5e: xor %eax,%eax
> ; if (!counts)
> 60: cmp $0x0,%rax
> 64: je 0x0000000000000070
> ; counts->v6++;
> 66: mov 0x4(%rax),%edi
> 69: add $0x1,%rdi
> 6d: mov %edi,0x4(%rax)
> 70: mov 0x0(%rbp),%rbx
> 74: mov 0x8(%rbp),%r13
> 78: mov 0x10(%rbp),%r14
> 7c: mov 0x18(%rbp),%r15
> 80: add $0x28,%rbp
> 84: leaveq
> 85: retq
> [...]
Looks great! Applied to bpf-next.
Please follow up with a patch to make use of it in the verifier too.
Powered by blists - more mailing lists