-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
merging support for LuaJIT to BPF compiler #626
Comments
@vmg @brendangregg |
Awesome, I wanted to hack on it this weekend anyway, it's been a while.
Yes and no. The BPF program is compiled immediately after Lua function is declared, where it doesn't know yet if it's uprobe, socket filter program or something else. So prog = bpf(function(this, kbuf) -- bool accept(char *, const char *)
-- Automatically mapped `ptregs.ax -> char *this`
-- Automatically mapped `ptregs.bx -> const char *kbuf`
end)
Yup, I need to add support for stack traces and
Right, I have added support to perf event reading in ljsyscall PR#191 already, but not sugar coating and kernel-side helper. |
interesting idea about the comments... I think we can adopt it for C as well. |
I've merged rudimentary support for |
is not intuitive. May be possible to introduce another builtin with explicit perf_event_output name ? |
I agree, I think adding either |
Added support for $ sudo luajit examples/tracepoint-offcputime.lua
0x401d3b50 nil - vminfo 570
0x4111e880 nil - rcu_sched 303
0x4111f570 nil - kworker/u2:2 133
0x41120268 nil - ksoftirqd/0 2
0x41120f60 nil - dbus-daemon 144
0x41121c58 nil - automount 13
0x41122948 nil - luajit 42485
0x41123608 nil - sshd 154071 |
looking forward to a PR |
So I've read the contribute guide, but I'm not 100% clear on what would be the best way to approach this. My idea is:
Since Would that be a way forward? CC @vmg |
I've just found this thread! This looks amazing!! I actually tried to implement this earlier using direct Lua bytecode to BPF translations, but that didn't quite work out. I love how much you've gotten done here! I think sticking the library into |
the proposed layout of directories makes sense to me. |
Continuing in #652 |
This is a tire kicking ticket to see if it gathers some interest. Right now bcc compiles C, P4 (and maybe something else) to BPF bytecode and provides frontend in Python and Lua(JIT).
I'm working on (time permitting) vavrusa/luajit-bpf, a pure LuaJIT project to compile LuaJIT bytecode to BPF bytecode - so another supported language besides C and P4.
It has several components where it overlaps bcc (ELF scanner, some Lua front-end, test cases and kernel interface headers, perf interfaces), several things that I'd like to have (eBPF VM for testing), and there is already someone interested in LJ front-end. As for me, it'd be terrific if I didn't have to reimplement and maintain these things. Instead I'd like to incorporate LuaJIT support to bcc project and be able to reuse common things.
Having pure LJ backend has several benefits summarised in the README - most notably things like maps can be shared freely between kernel-side and user-side part of the script, and filter functions can be recompiled on runtime (if parameters changes for example) for more efficient filtering (as in examples/uprobe-tailkt where the branches get optimised out as they're known on script run-time). This is for example something C-to-BPF compilers can't do without sed-ing or preprocessing the sources somehow.
Would that make sense or not at all?
The text was updated successfully, but these errors were encountered: