diff mbox series

[bpf-next,v2,3/6] libbpf: Support new cgroup local storage

Message ID 20221020221311.3554642-1-yhs@fb.com (mailing list archive)
State Superseded
Delegated to: BPF
Headers show
Series bpf: Implement cgroup local storage available to non-cgroup-attached bpf progs | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for bpf-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 6 maintainers not CCed: sdf@google.com john.fastabend@gmail.com haoluo@google.com jolsa@kernel.org song@kernel.org martin.lau@linux.dev
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next-PR fail PR summary
bpf/vmtest-bpf-next-VM_Test-4 success Logs for llvm-toolchain
bpf/vmtest-bpf-next-VM_Test-5 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-2 success Logs for build for x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-3 success Logs for build for x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-1 success Logs for build for s390x with gcc
bpf/vmtest-bpf-next-VM_Test-16 fail Logs for test_verifier on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-17 fail Logs for test_verifier on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-7 fail Logs for test_maps on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-8 fail Logs for test_maps on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-10 fail Logs for test_progs on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-11 fail Logs for test_progs on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-13 fail Logs for test_progs_no_alu32 on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-14 fail Logs for test_progs_no_alu32 on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-9 fail Logs for test_progs on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-12 fail Logs for test_progs_no_alu32 on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-15 fail Logs for test_verifier on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-6 fail Logs for test_maps on s390x with gcc

Commit Message

Yonghong Song Oct. 20, 2022, 10:13 p.m. UTC
Add support for new cgroup local storage.

Signed-off-by: Yonghong Song <yhs@fb.com>
---
 tools/lib/bpf/libbpf.c        | 1 +
 tools/lib/bpf/libbpf_probes.c | 1 +
 2 files changed, 2 insertions(+)

Comments

Andrii Nakryiko Oct. 21, 2022, 11:10 p.m. UTC | #1
On Thu, Oct 20, 2022 at 3:13 PM Yonghong Song <yhs@fb.com> wrote:
>
> Add support for new cgroup local storage.
>
> Signed-off-by: Yonghong Song <yhs@fb.com>
> ---


LGTM, but I do think that BPF_MAP_TYPE_CG_STORAGE and "cg_storage" is
easier to read and talk about. But that's minor.

Acked-by: Andrii Nakryiko <andrii@kernel.org>

>  tools/lib/bpf/libbpf.c        | 1 +
>  tools/lib/bpf/libbpf_probes.c | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 027fd9565c16..5d7819edf074 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -164,6 +164,7 @@ static const char * const map_type_name[] = {
>         [BPF_MAP_TYPE_TASK_STORAGE]             = "task_storage",
>         [BPF_MAP_TYPE_BLOOM_FILTER]             = "bloom_filter",
>         [BPF_MAP_TYPE_USER_RINGBUF]             = "user_ringbuf",
> +       [BPF_MAP_TYPE_CGRP_STORAGE]             = "cgrp_storage",
>  };
>
>  static const char * const prog_type_name[] = {
> diff --git a/tools/lib/bpf/libbpf_probes.c b/tools/lib/bpf/libbpf_probes.c
> index f3a8e8e74eb8..bdb83d467f9a 100644
> --- a/tools/lib/bpf/libbpf_probes.c
> +++ b/tools/lib/bpf/libbpf_probes.c
> @@ -221,6 +221,7 @@ static int probe_map_create(enum bpf_map_type map_type)
>         case BPF_MAP_TYPE_SK_STORAGE:
>         case BPF_MAP_TYPE_INODE_STORAGE:
>         case BPF_MAP_TYPE_TASK_STORAGE:
> +       case BPF_MAP_TYPE_CGRP_STORAGE:
>                 btf_key_type_id = 1;
>                 btf_value_type_id = 3;
>                 value_size = 8;
> --
> 2.30.2
>
Yonghong Song Oct. 22, 2022, 12:32 a.m. UTC | #2
On 10/21/22 4:10 PM, Andrii Nakryiko wrote:
> On Thu, Oct 20, 2022 at 3:13 PM Yonghong Song <yhs@fb.com> wrote:
>>
>> Add support for new cgroup local storage.
>>
>> Signed-off-by: Yonghong Song <yhs@fb.com>
>> ---
> 
> 
> LGTM, but I do think that BPF_MAP_TYPE_CG_STORAGE and "cg_storage" is
> easier to read and talk about. But that's minor.

I searched kernel/cgroup/* and kernel/bpf/cgroup.c and 
include/linux/cgroup*.h. The 'cgrp' for abbreviation of 'cgroup' is much 
more than
'cg' for 'cgroup' unless 'cg' appears in like 'memcg' or 'rdmacg'. So I 
would just use 'cgrp' for now.

> 
> Acked-by: Andrii Nakryiko <andrii@kernel.org>
> 
>>   tools/lib/bpf/libbpf.c        | 1 +
>>   tools/lib/bpf/libbpf_probes.c | 1 +
>>   2 files changed, 2 insertions(+)
>>
>> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
>> index 027fd9565c16..5d7819edf074 100644
>> --- a/tools/lib/bpf/libbpf.c
>> +++ b/tools/lib/bpf/libbpf.c
>> @@ -164,6 +164,7 @@ static const char * const map_type_name[] = {
>>          [BPF_MAP_TYPE_TASK_STORAGE]             = "task_storage",
>>          [BPF_MAP_TYPE_BLOOM_FILTER]             = "bloom_filter",
>>          [BPF_MAP_TYPE_USER_RINGBUF]             = "user_ringbuf",
>> +       [BPF_MAP_TYPE_CGRP_STORAGE]             = "cgrp_storage",
>>   };
>>
>>   static const char * const prog_type_name[] = {
>> diff --git a/tools/lib/bpf/libbpf_probes.c b/tools/lib/bpf/libbpf_probes.c
>> index f3a8e8e74eb8..bdb83d467f9a 100644
>> --- a/tools/lib/bpf/libbpf_probes.c
>> +++ b/tools/lib/bpf/libbpf_probes.c
>> @@ -221,6 +221,7 @@ static int probe_map_create(enum bpf_map_type map_type)
>>          case BPF_MAP_TYPE_SK_STORAGE:
>>          case BPF_MAP_TYPE_INODE_STORAGE:
>>          case BPF_MAP_TYPE_TASK_STORAGE:
>> +       case BPF_MAP_TYPE_CGRP_STORAGE:
>>                  btf_key_type_id = 1;
>>                  btf_value_type_id = 3;
>>                  value_size = 8;
>> --
>> 2.30.2
>>
Tejun Heo Oct. 22, 2022, 1:05 a.m. UTC | #3
Hello,

On Fri, Oct 21, 2022 at 05:32:58PM -0700, Yonghong Song wrote:
> > LGTM, but I do think that BPF_MAP_TYPE_CG_STORAGE and "cg_storage" is
> > easier to read and talk about. But that's minor.
> 
> I searched kernel/cgroup/* and kernel/bpf/cgroup.c and
> include/linux/cgroup*.h. The 'cgrp' for abbreviation of 'cgroup' is much
> more than
> 'cg' for 'cgroup' unless 'cg' appears in like 'memcg' or 'rdmacg'. So I
> would just use 'cgrp' for now.

Yeah, cgrp is more consistent for prefixes and variable names. cg is usually
used as a part of an abbreviated word - memcg, blkcg, cgid and so on.

Thanks.
diff mbox series

Patch

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 027fd9565c16..5d7819edf074 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -164,6 +164,7 @@  static const char * const map_type_name[] = {
 	[BPF_MAP_TYPE_TASK_STORAGE]		= "task_storage",
 	[BPF_MAP_TYPE_BLOOM_FILTER]		= "bloom_filter",
 	[BPF_MAP_TYPE_USER_RINGBUF]             = "user_ringbuf",
+	[BPF_MAP_TYPE_CGRP_STORAGE]		= "cgrp_storage",
 };
 
 static const char * const prog_type_name[] = {
diff --git a/tools/lib/bpf/libbpf_probes.c b/tools/lib/bpf/libbpf_probes.c
index f3a8e8e74eb8..bdb83d467f9a 100644
--- a/tools/lib/bpf/libbpf_probes.c
+++ b/tools/lib/bpf/libbpf_probes.c
@@ -221,6 +221,7 @@  static int probe_map_create(enum bpf_map_type map_type)
 	case BPF_MAP_TYPE_SK_STORAGE:
 	case BPF_MAP_TYPE_INODE_STORAGE:
 	case BPF_MAP_TYPE_TASK_STORAGE:
+	case BPF_MAP_TYPE_CGRP_STORAGE:
 		btf_key_type_id = 1;
 		btf_value_type_id = 3;
 		value_size = 8;