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 >

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-v2. > > Also, I found out

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

2018-05-25 Thread Alban Crequy
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-v2. Also, I found out how to get my containers to use both

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

2018-05-25 Thread Alban Crequy
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-v2. Also, I found out how to get my containers to use both cgroup-v1 and cgroup-v2 (by

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

2018-05-23 Thread Daniel Borkmann
On 05/23/2018 06:31 AM, Y Song wrote: > 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) >>> +

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

2018-05-23 Thread Daniel Borkmann
On 05/23/2018 06:31 AM, Y Song wrote: > 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

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] [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 reason :-) Originally I am

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

2018-05-22 Thread Alexei Starovoitov
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?

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

2018-05-22 Thread Alexei Starovoitov
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?

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

2018-05-22 Thread Y Song
I did a quick prototyping and the above interface seems working fine. The kernel change: === [yhs@localhost bpf-next]$ git diff diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 97446bbe2ca5..669b7383fddb 100644 --- a/include/uapi/linux/bpf.h +++

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

2018-05-22 Thread Y Song
I did a quick prototyping and the above interface seems working fine. The kernel change: === [yhs@localhost bpf-next]$ git diff diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 97446bbe2ca5..669b7383fddb 100644 --- a/include/uapi/linux/bpf.h +++

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

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

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

2018-05-21 Thread Alexei Starovoitov
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 cgroup *cgrp = task_cgroup(current, memory_cgrp_id); > + > + if

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

2018-05-21 Thread Alexei Starovoitov
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 cgroup *cgrp = task_cgroup(current, memory_cgrp_id); > + > + if

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

2018-05-21 Thread Alban Crequy
On Mon, May 14, 2018 at 9:38 PM, Y Song wrote: > > 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

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

2018-05-21 Thread Alban Crequy
On Mon, May 14, 2018 at 9:38 PM, Y Song wrote: > > 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

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

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.

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

2018-05-13 Thread Alban Crequy
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. I have a tracepoint on raw_syscalls/sys_enter

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

2018-05-13 Thread Alban Crequy
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. I have a tracepoint on raw_syscalls/sys_enter and a BPF map