-
-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpftime trace: tracepipe support for bpf_printk #253
base: master
Are you sure you want to change the base?
bpftime trace: tracepipe support for bpf_printk #253
Conversation
…intk to a tracepipe, read by bpftime trace
I have tested this feature thus:
Below are the output screenshots: |
Thank you! But note that we also need to keep the ability to get bpf_trace_printk prints things to stdout. don't remove such feature |
Okay, could you help with clarifying these doubts before I make the changes in the next commit?
|
I think we could use a option such as The option could be set through For further, we could also support set that option when using |
…ion to bpftime start
Thank you! But please make the CI happy |
I tried poring over the code, and tried some checks. But I'm not able to point out the exact check fail. Could you please help in pointing out some areas in code that could be the cause? |
You may try running target bpftime_runtime_tests on your local machine. In yout newest commit, this check fails |
The check was failing at normal bpftime attach. The error was due to direct conversion from char * getenv to string. On adding a separate condition, the attach worked properly. |
Also, I forgot to mention one thing: when bpftime start is used with the --print-to-trace-pipe option, it has to have bpftime trace running already, or else the bpf_printk output might block. Would this be an issue; should I document it? |
It should be documented, or the better is that it could be fixed |
I'm investigating on that. seems that the CI script ( bpftime/example/malloc/malloc.c Line 72 in 903c951
|
Gone through the code in PR, it seems modifications has nothing to do with stdio during the test example. I tried to run test locally, printing debugger told me the program hangs on the line bpftime/.github/script/run_example.py Line 106 in f8db2dc
And at that time these two proc-s have exited according to htop. Are we sure that communicate() with exit process really works? |
1354316
to
a6a132b
Compare
Description
bpf_printk helper currently outputs to the target program. The kernel eBPF behaviour outputs the result to a named tracepipe (/sys/kernel/debug/tracing/trace_pipe). This PR tries to emulate this behaviour: bpf_printk outputs to a tracepipe, this pipe is accessed by "bpftime trace" option.
The trace pipe is created at "$HOME/.bpftime/tracepipe" or "(bpftime installation location) + /tracepipe"
Dependency: bpftime trace needs to be run in a separate terminal before running bpftime start option.
Fixes #157
Type of change
How Has This Been Tested?
Test Configuration:
Checklist