diff mbox series

[bpf-next] compiler_types: Refactor the use of btf_type_tag attribute.

Message ID 20220310211655.3173786-1-haoluo@google.com (mailing list archive)
State Accepted
Commit 6789ab9668d920d7be636cb994d85be9a816f9d5
Delegated to: BPF
Headers show
Series [bpf-next] compiler_types: Refactor the use of btf_type_tag attribute. | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
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: 17981 this patch: 17981
netdev/cc_maintainers warning 8 maintainers not CCed: john.fastabend@gmail.com kafai@fb.com songliubraving@fb.com ojeda@kernel.org nathan@kernel.org keescook@chromium.org netdev@vger.kernel.org ndesaulniers@google.com
netdev/build_clang success Errors and warnings before: 3914 this patch: 3914
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 17597 this patch: 17597
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 34 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 success PR summary
bpf/vmtest-bpf-next success VM_Test

Commit Message

Hao Luo March 10, 2022, 9:16 p.m. UTC
Previous patches have introduced the compiler attribute btf_type_tag for
__user and __percpu. The availability of this attribute depends on
some CONFIGs and compiler support. This patch refactors the use
of btf_type_tag by introducing BTF_TYPE_TAG, which hides all the
dependencies.

No functional change.

Suggested-by: Andrii Nakryiko <andrii@kernel.org>
Cc: Yonghong Song <yhs@fb.com>
Signed-off-by: Hao Luo <haoluo@google.com>
---
 include/linux/compiler_types.h | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

Comments

Yonghong Song March 10, 2022, 10:43 p.m. UTC | #1
On 3/10/22 1:16 PM, Hao Luo wrote:
> Previous patches have introduced the compiler attribute btf_type_tag for
> __user and __percpu. The availability of this attribute depends on
> some CONFIGs and compiler support. This patch refactors the use
> of btf_type_tag by introducing BTF_TYPE_TAG, which hides all the
> dependencies.
> 
> No functional change.
> 
> Suggested-by: Andrii Nakryiko <andrii@kernel.org>
> Cc: Yonghong Song <yhs@fb.com>
> Signed-off-by: Hao Luo <haoluo@google.com>

LGTM. Thanks!

Acked-by: Yonghong Song <yhs@fb.com>
patchwork-bot+netdevbpf@kernel.org March 11, 2022, 3:20 a.m. UTC | #2
Hello:

This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Thu, 10 Mar 2022 13:16:55 -0800 you wrote:
> Previous patches have introduced the compiler attribute btf_type_tag for
> __user and __percpu. The availability of this attribute depends on
> some CONFIGs and compiler support. This patch refactors the use
> of btf_type_tag by introducing BTF_TYPE_TAG, which hides all the
> dependencies.
> 
> No functional change.
> 
> [...]

Here is the summary with links:
  - [bpf-next] compiler_types: Refactor the use of btf_type_tag attribute.
    https://git.kernel.org/bpf/bpf-next/c/6789ab9668d9

You are awesome, thank you!
diff mbox series

Patch

diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index b9a8ae9440c7..1bc760ba400c 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -4,6 +4,13 @@ 
 
 #ifndef __ASSEMBLY__
 
+#if defined(CONFIG_DEBUG_INFO_BTF) && defined(CONFIG_PAHOLE_HAS_BTF_TAG) && \
+	__has_attribute(btf_type_tag)
+# define BTF_TYPE_TAG(value) __attribute__((btf_type_tag(#value)))
+#else
+# define BTF_TYPE_TAG(value) /* nothing */
+#endif
+
 #ifdef __CHECKER__
 /* address spaces */
 # define __kernel	__attribute__((address_space(0)))
@@ -31,19 +38,11 @@  static inline void __chk_io_ptr(const volatile void __iomem *ptr) { }
 # define __kernel
 # ifdef STRUCTLEAK_PLUGIN
 #  define __user	__attribute__((user))
-# elif defined(CONFIG_DEBUG_INFO_BTF) && defined(CONFIG_PAHOLE_HAS_BTF_TAG) && \
-	__has_attribute(btf_type_tag)
-#  define __user	__attribute__((btf_type_tag("user")))
 # else
-#  define __user
+#  define __user	BTF_TYPE_TAG(user)
 # endif
 # define __iomem
-# if defined(CONFIG_DEBUG_INFO_BTF) && defined(CONFIG_PAHOLE_HAS_BTF_TAG) && \
-	__has_attribute(btf_type_tag)
-#  define __percpu	__attribute__((btf_type_tag("percpu")))
-# else
-#  define __percpu
-# endif
+# define __percpu	BTF_TYPE_TAG(percpu)
 # define __rcu
 # define __chk_user_ptr(x)	(void)0
 # define __chk_io_ptr(x)	(void)0