* [PATCH bpf-next] selftests/bpf: Fix bpftool synctypes checking failure
@ 2022-10-26 16:30 Yonghong Song
2022-10-26 17:01 ` Quentin Monnet
2022-10-26 17:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Yonghong Song @ 2022-10-26 16:30 UTC (permalink / raw)
To: bpf; +Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann, kernel-team
kernel-patches/bpf failed with error:
Running bpftool checks...
Comparing /data/users/ast/net-next/tools/include/uapi/linux/bpf.h (bpf_map_type) and
/data/users/ast/net-next/tools/bpf/bpftool/map.c (do_help() TYPE):
{'cgroup_storage_deprecated', 'cgroup_storage'}
Comparing /data/users/ast/net-next/tools/include/uapi/linux/bpf.h (bpf_map_type) and
/data/users/ast/net-next/tools/bpf/bpftool/Documentation/bpftool-map.rst (TYPE):
{'cgroup_storage_deprecated', 'cgroup_storage'}
The selftests/bpf/test_bpftool_synctypes.py runs checking in the above.
The failure is introduced by Commit c4bcfb38a95e("bpf: Implement cgroup storage available
to non-cgroup-attached bpf progs"). The commit introduced BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED
which has the same enum value as BPF_MAP_TYPE_CGROUP_STORAGE.
In test_bpftool_synctypes.py, one test is to compare uapi bpf.h map types and
bpftool supported maps. The tool picks 'cgroup_storage_deprecated' from bpf.h
while bpftool supported map is displayed as 'cgroup_storage'. The test failure
can be fixed by explicitly replacing 'cgroup_storage_deprecated' with 'cgroup_storage'
in uapi bpf.h map types.
Signed-off-by: Yonghong Song <yhs@fb.com>
---
tools/testing/selftests/bpf/test_bpftool_synctypes.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/testing/selftests/bpf/test_bpftool_synctypes.py b/tools/testing/selftests/bpf/test_bpftool_synctypes.py
index a6410bebe603..9fe4c9336c6f 100755
--- a/tools/testing/selftests/bpf/test_bpftool_synctypes.py
+++ b/tools/testing/selftests/bpf/test_bpftool_synctypes.py
@@ -501,6 +501,14 @@ def main():
source_map_types = set(bpf_info.get_map_type_map().values())
source_map_types.discard('unspec')
+ # BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED and BPF_MAP_TYPE_CGROUP_STORAGE
+ # share the same enum value and source_map_types picks
+ # BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED/cgroup_storage_deprecated.
+ # Replace 'cgroup_storage_deprecated' with 'cgroup_storage'
+ # so it aligns with what `bpftool map help` shows.
+ source_map_types.remove('cgroup_storage_deprecated')
+ source_map_types.add('cgroup_storage')
+
help_map_types = map_info.get_map_help()
help_map_options = map_info.get_options()
map_info.close()
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH bpf-next] selftests/bpf: Fix bpftool synctypes checking failure
2022-10-26 16:30 [PATCH bpf-next] selftests/bpf: Fix bpftool synctypes checking failure Yonghong Song
@ 2022-10-26 17:01 ` Quentin Monnet
2022-10-26 17:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Quentin Monnet @ 2022-10-26 17:01 UTC (permalink / raw)
To: Yonghong Song, bpf
Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann, kernel-team
2022-10-26 09:30 UTC-0700 ~ Yonghong Song <yhs@fb.com>
> kernel-patches/bpf failed with error:
> Running bpftool checks...
> Comparing /data/users/ast/net-next/tools/include/uapi/linux/bpf.h (bpf_map_type) and
> /data/users/ast/net-next/tools/bpf/bpftool/map.c (do_help() TYPE):
> {'cgroup_storage_deprecated', 'cgroup_storage'}
> Comparing /data/users/ast/net-next/tools/include/uapi/linux/bpf.h (bpf_map_type) and
> /data/users/ast/net-next/tools/bpf/bpftool/Documentation/bpftool-map.rst (TYPE):
> {'cgroup_storage_deprecated', 'cgroup_storage'}
> The selftests/bpf/test_bpftool_synctypes.py runs checking in the above.
>
> The failure is introduced by Commit c4bcfb38a95e("bpf: Implement cgroup storage available
> to non-cgroup-attached bpf progs"). The commit introduced BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED
> which has the same enum value as BPF_MAP_TYPE_CGROUP_STORAGE.
>
> In test_bpftool_synctypes.py, one test is to compare uapi bpf.h map types and
> bpftool supported maps. The tool picks 'cgroup_storage_deprecated' from bpf.h
> while bpftool supported map is displayed as 'cgroup_storage'. The test failure
> can be fixed by explicitly replacing 'cgroup_storage_deprecated' with 'cgroup_storage'
> in uapi bpf.h map types.
>
> Signed-off-by: Yonghong Song <yhs@fb.com>
> ---
> tools/testing/selftests/bpf/test_bpftool_synctypes.py | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/test_bpftool_synctypes.py b/tools/testing/selftests/bpf/test_bpftool_synctypes.py
> index a6410bebe603..9fe4c9336c6f 100755
> --- a/tools/testing/selftests/bpf/test_bpftool_synctypes.py
> +++ b/tools/testing/selftests/bpf/test_bpftool_synctypes.py
> @@ -501,6 +501,14 @@ def main():
> source_map_types = set(bpf_info.get_map_type_map().values())
> source_map_types.discard('unspec')
>
> + # BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED and BPF_MAP_TYPE_CGROUP_STORAGE
> + # share the same enum value and source_map_types picks
> + # BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED/cgroup_storage_deprecated.
> + # Replace 'cgroup_storage_deprecated' with 'cgroup_storage'
> + # so it aligns with what `bpftool map help` shows.
> + source_map_types.remove('cgroup_storage_deprecated')
> + source_map_types.add('cgroup_storage')
> +
> help_map_types = map_info.get_map_help()
> help_map_options = map_info.get_options()
> map_info.close()
It does fix the script. Thanks!
If anyone wonders about the difference about .discard() (used just
above) and .remove(), the latter returns an error if the element to
remove is not present in the set. Here we do expect to find it, so
.remove() looks good.
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH bpf-next] selftests/bpf: Fix bpftool synctypes checking failure
2022-10-26 16:30 [PATCH bpf-next] selftests/bpf: Fix bpftool synctypes checking failure Yonghong Song
2022-10-26 17:01 ` Quentin Monnet
@ 2022-10-26 17:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-10-26 17:10 UTC (permalink / raw)
To: Yonghong Song; +Cc: bpf, ast, andrii, daniel, kernel-team
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Wed, 26 Oct 2022 09:30:14 -0700 you wrote:
> kernel-patches/bpf failed with error:
> Running bpftool checks...
> Comparing /data/users/ast/net-next/tools/include/uapi/linux/bpf.h (bpf_map_type) and
> /data/users/ast/net-next/tools/bpf/bpftool/map.c (do_help() TYPE):
> {'cgroup_storage_deprecated', 'cgroup_storage'}
> Comparing /data/users/ast/net-next/tools/include/uapi/linux/bpf.h (bpf_map_type) and
> /data/users/ast/net-next/tools/bpf/bpftool/Documentation/bpftool-map.rst (TYPE):
> {'cgroup_storage_deprecated', 'cgroup_storage'}
> The selftests/bpf/test_bpftool_synctypes.py runs checking in the above.
>
> [...]
Here is the summary with links:
- [bpf-next] selftests/bpf: Fix bpftool synctypes checking failure
https://git.kernel.org/bpf/bpf-next/c/d96d4276eaeb
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-26 17:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-26 16:30 [PATCH bpf-next] selftests/bpf: Fix bpftool synctypes checking failure Yonghong Song
2022-10-26 17:01 ` Quentin Monnet
2022-10-26 17:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox