Re: possible deadlock in perf_event_detach_bpf_prog

2018-04-08 Thread Y Song
On Thu, Mar 29, 2018 at 2:18 PM, Daniel Borkmann wrote: > On 03/29/2018 11:04 PM, syzbot wrote: >> Hello, >> >> syzbot hit the following crash on upstream commit >> 3eb2ce825ea1ad89d20f7a3b5780df850e4be274 (Sun Mar 25 22:44:30 2018 +) >> Linux 4.16-rc7 >> syzbot dashboard link: >> https://syz

Re: [PATCH bpf] bpf: allocate local storage buffers using GFP_ATOMIC

2018-11-16 Thread Y Song
On Wed, Nov 14, 2018 at 6:01 PM Roman Gushchin wrote: > > Naresh reported an issue with the non-atomic memory allocation of > cgroup local storage buffers: > > [ 73.047526] BUG: sleeping function called from invalid context at > /srv/oe/build/tmp-rpb-glibc/work-shared/intel-corei7-64/kernel-sour

Re: [PATCH 2/4] net/bpf: refactor freeing of executable allocations

2018-11-18 Thread Y Song
On Sun, Nov 18, 2018 at 3:55 PM Ard Biesheuvel wrote: > > On Sat, 17 Nov 2018 at 23:47, Y Song wrote: > > > > On Sat, Nov 17, 2018 at 6:58 PM Ard Biesheuvel > > wrote: > > > > > > All arch overrides of the __weak bpf_jit_free() amount to the same &

Re: [PATCH] [RFC] bpf: tracing: new helper bpf_get_current_cgroup_ino

2018-05-25 Thread Y Song
On Fri, May 25, 2018 at 8:21 AM, Alban Crequy wrote: > On Wed, May 23, 2018 at 4:34 AM Y Song wrote: > >> I did a quick prototyping and the above interface seems working fine. > > Thanks! I gave your kernel patch & userspace program a try and it works for > me on cgroup-

Re: [PATCH] [RFC] bpf: tracing: new helper bpf_get_current_cgroup_ino

2018-05-14 Thread Y Song
On Sun, May 13, 2018 at 10:33 AM, Alban Crequy wrote: > From: Alban Crequy > > bpf_get_current_cgroup_ino() allows BPF trace programs to get the inode > of the cgroup where the current process resides. > > My use case is to get statistics about syscalls done by a specific > Kubernetes container.

Re: [PATCH v3 1/2] media: rc: introduce BPF_PROG_RAWIR_EVENT

2018-05-17 Thread Y Song
On Wed, May 16, 2018 at 2:04 PM, Sean Young wrote: > Add support for BPF_PROG_RAWIR_EVENT. This type of BPF program can call > rc_keydown() to reported decoded IR scancodes, or rc_repeat() to report > that the last key should be repeated. > > The bpf program can be attached to using the bpf(BPF_PR

Re: [PATCH v3 2/2] bpf: add selftest for rawir_event type program

2018-05-17 Thread Y Song
On Wed, May 16, 2018 at 2:04 PM, Sean Young wrote: > This is simple test over rc-loopback. > > Signed-off-by: Sean Young > --- > tools/bpf/bpftool/prog.c | 1 + > tools/include/uapi/linux/bpf.h| 57 +++- > tools/lib/bpf/libbpf.c

Re: [PATCH v3 1/2] media: rc: introduce BPF_PROG_RAWIR_EVENT

2018-05-17 Thread Y Song
On Thu, May 17, 2018 at 2:45 PM, Sean Young wrote: > Hi, > > Again thanks for a thoughtful review. This will definitely will improve > the code. > > On Thu, May 17, 2018 at 10:02:52AM -0700, Y Song wrote: >> On Wed, May 16, 2018 at 2:04 PM, Sean Young wro

Re: [PATCH v4 1/3] bpf: bpf_prog_array_copy() should return -ENOENT if exclude_prog not found

2018-05-18 Thread Y Song
On Fri, May 18, 2018 at 7:07 AM, Sean Young wrote: > This makes is it possible for bpf prog detach to return -ENOENT. > > Signed-off-by: Sean Young Acked-by: Yonghong Song

Re: [PATCH v4 2/3] media: rc: introduce BPF_PROG_LIRC_MODE2

2018-05-18 Thread Y Song
On Fri, May 18, 2018 at 7:07 AM, Sean Young wrote: > Add support for BPF_PROG_LIRC_MODE2. This type of BPF program can call > rc_keydown() to reported decoded IR scancodes, or rc_repeat() to report > that the last key should be repeated. > > The bpf program can be attached to using the bpf(BPF_PRO

Re: [PATCH v4 3/3] bpf: add selftest for lirc_mode2 type program

2018-05-18 Thread Y Song
On Fri, May 18, 2018 at 7:07 AM, Sean Young wrote: > This is simple test over rc-loopback. > > Signed-off-by: Sean Young Acked-by: Yonghong Song > --- > tools/bpf/bpftool/prog.c | 1 + > tools/include/uapi/linux/bpf.h| 53 - > tools/include/uapi/lin

Re: [PATCH v4 3/3] bpf: add selftest for lirc_mode2 type program

2018-05-18 Thread Y Song
On Fri, May 18, 2018 at 1:17 PM, Y Song wrote: > On Fri, May 18, 2018 at 7:07 AM, Sean Young wrote: >> This is simple test over rc-loopback. >> >> Signed-off-by: Sean Young > > Acked-by: Yonghong Song Just one minor thing. You need to add "test_lirc_mode2_user

Re: [PATCH] [RFC] bpf: tracing: new helper bpf_get_current_cgroup_ino

2018-05-22 Thread Y Song
anosleep cgid = 106b2 ^C[yhs@localhost tools]$ The kernel and user space cgid matches. Will provide a formal patch later. On Mon, May 21, 2018 at 5:24 PM, Y Song wrote: > On Mon, May 21, 2018 at 9:26 AM, Alexei Starovoitov > wrote: >> On Sun, May 13, 2018 at 07:33:18PM +0200,

Re: [PATCH] [RFC] bpf: tracing: new helper bpf_get_current_cgroup_ino

2018-05-22 Thread Y Song
On Tue, May 22, 2018 at 8:35 PM, Alexei Starovoitov wrote: > On Tue, May 22, 2018 at 08:33:24PM -0700, Y Song wrote: >> + struct cgroup *cgrp = task_dfl_cgroup(current); >> + if (!cgrp) >> + return -EINVAL; > > why this check is needed? No

Re: [PATCH v1 1/4] media: rc: introduce BPF_PROG_IR_DECODER

2018-05-14 Thread Y Song
On Mon, May 14, 2018 at 2:10 PM, Sean Young wrote: > Add support for BPF_PROG_IR_DECODER. This type of BPF program can call > rc_keydown() to reported decoded IR scancodes, or rc_repeat() to report > that the last key should be repeated. > > Signed-off-by: Sean Young > --- > drivers/media/rc/Kco

Re: [PATCH v1 2/4] media: bpf: allow raw IR decoder bpf programs to be used

2018-05-14 Thread Y Song
On Mon, May 14, 2018 at 2:10 PM, Sean Young wrote: > This implements attaching, detaching, querying and execution. The target > fd has to be the /dev/lircN device. > > Signed-off-by: Sean Young > --- > drivers/media/rc/ir-bpf-decoder.c | 191 ++ > drivers/media/rc/lir

Re: [PATCH v1 3/4] media: rc bpf: move ir_raw_event to uapi

2018-05-14 Thread Y Song
On Mon, May 14, 2018 at 2:11 PM, Sean Young wrote: > The context provided to a BPF_PROG_RAWIR_DECODER is a struct ir_raw_event; > ensure user space has a a definition. > > Signed-off-by: Sean Young > --- > include/media/rc-core.h| 19 +-- > include/uapi/linux/bpf_rcdev.h

Re: [PATCH v1 4/4] samples/bpf: an example of a raw IR decoder

2018-05-14 Thread Y Song
On Mon, May 14, 2018 at 2:11 PM, Sean Young wrote: > This implements the grundig-16 IR protocol. > > Signed-off-by: Sean Young > --- > samples/bpf/Makefile | 4 + > samples/bpf/bpf_load.c| 9 +- > samples/bpf/grundig_decoder_kern.c| 112 ++

Re: bpf: BPF_PROG_TEST_RUN leads to unkillable process

2019-02-04 Thread Y Song
On Mon, Feb 4, 2019 at 9:49 AM Stanislav Fomichev wrote: > > On 02/01, Dmitry Vyukov wrote: > > Hello, > > > > The following program leads to an unkillable process that eats CPU in > > an infinite loop in BPF_PROG_TEST_RUN syscall. But kernel does not > > self-detect cpu/rcu/task stalls either. Th

Re: [PATCH bpf-next v4 1/4] bpf: sock ops: add netns ino and dev in bpf context

2019-05-24 Thread Y Song
to change, this code would need > to be updated too. > > Co-authored-by: Iago López Galeiras > Signed-off-by: Alban Crequy > Signed-off-by: Iago López Galeiras > > --- > > Changes since v1: > - add netns_dev (review from Alexei) > > Changes since v2: > - replace

Re: [PATCH v2] tools/bpf: fix perf build error with uClibc (seen on ARC)

2019-05-02 Thread Y Song
^~~~ > | sys_bpf > > Signed-off-by: Vineet Gupta Acked-by: Yonghong Song > --- > v1 -> v2 > - Only add syscall nr for ARC, as asm-generic won't work with arm/sh [Y > Song] > --- > tools/lib/bpf/bpf.c | 2 ++ > 1 file c

Re: [PATCH bpf-next RFC v3 2/6] bpf: add BPF_MAP_DUMP command to dump more than one entry per call

2019-07-05 Thread Y Song
On Wed, Jul 3, 2019 at 10:03 AM Brian Vazquez wrote: > > This introduces a new command to retrieve a variable number of entries > from a bpf map wrapping the existing bpf methods: > map_get_next_key and map_lookup_elem > > To start dumping the map from the beginning you must specify NULL as > the

Re: [PATCH V2] bpf: fix warning about using plain integer as NULL

2019-03-07 Thread Y Song
On Thu, Mar 7, 2019 at 10:12 PM Bo YU wrote: > > Sparse warning below: > > sudo make C=2 CF=-D__CHECK_ENDIAN__ M=net/bpf/ > CHECK net/bpf//test_run.c > net/bpf//test_run.c:19:77: warning: Using plain integer as NULL pointer > ./include/linux/bpf-cgroup.h:295:77: warning: Using plain integer as N

Re: [PATCH] [RFC] bpf: tracing: new helper bpf_get_current_cgroup_ino

2018-05-21 Thread Y Song
On Mon, May 21, 2018 at 9:26 AM, Alexei Starovoitov wrote: > On Sun, May 13, 2018 at 07:33:18PM +0200, Alban Crequy wrote: >> >> +BPF_CALL_2(bpf_get_current_cgroup_ino, u32, hierarchy, u64, flags) >> +{ >> + // TODO: pick the correct hierarchy instead of the mem controller >> + struct cgro

Re: [iovisor-dev] [PATCH v3 net-next 00/12] bpf: rewrite value tracking in verifier

2017-07-14 Thread Y Song
I did an experiment with one of our internal bpf programs. The program has 1563 insns. Without Edward's patch: processed 13634 insns, stack depth 160 With Edward's patch: processed 15807 insns, stack depth 160 So the number of processed insns regressed by roughly 16%. Did anybody do any similar

Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-07 Thread Y Song
On Tue, Nov 7, 2017 at 12:37 AM, Naveen N. Rao wrote: > Alexei Starovoitov wrote: >> >> On 11/7/17 12:55 AM, Naveen N. Rao wrote: I thought such struct shouldn't change layout. If it is we need to fix include/linux/compiler-clang.h to do that anon struct as well. >>> >>> >>> We

Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-07 Thread Y Song
On Tue, Nov 7, 2017 at 1:31 PM, Atish Patra wrote: > On 11/07/2017 03:14 PM, Y Song wrote: >> >> On Tue, Nov 7, 2017 at 12:37 AM, Naveen N. Rao >> wrote: >>> >>> Alexei Starovoitov wrote: >>>> >>>> >>>> On 11/7/1

Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-07 Thread Y Song
On Tue, Nov 7, 2017 at 1:39 PM, Alexei Starovoitov wrote: > On 11/8/17 6:14 AM, Y Song wrote: >> >> On Tue, Nov 7, 2017 at 12:37 AM, Naveen N. Rao >> wrote: >>> >>> Alexei Starovoitov wrote: >>>> >>>> >>>> On 11/7/1

Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-07 Thread Y Song
On Tue, Nov 7, 2017 at 2:04 PM, Alexei Starovoitov wrote: > On 11/8/17 6:47 AM, Y Song wrote: >> >> On Tue, Nov 7, 2017 at 1:39 PM, Alexei Starovoitov wrote: >>> >>> On 11/8/17 6:14 AM, Y Song wrote: >>>> >>>> >&g

Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-07 Thread Y Song
On Tue, Nov 7, 2017 at 4:29 PM, Atish Patra wrote: > On 11/07/2017 04:42 PM, Y Song wrote: >> >> On Tue, Nov 7, 2017 at 2:04 PM, Alexei Starovoitov wrote: >>> >>> On 11/8/17 6:47 AM, Y Song wrote: >>>> >>>> >>>> On Tue, Nov 7,