* [PATCH bpf-next] bpf: simplify cases in bpf_base_func_proto
@ 2021-01-27 17:46 Tobias Klauser
2021-01-29 1:30 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Tobias Klauser @ 2021-01-27 17:46 UTC (permalink / raw)
To: bpf, netdev, Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko
Cc: John Fastabend, Martin KaFai Lau, Song Liu, Yonghong Song,
KP Singh, Stanislav Fomichev
!perfmon_capable() is checked before the last switch(func_id) in
bpf_base_func_proto. Thus, the cases BPF_FUNC_trace_printk and
BPF_FUNC_snprintf_btf can be moved to that last switch(func_id) to omit
the inline !perfmon_capable() checks.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
kernel/bpf/helpers.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index 41ca280b1dc1..308427fe03a3 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -720,14 +720,6 @@ bpf_base_func_proto(enum bpf_func_id func_id)
return &bpf_spin_lock_proto;
case BPF_FUNC_spin_unlock:
return &bpf_spin_unlock_proto;
- case BPF_FUNC_trace_printk:
- if (!perfmon_capable())
- return NULL;
- return bpf_get_trace_printk_proto();
- case BPF_FUNC_snprintf_btf:
- if (!perfmon_capable())
- return NULL;
- return &bpf_snprintf_btf_proto;
case BPF_FUNC_jiffies64:
return &bpf_jiffies64_proto;
case BPF_FUNC_per_cpu_ptr:
@@ -742,6 +734,8 @@ bpf_base_func_proto(enum bpf_func_id func_id)
return NULL;
switch (func_id) {
+ case BPF_FUNC_trace_printk:
+ return bpf_get_trace_printk_proto();
case BPF_FUNC_get_current_task:
return &bpf_get_current_task_proto;
case BPF_FUNC_probe_read_user:
@@ -752,6 +746,8 @@ bpf_base_func_proto(enum bpf_func_id func_id)
return &bpf_probe_read_user_str_proto;
case BPF_FUNC_probe_read_kernel_str:
return &bpf_probe_read_kernel_str_proto;
+ case BPF_FUNC_snprintf_btf:
+ return &bpf_snprintf_btf_proto;
default:
return NULL;
}
--
2.30.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH bpf-next] bpf: simplify cases in bpf_base_func_proto
2021-01-27 17:46 [PATCH bpf-next] bpf: simplify cases in bpf_base_func_proto Tobias Klauser
@ 2021-01-29 1:30 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-01-29 1:30 UTC (permalink / raw)
To: Tobias Klauser
Cc: bpf, netdev, daniel, ast, andrii, john.fastabend, kafai,
songliubraving, yhs, kpsingh, sdf
Hello:
This patch was applied to bpf/bpf-next.git (refs/heads/master):
On Wed, 27 Jan 2021 18:46:15 +0100 you wrote:
> !perfmon_capable() is checked before the last switch(func_id) in
> bpf_base_func_proto. Thus, the cases BPF_FUNC_trace_printk and
> BPF_FUNC_snprintf_btf can be moved to that last switch(func_id) to omit
> the inline !perfmon_capable() checks.
>
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
>
> [...]
Here is the summary with links:
- [bpf-next] bpf: simplify cases in bpf_base_func_proto
https://git.kernel.org/bpf/bpf-next/c/61ca36c8c4eb
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] 2+ messages in thread
end of thread, other threads:[~2021-01-29 1:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-27 17:46 [PATCH bpf-next] bpf: simplify cases in bpf_base_func_proto Tobias Klauser
2021-01-29 1:30 ` 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;
as well as URLs for NNTP newsgroup(s).