[PATCH bpf-next v2] bpf: Allow bpf_current_task_under_cgroup in interrupt

2018-04-28 Thread Teng Qin
NMI (Perf Event) and some softirq context, the helper returns the correct result. Signed-off-by: Teng Qin --- kernel/trace/bpf_trace.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 56ba0f2..f94890c 100644 --- a/kernel/trace

[PATCH bpf-next] bpf: Allow bpf_current_task_under_cgroup in interrupt

2018-04-28 Thread Teng Qin
Currently, the bpf_current_task_under_cgroup helper has a check where if the BPF program is running in_interrupt(), it will return -EINVAL. This prevents the helper to be used in many useful scenarios, particularly BPF programs attached to Perf Events. This commit removes the check. Tested a few N

[PATCH bpf-next 0/2] bpf: add support for bpf program to read perf event sample address

2018-03-06 Thread Teng Qin
memory access or lock acquire pattern. Teng Qin (2): bpf: add support to read sample address in bpf program samples/bpf: add example to test reading address include/uapi/linux/bpf_perf_event.h | 1 + kernel/trace/bpf_trace.c| 20 samples/bpf

[PATCH bpf-next 1/2] bpf: add support to read sample address in bpf program

2018-03-06 Thread Teng Qin
en calling perf_event_open. Signed-off-by: Teng Qin --- include/uapi/linux/bpf_perf_event.h | 1 + kernel/trace/bpf_trace.c| 20 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/include/uapi/linux/bpf_perf_event.h b/include/uapi/linux/bpf_perf_eve

[PATCH bpf-next 2/2] samples/bpf: add example to test reading address

2018-03-06 Thread Teng Qin
This commit adds additional test in the trace_event example, by attaching the bpf program to MEM_UOPS_RETIRED.LOCK_LOADS event with PERF_SAMPLE_ADDR requested, and print the lock address value read from the bpf program to trace_pipe. Signed-off-by: Teng Qin --- samples/bpf/trace_event_kern.c

Re: [PATCH net-next] bpf: update perf event helper function signature and documentation

2017-05-22 Thread Teng Qin
On 5/22/17, 20:08, "David Miller" wrote: From: Teng Qin Date: Tue, 23 May 2017 00:39:34 + > diff --git a/samples/bpf/bpf_helpers.h b/samples/bpf/bpf_helpers.h > index 9a9c95f..a94ce42 100644 > --- a/samples/bpf/bpf_helpers.h > +++ b/sam

[PATCH net-next] bpf: update perf event helper function signature and documentation

2017-05-22 Thread Teng Qin
From: Teng Qin This commit updates function signature of the bpf_perf_event_output and bpf_perf_event_read helpers to match their implementation. Also updates their documentation in the header files. Signed-off-by: Teng Qin Acked-by: Alexei Starovoitov --- include/uapi/linux/bpf.h | 11