Live data from Hacker News

BPF: A New Type of Software

brendangregg.com

61–70 of 192 posts

Re: BPF: A New Type of Software

#62
post #35

The Lost Generation discovers IBM Mainframe Channel Programs? Want to bet if they are going to make all the same mistakes themselves, or if they are willing to learn from history?

All snark aside, is there potential benefit to Varnish Cache with this becoming widely adopted? Things that could only be accomplished at lower layers like this implies access to?

Re: BPF: A New Type of Software

#63
post #56

Earlier quoted context omitted.

A BPF interpreter can literally be ~100 LoC. A WebAssembly VM on the other hand will likely be ~1million LoC (without checking). One is suitable for embedding into a kernel, the other isn't.

Where did you get ~1million number? https://github.com/bytecodealliance/wasm-micro-runtime is less than 100K LoC for example.

If a micro runtime is 100K LOC then 1M LOC wasn't unrealistic.

Re: BPF: A New Type of Software

#64
Off topic: this is the same Brendan Gregg of flame charts fame [0][1]. It has solved my skin quite a few times when trying to figure out performance bottlenecks in Python apps (using pyflame[2] to capture data and FlameGraph[1] to convert it to displayable SVG).

[0] http://www.brendangregg.com/flamegraphs.html

[1] https://github.com/brendangregg/FlameGraph

[2] https://github.com/uber-archive/pyflame

Re: BPF: A New Type of Software

#66
post #56

Earlier quoted context omitted.

A BPF interpreter can literally be ~100 LoC. A WebAssembly VM on the other hand will likely be ~1million LoC (without checking). One is suitable for embedding into a kernel, the other isn't.

Where did you get ~1million number? https://github.com/bytecodealliance/wasm-micro-runtime is less than 100K LoC for example.

This is a micro runtime that acts as a tiny WASM interpreter. 1M LOC sounds fair when complex runtime features such as JIT or AOT are included.

Re: BPF: A New Type of Software

#67
post #15

Question from me, why reinvent the bicycle and not just write proper kernel modules in C?

BPF is completely production safe. So there is no way for a BPF program to crash the kernel, introduce significant performance latency, or have any side effects on the kernel/user space. Obviously, kernel modules have none of those properties. Also, BPF has been around for almost 30 years, and you're likely using it. tcpdump is basically just a BPF bytecode frontend, for example.

You can maintain production safety by using a BPF->kernel module compiler.

This additionally removes the need to have the bpf compiler in the kernel, reducing both core size and vulnerability surface area.

No reason BPF must imply JIT

Re: BPF: A New Type of Software

#68
post #15

Question from me, why reinvent the bicycle and not just write proper kernel modules in C?

I guess you are missing the point by 100000 miles. The whole point of BPF is the avoid writing a C kernel module and pull in the entire problem domain of C programs running in Ring0. this was called out explicitly in the video.

Re: BPF: A New Type of Software

#69

Earlier quoted context omitted.

A BPF interpreter can literally be ~100 LoC. A WebAssembly VM on the other hand will likely be ~1million LoC (without checking). One is suitable for embedding into a kernel, the other isn't.

> One is suitable for embedding into a kernel, the other isn't. I'd be very surprised if the linux kernel doesn't eventually get web assembly support.

Doubtful. Webassembly is Turing complete, BPF isn’t. Running untrusted unbounded code in the kernel is not smart. BPF was invented with kernel constraints in mind, webassembly was invented with browser constraints in mind. Completely different use cases

Re: BPF: A New Type of Software

#70
post #63
post #56

Earlier quoted context omitted.

Where did you get ~1million number? https://github.com/bytecodealliance/wasm-micro-runtime is less than 100K LoC for example.

If a micro runtime is 100K LOC then 1M LOC wasn't unrealistic.

About half is tests and sample codes. Runtime proper (core directory) is It is also WASI runtime. WebAssembly runtime proper (core/iwasm/runtime directory) is more like 10K.
Post reply on HN