Re: [PATCH v3 net-next] tcp: Remove use of daddr_cache in tracepoint

2017-10-17 Thread Song Liu
> > Remove use of ipv6_pinfo in favor of data in sock_common. > > > > Fixes: e086101b150a ("tcp: add a tracepoint for tcp retransmission") > > Signed-off-by: David Ahern <dsah...@gmail.com> > > --- > > Reviewed-by: Eric Dumazet <edum

Re: [PATCH net-next] tcp: Remove use of inet6_sk and add IPv6 checks to tracepoint

2017-10-18 Thread Song Liu
;> Signed-off-by: David Ahern <dsah...@gmail.com> >> --- > > Reviewed-by: Eric Dumazet <eduma...@google.com> > > Thanks ! > Tested-by: Song Liu <songliubrav...@fb.com>

Re: [PATCH 1/6] perf: Add new type PERF_TYPE_PROBE

2017-11-29 Thread Song Liu
> On Nov 23, 2017, at 2:22 AM, Peter Zijlstra <pet...@infradead.org> wrote: > > On Wed, Nov 15, 2017 at 09:23:33AM -0800, Song Liu wrote: >> A new perf type PERF_TYPE_PROBE is added to allow creating [k,u]probe >> with perf_event_open. These [k,u]probe are associated

[PATCH v2 0/6] enable creating [k,u]probe with perf_event_open

2017-11-29 Thread Song Liu
: add type PERF_TYPE_KPROBE and PERF_TYPE_UPROBE bcc patch: bcc: Try use new API to create [k,u]probe with perf_event_open kernel patches: Song Liu (6): perf: Add new types PERF_TYPE_KPROBE and PERF_TYPE_UPROBE perf: copy new perf_event.h to tools/include/uapi perf: implement support of PERF_TYPE_KPR

[PATCH v2 1/6] perf: Add new types PERF_TYPE_KPROBE and PERF_TYPE_UPROBE

2017-11-29 Thread Song Liu
are added to union config1 for pointers to function name for kprobe or binary path for uprobe. kprobe_addr and probe_offset are added to union config2 for kernel address (when kprobe_func is NULL), or [k,u]probe offset. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong S

[PATCH v2 5/6] bpf: add option for bpf_load.c to use PERF_TYPE_KPROBE

2017-11-29 Thread Song Liu
Function load_and_attach() is updated to be able to create kprobes with either old text based API, or the new PERF_TYPE_KPROBE API. A global flag use_perf_type_probe is added to select between the two APIs. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Josef Bacik <jba.

[PATCH v2 4/6] perf: implement support of PERF_TYPE_UPROBE

2017-11-29 Thread Song Liu
This patch adds perf_uprobe support with similar pattern as previous patch (for kprobe). Two functions, create_local_trace_uprobe() and destroy_local_trace_uprobe(), are created so a uprobe can be created and attached to the file descriptor created by perf_event_open(). Signed-off-by: Song Liu

[PATCH v2] perf_event_open.2: add type PERF_TYPE_KPROBE and PERF_TYPE_UPROBE

2017-11-29 Thread Song Liu
Two new types PERF_TYPE_KPROBE and PERF_TYPE_UPROBE are being added to perf_event_attr. This patch adds information about this type. Signed-off-by: Song Liu <songliubrav...@fb.com> --- man2/perf_event_open.2 | 42 ++ 1 file changed, 42 insertions(+)

[PATCH v2 2/6] perf: copy new perf_event.h to tools/include/uapi

2017-11-29 Thread Song Liu
perf_event.h is updated in previous patch, this patch applies same changes to the tools/ version. This is part is put in a separate patch in case the two files are back ported separately. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y...@fb.com> Review

[PATCH v3 1/6] perf: prepare perf_event.h for new types perf_kprobe and perf_uprobe

2017-11-30 Thread Song Liu
to union config1 for pointers to function name for kprobe or binary path for uprobe. kprobe_addr and probe_offset are added to union config2 for kernel address (when kprobe_func is NULL), or [k,u]probe offset. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y.

[PATCH v3 0/6] enable creating [k,u]probe with perf_event_open

2017-11-30 Thread Song Liu
c: Try use new API to create [k,u]probe with perf_event_open kernel patches: Song Liu (6): perf: prepare perf_event.h for new types perf_kprobe and perf_uprobe perf: copy new perf_event.h to tools/include/uapi perf: implement pmu perf_kprobe perf: implement pmu perf_uprobe bpf:

[PATCH v3 3/6] perf: implement pmu perf_kprobe

2017-11-30 Thread Song Liu
() and destroy_local_trace_kprobe() are added to created and destroy these local trace_kprobe. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y...@fb.com> Reviewed-by: Josef Bacik <jba...@fb.com> --- include/linux/trace_events.h| 2 + kernel/events/core

[PATCH v3 5/6] bpf: add option for bpf_load.c to use perf_kprobe

2017-11-30 Thread Song Liu
Function load_and_attach() is updated to be able to create kprobes with either old text based API, or the new perf_event_open API. A global flag use_perf_kprobe is added to select between the two APIs. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Josef Bacik <jba.

[PATCH v3] perf_event_open.2: add type kprobe and uprobe

2017-11-30 Thread Song Liu
Two new types kprobe and uprobe are being added to perf_event_open, which allow creating kprobe or uprobe with perf_event_open. This patch adds information about these types. Signed-off-by: Song Liu <songliubrav...@fb.com> --- man2/perf_event_open.

[PATCH v3 4/6] perf: implement pmu perf_uprobe

2017-11-30 Thread Song Liu
This patch adds perf_uprobe support with similar pattern as previous patch (for kprobe). Two functions, create_local_trace_uprobe() and destroy_local_trace_uprobe(), are created so a uprobe can be created and attached to the file descriptor created by perf_event_open(). Signed-off-by: Song Liu

[PATCH v3 2/6] perf: copy new perf_event.h to tools/include/uapi

2017-11-30 Thread Song Liu
perf_event.h is updated in previous patch, this patch applies same changes to the tools/ version. This is part is put in a separate patch in case the two files are back ported separately. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y...@fb.com> Review

[PATCH v3] bcc: Try use new API to create [k,u]probe with perf_event_open

2017-11-30 Thread Song Liu
New kernel API allows creating [k,u]probe with perf_event_open. This patch tries to use the new API. If the new API doesn't work, we fall back to old API. bpf_detach_probe() looks up the event being removed. If the event is not found, we skip the clean up procedure. Signed-off-by: Song Liu

[PATCH v3 6/6] bpf: add new test test_many_kprobe

2017-11-30 Thread Song Liu
5.077558 seconds Cleaning 1000 kprobes with perf_kprobe (function name) takes 81.241354 seconds Creating 1000 kprobes with perf_kprobe (function addr) takes 5.218255 seconds Cleaning 1000 kprobes with perf_kprobe (function addr) takes 80.010731 seconds Signed-off-by: Song Liu <songliubrav...@fb.

[PATCH v2 6/6] bpf: add new test test_many_kprobe

2017-11-29 Thread Song Liu
) takes 5.077558 seconds Cleaning 1000 kprobes with PERF_TYPE_KPROBE (function name) takes 81.241354 seconds Creating 1000 kprobes with PERF_TYPE_KPROBE (function addr) takes 5.218255 seconds Cleaning 1000 kprobes with PERF_TYPE_KPROBE (function addr) takes 80.010731 seconds Signed-off-by: Song

[PATCH v2 3/6] perf: implement support of PERF_TYPE_KPROBE

2017-11-29 Thread Song Liu
, create_local_trace_kprobe() and destroy_local_trace_kprobe() are added to created and destroy these local trace_kprobe. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y...@fb.com> Reviewed-by: Josef Bacik <jba...@fb.com> --- include/linux/trace_events.h|

[PATCH v2] bcc: Try use new API to create [k,u]probe with perf_event_open

2017-11-29 Thread Song Liu
New kernel API allows creating [k,u]probe with perf_event_open. This patch tries to use the new API. If the new API doesn't work, we fall back to old API. bpf_detach_probe() looks up the event being removed. If the event is not found, we skip the clean up procedure. Signed-off-by: Song Liu

Re: [PATCH v3 1/6] perf: prepare perf_event.h for new types perf_kprobe and perf_uprobe

2017-12-04 Thread Song Liu
> On Dec 3, 2017, at 9:03 AM, Alexei Starovoitov <alexei.starovoi...@gmail.com> > wrote: > > On Thu, Nov 30, 2017 at 03:50:18PM -0800, Song Liu wrote: >> Two new perf types, perf_kprobe and perf_uprobe, will be added to allow >> creating [k,u]probe with per

Re: [PATCH v2 net-next] net/tcp: trace all TCP/IP state transition with tcp_set_state tracepoint

2017-12-04 Thread Song Liu
+{ > + trace_tcp_set_state(sk, sk->sk_state, newstate); > + sk_state_store(sk, newstate); > +} > + > +void __tcp_set_state(struct sock *sk, int state) > +{ > + trace_tcp_set_state(sk, sk->sk_state, state); > + sk->sk_state = state; > +} > + > void tcp_set_state(struct sock *sk, int state) > { > int oldstate = sk->sk_state; > -- > 1.8.3.1 > Asked-by: Song Liu <songliubrav...@fb.com>

[PATCH v4] bcc: Try use new API to create [k,u]probe with perf_event_open

2017-12-04 Thread Song Liu
New kernel API allows creating [k,u]probe with perf_event_open. This patch tries to use the new API. If the new API doesn't work, we fall back to old API. bpf_detach_probe() looks up the event being removed. If the event is not found, we skip the clean up procedure. Signed-off-by: Song Liu

[PATCH v4 1/6] perf: prepare perf_event.h for new types perf_kprobe and perf_uprobe

2017-12-04 Thread Song Liu
to union config1 for pointers to function name for kprobe or binary path for uprobe. kprobe_addr and probe_offset are added to union config2 for kernel address (when kprobe_func is NULL), or [k,u]probe offset. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y.

[PATCH v4 5/6] bpf: add option for bpf_load.c to use perf_kprobe

2017-12-04 Thread Song Liu
Function load_and_attach() is updated to be able to create kprobes with either old text based API, or the new perf_event_open API. A global flag use_perf_kprobe is added to select between the two APIs. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Josef Bacik <jba.

[PATCH v4 6/6] bpf: add new test test_many_kprobe

2017-12-04 Thread Song Liu
5.077558 seconds Cleaning 1000 kprobes with perf_kprobe (function name) takes 81.241354 seconds Creating 1000 kprobes with perf_kprobe (function addr) takes 5.218255 seconds Cleaning 1000 kprobes with perf_kprobe (function addr) takes 80.010731 seconds Signed-off-by: Song Liu <songliubrav...@fb.

[PATCH v4 2/6] perf: copy new perf_event.h to tools/include/uapi

2017-12-04 Thread Song Liu
perf_event.h is updated in previous patch, this patch applies same changes to the tools/ version. This is part is put in a separate patch in case the two files are back ported separately. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y...@fb.com> Review

[PATCH v4 4/6] perf: implement pmu perf_uprobe

2017-12-04 Thread Song Liu
This patch adds perf_uprobe support with similar pattern as previous patch (for kprobe). Two functions, create_local_trace_uprobe() and destroy_local_trace_uprobe(), are created so a uprobe can be created and attached to the file descriptor created by perf_event_open(). Signed-off-by: Song Liu

[PATCH v4 3/6] perf: implement pmu perf_kprobe

2017-12-04 Thread Song Liu
() and destroy_local_trace_kprobe() are added to created and destroy these local trace_kprobe. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y...@fb.com> Reviewed-by: Josef Bacik <jba...@fb.com> --- include/linux/trace_events.h| 4 ++ kernel/events/core

[PATCH v4] perf_event_open.2: add type kprobe and uprobe

2017-12-04 Thread Song Liu
Two new types kprobe and uprobe are being added to perf_event_open, which allow creating kprobe or uprobe with perf_event_open. This patch adds information about these types. Signed-off-by: Song Liu <songliubrav...@fb.com> --- man2/perf_event_open.

[PATCH v4 0/6] enable creating [k,u]probe with perf_event_open

2017-12-04 Thread Song Liu
probe bcc patch: bcc: Try use new API to create [k,u]probe with perf_event_open kernel patches: Song Liu (6): perf: prepare perf_event.h for new types perf_kprobe and perf_uprobe perf: copy new perf_event.h to tools/include/uapi perf: implement pmu perf_kprobe perf: implement pmu perf_up

Re: [PATCH v5 0/6] enable creating [k,u]probe with perf_event_open

2017-12-19 Thread Song Liu
> On Dec 8, 2017, at 11:57 AM, Daniel Borkmann <dan...@iogearbox.net> wrote: > > On 12/06/2017 11:45 PM, Song Liu wrote: >> Changes PATCH v4 to PATCH v5: >> Remove PERF_PROBE_CONFIG_IS_RETPROBE from uapi, use PMU_FORMAT_ATTR >> instead. >> >>

[PATCH bpf] xdp: linearize skb in netif_receive_generic_xdp()

2017-12-14 Thread Song Liu
t access") Signed-off-by: Song Liu <songliubrav...@fb.com> Acked-by: Martin KaFai Lau <ka...@fb.com> Cc: Daniel Borkmann <dan...@iogearbox.net> Cc: Alexei Starovoitov <a...@kernel.org> --- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/

Re: [PATCH v2 net-next 2/4] net: tracepoint: replace tcp_set_state tracepoint with sock_set_state tracepoint

2017-12-15 Thread Song Liu
> On Dec 15, 2017, at 9:56 AM, Yafang Shao wrote: > > As sk_state is a common field for struct sock, so the state > transition should not be a TCP specific feature. > So I rename tcp_set_state tracepoint to sock_set_state tracepoint with > some minor changes and move it

Re: [PATCH] tcp: Export to userspace the TCP state names for the trace events

2017-11-10 Thread Song Liu
> On Nov 10, 2017, at 7:07 AM, Steven Rostedt wrote: > > On Fri, 10 Nov 2017 12:56:06 +0800 > Yafang Shao wrote: > >> Could the macro tcp_state_name() be renamed ? >> If is included in include/net/tcp.h, it will > > Ideally, you don't want to

Re: [PATCH v2 net-next] net/tcp: trace all TCP/IP state transition with tcp_set_state tracepoint

2017-11-18 Thread Song Liu
> On Nov 18, 2017, at 7:32 AM, Yafang Shao wrote: > > The TCP/IP transition from TCP_LISTEN to TCP_SYN_RECV and some other > transitions are not traced with tcp_set_state tracepoint. > > In order to trace the whole tcp lifespans, two helpers are introduced, > void

Re: [RFC v2 0/6] enable creating [k,u]probe with perf_event_open

2017-11-13 Thread Song Liu
> On Nov 12, 2017, at 3:40 PM, Song Liu <songliubrav...@fb.com> wrote: > > Changes v1 to v2: > Fix build issue reported by kbuild test bot by adding ifdef of > CONFIG_KPROBE_EVENTS, and CONFIG_UPROBE_EVENTS. > > v1 cover letter: > > This is to follow up th

[PATCH 0/6] enable creating [k,u]probe with perf_event_open

2017-11-15 Thread Song Liu
6/bcc/tree/perf_event_opn Thanks, Song man-pages patch: perf_event_open.2: add new type PERF_TYPE_PROBE bcc patch: bcc: Try use new API to create [k,u]probe with perf_event_open kernel patches: Song Liu (6): perf: Add new type PERF_TYPE_PROBE perf: copy new perf_event.h to tools/include/u

[PATCH 2/6] perf: copy new perf_event.h to tools/include/uapi

2017-11-15 Thread Song Liu
perf_event.h is updated in previous patch, this patch applies same changes to the tools/ version. This is part is put in a separate patch in case the two files are back ported separately. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y...@fb.com> Review

[PATCH] perf_event_open.2: add new type PERF_TYPE_PROBE

2017-11-15 Thread Song Liu
are not included in this patch. write_backward : 1 namespaces : 1 Signed-off-by: Song Liu <songliubrav...@fb.com> --- man2/perf_event_open.2 | 82 -- 1 file changed, 80 insertions(+), 2 deletions(-) diff --git

[PATCH 5/6] bpf: add option for bpf_load.c to use PERF_TYPE_PROBE

2017-11-15 Thread Song Liu
Function load_and_attach() is updated to be able to create kprobes with either old text based API, or the new PERF_TYPE_PROBE API. A global flag use_perf_type_probe is added to select between the two APIs. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Josef Bacik <jba.

[PATCH 4/6] perf: implement uprobe support to PERF_TYPE_PROBE

2017-11-15 Thread Song Liu
-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y...@fb.com> Reviewed-by: Josef Bacik <jba...@fb.com> --- kernel/trace/trace_event_perf.c | 48 +- kernel/trace/trace_probe.h | 4 ++ kernel/trace/trace

[PATCH] bcc: Try use new API to create [k,u]probe with perf_event_open

2017-11-15 Thread Song Liu
New kernel API allows creating [k,u]probe with perf_event_open. This patch tries to use the new API. If the new API doesn't work, we fall back to old API. bpf_detach_probe() looks up the event being removed. If the event is not found, we skip the clean up procedure. Signed-off-by: Song Liu

[PATCH 3/6] perf: implement kprobe support to PERF_TYPE_PROBE

2017-11-15 Thread Song Liu
, create_local_trace_kprobe() and destroy_local_trace_kprobe() are added to created and destroy these local trace_kprobe. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y...@fb.com> Reviewed-by: Josef Bacik <jba...@fb.com> --- include/linux/trace_events.h|

[PATCH 6/6] bpf: add new test test_many_kprobe

2017-11-15 Thread Song Liu
) takes 5.077558 seconds Cleaning 1000 kprobes with PERF_TYPE_PROBE (function name) takes 81.241354 seconds Creating 1000 kprobes with PERF_TYPE_PROBE (function addr) takes 5.218255 seconds Cleaning 1000 kprobes with PERF_TYPE_PROBE (function addr) takes 80.010731 seconds Signed-off-by: Song Liu

[PATCH 1/6] perf: Add new type PERF_TYPE_PROBE

2017-11-15 Thread Song Liu
with the pointer, we will (in the following patches) copy probe_desc to __aligned_u64 before using it as pointer. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y...@fb.com> Reviewed-by: Josef Bacik <jba...@fb.com> Acked-by: Alexei Starovoitov <a...@kernel.o

[RFC] bcc: Try use new API to create [k,u]probe with perf_event_open

2017-11-12 Thread Song Liu
New kernel API allows creating [k,u]probe with perf_event_open. This patch tries to use the new API. If the new API doesn't work, we fall back to old API. bpf_detach_probe() looks up the event being removed. If the event is not found, we skip the clean up procedure. Signed-off-by: Song Liu

[RFC v2 2/6] perf: copy new perf_event.h to tools/include/uapi

2017-11-12 Thread Song Liu
perf_event.h is updated in previous patch, this patch applies same changes to the tools/ version. This is part is put in a separate patch in case the two files are back ported separately. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y...@fb.com> Review

[RFC v2 1/6] perf: Add new type PERF_TYPE_PROBE

2017-11-12 Thread Song Liu
with the pointer, we will (in the following patches) copy probe_desc to __aligned_u64 before using it as pointer. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y...@fb.com> Reviewed-by: Josef Bacik <jba...@fb.com> Acked-by: Alexei Starovoitov <a...@kernel.o

[RFC v2 3/6] perf: implement kprobe support to PERF_TYPE_PROBE

2017-11-12 Thread Song Liu
, create_local_trace_kprobe() and destroy_local_trace_kprobe() are added to created and destroy these local trace_kprobe. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y...@fb.com> Reviewed-by: Josef Bacik <jba...@fb.com> --- include/linux/trace_events.h|

[RFC] perf_event_open.2: add new type PERF_TYPE_PROBE

2017-11-12 Thread Song Liu
are not included in this patch. write_backward : 1 namespaces : 1 Signed-off-by: Song Liu <songliubrav...@fb.com> --- man2/perf_event_open.2 | 82 -- 1 file changed, 80 insertions(+), 2 deletions(-) diff --git

[RFC v2 5/6] bpf: add option for bpf_load.c to use PERF_TYPE_PROBE

2017-11-12 Thread Song Liu
Function load_and_attach() is updated to be able to create kprobes with either old text based API, or the new PERF_TYPE_PROBE API. A global flag use_perf_type_probe is added to select between the two APIs. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Josef Bacik <jba.

[RFC v2 6/6] bpf: add new test test_many_kprobe

2017-11-12 Thread Song Liu
) takes 5.077558 seconds Cleaning 1000 kprobes with PERF_TYPE_PROBE (function name) takes 81.241354 seconds Creating 1000 kprobes with PERF_TYPE_PROBE (function addr) takes 5.218255 seconds Cleaning 1000 kprobes with PERF_TYPE_PROBE (function addr) takes 80.010731 seconds Signed-off-by: Song Liu

[RFC v2 0/6] enable creating [k,u]probe with perf_event_open

2017-11-12 Thread Song Liu
ry use new API to create [k,u]probe with perf_event_open kernel patches: Song Liu (6): perf: Add new type PERF_TYPE_PROBE perf: copy new perf_event.h to tools/include/uapi perf: implement kprobe support to PERF_TYPE_PROBE perf: implement uprobe support to PERF_TYPE_PROBE bpf:

[RFC v2 4/6] perf: implement uprobe support to PERF_TYPE_PROBE

2017-11-12 Thread Song Liu
-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y...@fb.com> Reviewed-by: Josef Bacik <jba...@fb.com> --- kernel/trace/trace_event_perf.c | 48 +- kernel/trace/trace_probe.h | 4 ++ kernel/trace/trace

Re: [PATCH] net/tcp: introduce TRACE_EVENT for TCP/IPv4 state transition

2017-11-09 Thread Song Liu
> On Nov 9, 2017, at 10:18 AM, Steven Rostedt wrote: > > On Thu, 9 Nov 2017 15:43:29 +0900 > Alexei Starovoitov wrote: > >>> +TRACE_EVENT(tcp_set_state, >>> + TP_PROTO(struct sock *sk, int oldstate, int newstate), >>> + TP_ARGS(sk,

Re: [PATCH] net/tcp: introduce TRACE_EVENT for TCP/IPv4 state transition

2017-11-09 Thread Song Liu
> On Nov 9, 2017, at 10:34 AM, Song Liu <songliubrav...@fb.com> wrote: > >> >> On Nov 9, 2017, at 10:18 AM, Steven Rostedt <rost...@goodmis.org> wrote: >> >> On Thu, 9 Nov 2017 15:43:29 +0900 >> Alexei Starovoitov <alexei.starovoi...@gm

Re: [PATCH] tcp: Export to userspace the TCP state names for the trace events

2017-11-09 Thread Song Liu
ate_name(TCP_SYN_RECV), \ > - tcp_state_name(TCP_FIN_WAIT1), \ > - tcp_state_name(TCP_FIN_WAIT2), \ > - tcp_state_name(TCP_TIME_WAIT), \ > - tcp_state_name(TCP_CLOSE), \ > - tcp_state_name(TCP_CLOSE_WAIT), \ > - tcp_state_name(TCP_LAST_ACK), \ > - tcp_state_name(TCP_LISTEN), \ > - tcp_state_name(TCP_CLOSING),\ > - tcp_state_name(TCP_NEW_SYN_RECV)) > + __print_symbolic(val, tcp_state_names) > > /* > * tcp event with arguments sk and skb > -- > 2.13.6 > Reviewed-and-tested-by: Song Liu <songliubrav...@fb.com>

[RFC] perf_event_open.2: add new type PERF_TYPE_PROBE

2017-11-08 Thread Song Liu
are not included in this patch. write_backward : 1 namespaces : 1 Signed-off-by: Song Liu <songliubrav...@fb.com> --- man2/perf_event_open.2 | 82 -- 1 file changed, 80 insertions(+), 2 deletions(-) diff --git

[RFC 3/6] perf: implement kprobe support to PERF_TYPE_PROBE

2017-11-08 Thread Song Liu
, create_local_trace_kprobe() and destroy_local_trace_kprobe() are added to created and destroy these local trace_kprobe. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y...@fb.com> Reviewed-by: Josef Bacik <jba...@fb.com> --- include/linux/trace_events.h|

[RFC 5/6] bpf: add option for bpf_load.c to use PERF_TYPE_PROBE

2017-11-08 Thread Song Liu
Function load_and_attach() is updated to be able to create kprobes with either old text based API, or the new PERF_TYPE_PROBE API. A global flag use_perf_type_probe is added to select between the two APIs. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Josef Bacik <jba.

[RFC 2/6] perf: copy new perf_event.h to tools/include/uapi

2017-11-08 Thread Song Liu
perf_event.h is updated in previous patch, this patch applies same changes to the tools/ version. This is part is put in a separate patch in case the two files are back ported separately. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y...@fb.com> Review

[RFC 0/6] enable creating [k,u]probe with perf_event_open

2017-11-08 Thread Song Liu
ub.com/liu-song-6/bcc/tree/new_perf_event_opn Thanks, Song man-pages patch: perf_event_open.2: add new type PERF_TYPE_PROBE bcc patch: bcc: Try use new API to create [k,u]probe with perf_event_open kernel patches: Song Liu (6): perf: Add new type PERF_TYPE_PROBE perf: copy new perf_event.

[RFC 4/6] perf: implement uprobe support to PERF_TYPE_PROBE

2017-11-08 Thread Song Liu
-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y...@fb.com> Reviewed-by: Josef Bacik <jba...@fb.com> --- kernel/trace/trace_event_perf.c | 33 ++- kernel/trace/trace_probe.h | 4 ++ kernel/trace/trace_uprobe.c | 90 ++

[RFC] bcc: Try use new API to create [k,u]probe with perf_event_open

2017-11-08 Thread Song Liu
New kernel API allows creating [k,u]probe with perf_event_open. This patch tries to use the new API. If the new API doesn't work, we fall back to old API. bpf_detach_probe() looks up the event being removed. If the event is not found, we skip the clean up procedure. Signed-off-by: Song Liu

[RFC 1/6] perf: Add new type PERF_TYPE_PROBE

2017-11-08 Thread Song Liu
with the pointer, we will (in the following patches) copy probe_desc to __aligned_u64 before using it as pointer. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y...@fb.com> Reviewed-by: Josef Bacik <jba...@fb.com> Acked-by: Alexei Starovoitov <a...@kernel.o

[RFC 6/6] bpf: add new test test_many_kprobe

2017-11-08 Thread Song Liu
) takes 5.077558 seconds Cleaning 1000 kprobes with PERF_TYPE_PROBE (function name) takes 81.241354 seconds Creating 1000 kprobes with PERF_TYPE_PROBE (function addr) takes 5.218255 seconds Cleaning 1000 kprobes with PERF_TYPE_PROBE (function addr) takes 80.010731 seconds Signed-off-by: Song Liu

[PATCH v5 0/6] enable creating [k,u]probe with perf_event_open

2017-12-06 Thread Song Liu
m/liu-song-6/bcc/tree/perf_event_open Thanks, Song man-pages patch: perf_event_open.2: add type kprobe and uprobe bcc patch: bcc: Try use new API to create [k,u]probe with perf_event_open kernel patches: Song Liu (6): perf: prepare perf_event.h for new types perf_kprobe and perf_uprobe

[PATCH v5] perf_event_open.2: add type kprobe and uprobe

2017-12-06 Thread Song Liu
Two new types kprobe and uprobe are being added to perf_event_open, which allow creating kprobe or uprobe with perf_event_open. This patch adds information about these types. Signed-off-by: Song Liu <songliubrav...@fb.com> --- man2/perf_event_open.

[PATCH v5 4/6] perf: implement pmu perf_uprobe

2017-12-06 Thread Song Liu
This patch adds perf_uprobe support with similar pattern as previous patch (for kprobe). Two functions, create_local_trace_uprobe() and destroy_local_trace_uprobe(), are created so a uprobe can be created and attached to the file descriptor created by perf_event_open(). Signed-off-by: Song Liu

[PATCH v5 6/6] bpf: add new test test_many_kprobe

2017-12-06 Thread Song Liu
5.077558 seconds Cleaning 1000 kprobes with perf_kprobe (function name) takes 81.241354 seconds Creating 1000 kprobes with perf_kprobe (function addr) takes 5.218255 seconds Cleaning 1000 kprobes with perf_kprobe (function addr) takes 80.010731 seconds Signed-off-by: Song Liu <songliubrav...@fb.

[PATCH v5 1/6] perf: prepare perf_event.h for new types perf_kprobe and perf_uprobe

2017-12-06 Thread Song Liu
to union config1 for pointers to function name for kprobe or binary path for uprobe. kprobe_addr and probe_offset are added to union config2 for kernel address (when kprobe_func is NULL), or [k,u]probe offset. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y.

[PATCH v5 5/6] bpf: add option for bpf_load.c to use perf_kprobe

2017-12-06 Thread Song Liu
Function load_and_attach() is updated to be able to create kprobes with either old text based API, or the new perf_event_open API. A global flag use_perf_kprobe is added to select between the two APIs. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Josef Bacik <jba.

[PATCH v5] bcc: Try use new API to create [k,u]probe with perf_event_open

2017-12-06 Thread Song Liu
New kernel API allows creating [k,u]probe with perf_event_open. This patch tries to use the new API. If the new API doesn't work, we fall back to old API. bpf_detach_probe() looks up the event being removed. If the event is not found, we skip the clean up procedure. Signed-off-by: Song Liu

[PATCH v5 3/6] perf: implement pmu perf_kprobe

2017-12-06 Thread Song Liu
() and destroy_local_trace_kprobe() are added to created and destroy these local trace_kprobe. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y...@fb.com> Reviewed-by: Josef Bacik <jba...@fb.com> --- include/linux/trace_events.h| 4 ++ kernel/events/core

[PATCH v5 2/6] perf: copy new perf_event.h to tools/include/uapi

2017-12-06 Thread Song Liu
perf_event.h is updated in previous patch, this patch applies same changes to the tools/ version. This is part is put in a separate patch in case the two files are back ported separately. Signed-off-by: Song Liu <songliubrav...@fb.com> Reviewed-by: Yonghong Song <y...@fb.com> Review

Re: [PATCH net-next] tcp: add tracepoint trace_tcp_retransmit_synack()

2017-10-25 Thread Song Liu
CCing key audience of the patch. Thanks, Song > On Oct 24, 2017, at 4:57 PM, Song Liu <songliubrav...@fb.com> wrote: > > This tracepoint can be used to trace synack retransmits. It maintains > pointer to struct request_sock. > > We cannot simply reuse trace_tcp_retran

[PATCH net-next] tcp: add tracepoint trace_tcp_retransmit_synack()

2017-10-24 Thread Song Liu
This tracepoint can be used to trace synack retransmits. It maintains pointer to struct request_sock. We cannot simply reuse trace_tcp_retransmit_skb() here, because the sk here is the LISTEN socket. The IP addresses and ports should be extracted from struct request_sock. Signed-off-by: Song Liu

[PATCH net-next 3/6] tcp: add tracepoint trace_tcp_send_reset

2017-10-20 Thread Song Liu
New tracepoint trace_tcp_send_reset is added and called from tcp_v4_send_reset(), tcp_v6_send_reset() and tcp_send_active_reset(). Signed-off-by: Song Liu <songliubrav...@fb.com> --- include/trace/events/tcp.h | 11 +++ net/ipv4/tcp_ipv4.c| 6 +- net/ipv4/tcp_ou

[PATCH net-next 2/6] tcp: mark trace event arguments sk and skb as const

2017-10-20 Thread Song Liu
Some functions that we plan to add trace points require const sk and/or skb. So we mark these fields as const in the tracepoint. Signed-off-by: Song Liu <songliubrav...@fb.com> --- include/trace/events/tcp.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/i

[PATCH net-next 6/6] tcp: add tracepoint trace_tcp_set_state()

2017-10-20 Thread Song Liu
This patch adds tracepoint trace_tcp_set_state. Besides usual fields (s/d ports, IP addresses), old and new state of the socket is also printed with TP_printk, with __print_symbolic(). Signed-off-by: Song Liu <songliubrav...@fb.com> --- include/trace/events/tcp.

[PATCH net-next 1/6] tcp: add trace event class tcp_event_sk_skb

2017-10-20 Thread Song Liu
Introduce event class tcp_event_sk_skb for tcp tracepoints that have arguments sk and skb. Existing tracepoint trace_tcp_retransmit_skb() falls into this class. This patch rewrites the definition of trace_tcp_retransmit_skb() with tcp_event_sk_skb. Signed-off-by: Song Liu <songliubrav...@fb.

[PATCH net-next 4/6] tcp: add tracepoint trace_tcp_receive_reset

2017-10-20 Thread Song Liu
New tracepoint trace_tcp_receive_reset is added and called from tcp_reset(). This tracepoint is define with a new class tcp_event_sk. Signed-off-by: Song Liu <songliubrav...@fb.com> --- include/trace/events/tcp.h | 66 ++ net/ipv4/tcp_i

[PATCH net-next 5/6] tcp: add tracepoint trace_tcp_destroy_sock

2017-10-20 Thread Song Liu
This patch adds trace event trace_tcp_destroy_sock. Signed-off-by: Song Liu <songliubrav...@fb.com> --- include/trace/events/tcp.h | 7 +++ net/ipv4/tcp_ipv4.c| 2 ++ 2 files changed, 9 insertions(+) diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h index c

[PATCH net-next 0/6] add a set of tracepoints to tcp stack

2017-10-20 Thread Song Liu
kprobe__tcp_v4_destroy_sock int kprobe__tcp_set_state int kprobe__tcp_retransmit_skb These tracepoints will help us simplify this work. Thanks, Song Song Liu (6): tcp: add trace event class tcp_event_sk_skb tcp: mark trace event arguments sk and skb as const tcp: add tracepoint

Re: [PATCH net-next 0/6] add a set of tracepoints to tcp stack

2017-10-20 Thread Song Liu
017, at 2:20 PM, Song Liu <songliubrav...@fb.com> wrote: > > Resending the patch set as there were something wrong with my email > server. > > These patches add the following tracepoints to tcp stack. > > tcp_send_reset > tcp_receive_reset > tcp_destroy_sock > t

Re: [PATCH v2 net-next] tcp: add tracepoint trace_tcp_retransmit_synack()

2017-10-30 Thread Song Liu
CCing key audience of the patch. Thanks, Song > On Oct 30, 2017, at 2:41 PM, Song Liu <songliubrav...@fb.com> wrote: > > This tracepoint can be used to trace synack retransmits. It maintains > pointer to struct request_sock. > > We cannot simply reuse trace_tcp_retran

[PATCH v2 net-next] tcp: add tracepoint trace_tcp_retransmit_synack

2017-10-30 Thread Song Liu
Change from v1: Updated commit message to highlight potential sparse warning. Song Liu (1): tcp: add tracepoint trace_tcp_retransmit_synack() include/trace/events/tcp.h | 56 ++ net/ipv4/tcp_output.c | 1 + 2 files changed, 57 insertions

[PATCH v2 net-next] tcp: add tracepoint trace_tcp_retransmit_synack()

2017-10-30 Thread Song Liu
these warnings. To the best of our knowledge, these warnings are harmless. Signed-off-by: Song Liu <songliubrav...@fb.com> Acked-by: Alexei Starovoitov <a...@kernel.org> Acked-by: Martin KaFai Lau <ka...@fb.com> --- include/trace/events/tcp.h | 56 ++

Re: [PATCH v5 3/6] perf: implement pmu perf_kprobe

2017-12-20 Thread Song Liu
> On Dec 20, 2017, at 2:14 AM, Peter Zijlstra <pet...@infradead.org> wrote: > > On Wed, Dec 20, 2017 at 11:03:01AM +0100, Peter Zijlstra wrote: >> On Wed, Dec 06, 2017 at 02:45:15PM -0800, Song Liu wrote: >>> @@ -8537,7 +8620,7 @@ static int perf_event_set_filter

Re: [PATCH v2 bpf-next 2/2] bpf: add selftest for stackmap with build_id in NMI context

2018-05-04 Thread Song Liu
Thanks Tobin. I will fold these changes in. > On May 3, 2018, at 12:19 AM, Tobin C. Harding <to...@apporbit.com> wrote: > > On Wed, May 02, 2018 at 04:20:30PM -0700, Song Liu wrote: >> This new test captures stackmap with build_id with hardware event >> PERF_COUNT_HW

Re: [PATCH bpf-next 6/6] bpf: btf: Tests for BPF_OBJ_GET_INFO_BY_FD and BPF_BTF_GET_FD_BY_ID

2018-05-08 Thread Song Liu
int test_num) > goto done; > } > > - user_btf_size = (int)raw_btf_size + test->info_size_delta; > + user_btf_size = (int)raw_btf_size + test->btf_size_delta; > expected_nbytes = min(raw_btf_size, user_btf_size); > if (raw_btf_size > expected_nbytes) > memset(user_btf + expected_nbytes, 0xff, > raw_btf_size - expected_nbytes); > > - err = bpf_obj_get_info_by_fd(btf_fd, user_btf, _btf_size); > - if (CHECK(err || user_btf_size != raw_btf_size || > - memcmp(raw_btf, user_btf, expected_nbytes), > - "err:%d(errno:%d) raw_btf_size:%u user_btf_size:%u > expected_nbytes:%u memcmp:%d", > - err, errno, > - raw_btf_size, user_btf_size, expected_nbytes, > - memcmp(raw_btf, user_btf, expected_nbytes))) { > + info_len = sizeof(info); > + info.btf = ptr_to_u64(user_btf); > + info.btf_size = user_btf_size; > + > + ret = 0; > + err = bpf_obj_get_info_by_fd(btf_fd, , _len); > + if (CHECK(err || !info.id || info_len != sizeof(info) || > + info.btf_size != raw_btf_size || > + (ret = memcmp(raw_btf, user_btf, expected_nbytes)), > + "err:%d errno:%d info.id:%u info_len:%u sizeof(info):%lu > raw_btf_size:%u info.btf_size:%u expected_nbytes:%u memcmp:%d", > + err, errno, info.id, info_len, sizeof(info), > + raw_btf_size, info.btf_size, expected_nbytes, ret)) { > err = -1; > goto done; > } > -- > 2.9.5 > Acked-by: Song Liu <songliubrav...@fb.com>

Re: [PATCH bpf-next 4/6] bpf: btf: Some test_btf clean up

2018-05-08 Thread Song Liu
f(expected_line), > + "expected_line is too long")) { > err = -1; > - fprintf(stderr, "expected_line is too long\n"); > goto done; > } > > @@ -1535,15 +1524,15 @@ static int test_pprint(void) > nread = getline(, _len, pin_file); > } while (++key < test->max_entries && nread > 0); > > - if (key < test->max_entries) { > + if (CHECK(key < test->max_entries, > + "Unexpected EOF. key:%u test->max_entries:%u", > + key, test->max_entries)) { > err = -1; > - fprintf(stderr, "Unexpected EOF\n"); > goto done; > } > > - if (nread > 0) { > + if (CHECK(nread > 0, "Unexpected extra pprint output: %s", line)) { > err = -1; > - fprintf(stderr, "Unexpected extra pprint output: %s\n", line); > goto done; > } > > @@ -1551,9 +1540,9 @@ static int test_pprint(void) > > done: > if (!err) > - fprintf(stderr, "OK\n"); > + fprintf(stderr, "OK"); > if (*btf_log_buf && (err || args.always_log)) > - fprintf(stderr, "%s\n", btf_log_buf); > + fprintf(stderr, "\n%s", btf_log_buf); > if (btf_fd != -1) > close(btf_fd); > if (map_fd != -1) > @@ -1634,6 +1623,12 @@ static int parse_args(int argc, char **argv) > return 0; > } > > +static void print_summary(void) > +{ > + fprintf(stderr, "PASS:%u SKIP:%u FAIL:%u\n", > + pass_cnt - skip_cnt, skip_cnt, error_cnt); > +} > + > int main(int argc, char **argv) > { > int err = 0; > @@ -1655,15 +1650,17 @@ int main(int argc, char **argv) > err |= test_file(); > > if (args.pprint_test) > - err |= test_pprint(); > + err |= count_result(test_pprint()); > > if (args.raw_test || args.get_info_test || args.file_test || > args.pprint_test) > - return err; > + goto done; > > err |= test_raw(); > err |= test_get_info(); > err |= test_file(); > > +done: > + print_summary(); > return err; > } > -- > 2.9.5 > Acked-by: Song Liu <songliubrav...@fb.com>

Re: [PATCH bpf-next 2/6] bpf: btf: Introduce BTF ID

2018-05-08 Thread Song Liu
info.btf_value_id = map->btf_value_id; > + } > + > if (bpf_map_is_dev_bound(map)) { > err = bpf_map_offload_info_fill(, map); > if (err) > @@ -2057,6 +2063,19 @@ static int bpf_btf_load(const union bpf_attr *attr) > return btf_new_fd(attr); > } > > +#define BPF_BTF_GET_FD_BY_ID_LAST_FIELD btf_id > + > +static int bpf_btf_get_fd_by_id(const union bpf_attr *attr) > +{ > + if (CHECK_ATTR(BPF_BTF_GET_FD_BY_ID)) > + return -EINVAL; > + > + if (!capable(CAP_SYS_ADMIN)) > + return -EPERM; > + > + return btf_get_fd_by_id(attr->btf_id); > +} > + > SYSCALL_DEFINE3(bpf, int, cmd, union bpf_attr __user *, uattr, unsigned int, > size) > { > union bpf_attr attr = {}; > @@ -2140,6 +2159,9 @@ SYSCALL_DEFINE3(bpf, int, cmd, union bpf_attr __user *, > uattr, unsigned int, siz > case BPF_BTF_LOAD: > err = bpf_btf_load(); > break; > + case BPF_BTF_GET_FD_BY_ID: > + err = bpf_btf_get_fd_by_id(); > + break; > default: > err = -EINVAL; > break; > -- > 2.9.5 > Acked-by: Song Liu <songliubrav...@fb.com>

Re: [PATCH bpf-next 1/6] bpf: btf: Avoid WARN_ON when CONFIG_REFCOUNT_FULL=y

2018-05-08 Thread Song Liu
env_free(env); > - btf_get(btf); > + refcount_set(>refcnt, 1); > return btf; > } > > -- > 2.9.5 > Acked-by: Song Liu <songliubrav...@fb.com>

Re: [PATCH bpf-next 3/6] bpf: btf: Add struct bpf_btf_info

2018-05-08 Thread Song Liu
r); > +} > + > #define BPF_OBJ_GET_INFO_BY_FD_LAST_FIELD info.info > > static int bpf_obj_get_info_by_fd(const union bpf_attr *attr, > @@ -2042,7 +2057,7 @@ static int bpf_obj_get_info_by_fd(const union bpf_attr > *attr, > err = bpf_map_get_info_by_fd(f.file->private_data, attr, >uattr); > else if (f.file->f_op == _fops) > - err = btf_get_info_by_fd(f.file->private_data, attr, uattr); > + err = bpf_btf_get_info_by_fd(f.file->private_data, attr, uattr); > else > err = -EINVAL; > > -- > 2.9.5 > Acked-by: Song Liu <songliubrav...@fb.com>

Re: [PATCH bpf-next 5/6] bpf: btf: Update tools/include/uapi/linux/btf.h with BTF ID

2018-05-08 Thread Song Liu
ed_u64 btf; > + __u32 btf_size; > + __u32 id; > } __attribute__((aligned(8))); > > /* User bpf_sock_addr struct to access socket fields and sockaddr struct > passed > -- > 2.9.5 > Acked-by: Song Liu <songliubrav...@fb.com>

[PATCH v3 bpf-next 1/2] bpf: enable stackmap with build_id in nmi context

2018-05-07 Thread Song Liu
riable for the irq_work. As a result, only one irq_work per cpu is allowed. If the irq_work is in-use, we fallback to only report ips. Cc: Alexei Starovoitov <a...@kernel.org> Cc: Daniel Borkmann <dan...@iogearbox.net> Cc: Peter Zijlstra <pet...@infradead.org> Signed-off-by: Song Liu <songl

[PATCH v3 bpf-next 0/2] bpf: enable stackmap with build_id in nmi

2018-05-07 Thread Song Liu
dd static to DEFINE_PER_CPU(); 5. Remove pr_info() in stack_map_init(). Song Liu (2): bpf: enable stackmap with build_id in nmi context bpf: add selftest for stackmap with build_id in NMI context init/Kconfig | 1 + kernel/bpf/stackmap.c

  1   2   3   4   >