From: Alan Maguire <alan.maguire@oracle.com>
To: rostedt@goodmis.org, mingo@redhat.com, ast@kernel.org,
daniel@iogearbox.net
Cc: kafai@fb.com, songliubraving@fb.com, yhs@fb.com, andriin@fb.com,
john.fastabend@gmail.com, kpsingh@chromium.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
bpf@vger.kernel.org, Alan Maguire <alan.maguire@oracle.com>
Subject: [PATCH bpf-next 0/2] bpf: fix use of trace_printk() in BPF
Date: Fri, 3 Jul 2020 15:44:26 +0100 [thread overview]
Message-ID: <1593787468-29931-1-git-send-email-alan.maguire@oracle.com> (raw)
Steven suggested a way to resolve the appearance of the warning banner
that appears as a result of using trace_printk() in BPF [1].
Applying the patch and testing reveals all works as expected; we
can call bpf_trace_printk() and see the trace messages in
/sys/kernel/debug/tracing/trace_pipe and no banner message appears.
Also add a test prog to verify basic bpf_trace_printk() helper behaviour.
Possible future work: ftrace supports trace instances, and one thing
that strikes me is that we could make use of these in BPF to separate
BPF program bpf_trace_printk() output from output of other tracing
activities.
I was thinking something like a sysctl net.core.bpf_trace_instance,
defaulting to an empty value signifying we use the root trace
instance. This would preserve existing behaviour while giving a
way to separate BPF tracing output from other tracing output if wanted.
[1] https://lore.kernel.org/r/20200628194334.6238b933@oasis.local.home
Alan Maguire (2):
bpf: use dedicated bpf_trace_printk event instead of trace_printk()
selftests/bpf: add selftests verifying bpf_trace_printk() behaviour
kernel/trace/Makefile | 2 +
kernel/trace/bpf_trace.c | 41 +++++++++++--
kernel/trace/bpf_trace.h | 34 +++++++++++
.../selftests/bpf/prog_tests/trace_printk.c | 71 ++++++++++++++++++++++
tools/testing/selftests/bpf/progs/trace_printk.c | 21 +++++++
5 files changed, 165 insertions(+), 4 deletions(-)
create mode 100644 kernel/trace/bpf_trace.h
create mode 100644 tools/testing/selftests/bpf/prog_tests/trace_printk.c
create mode 100644 tools/testing/selftests/bpf/progs/trace_printk.c
--
1.8.3.1
next reply other threads:[~2020-07-03 14:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-03 14:44 Alan Maguire [this message]
2020-07-03 14:44 ` [PATCH bpf-next 1/2] bpf: use dedicated bpf_trace_printk event instead of trace_printk() Alan Maguire
2020-07-08 5:56 ` Andrii Nakryiko
2020-07-09 16:04 ` Alan Maguire
2020-07-09 21:41 ` Steven Rostedt
2020-07-03 14:44 ` [PATCH bpf-next 2/2] selftests/bpf: add selftests verifying bpf_trace_printk() behaviour Alan Maguire
2020-07-08 6:01 ` Andrii Nakryiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1593787468-29931-1-git-send-email-alan.maguire@oracle.com \
--to=alan.maguire@oracle.com \
--cc=andriin@fb.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=songliubraving@fb.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®