All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] compiler_types: Refactor the use of btf_type_tag attribute.
@ 2022-03-10 21:16 Hao Luo
  2022-03-10 22:43 ` Yonghong Song
  2022-03-11  3:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Hao Luo @ 2022-03-10 21:16 UTC (permalink / raw
  To: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann, yhs
  Cc: KP Singh, bpf, linux-kernel, Hao Luo

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(-)

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
-- 
2.35.1.723.g4982287a31-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] compiler_types: Refactor the use of btf_type_tag attribute.
  2022-03-10 21:16 [PATCH bpf-next] compiler_types: Refactor the use of btf_type_tag attribute Hao Luo
@ 2022-03-10 22:43 ` Yonghong Song
  2022-03-11  3:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Yonghong Song @ 2022-03-10 22:43 UTC (permalink / raw
  To: Hao Luo, Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann
  Cc: KP Singh, bpf, linux-kernel



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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] compiler_types: Refactor the use of btf_type_tag attribute.
  2022-03-10 21:16 [PATCH bpf-next] compiler_types: Refactor the use of btf_type_tag attribute Hao Luo
  2022-03-10 22:43 ` Yonghong Song
@ 2022-03-11  3:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-11  3:20 UTC (permalink / raw
  To: Hao Luo; +Cc: ast, andrii, daniel, yhs, kpsingh, bpf, linux-kernel

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!
-- 
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-03-11  3:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-10 21:16 [PATCH bpf-next] compiler_types: Refactor the use of btf_type_tag attribute Hao Luo
2022-03-10 22:43 ` Yonghong Song
2022-03-11  3:20 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.