TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

eBPF Is Awesome

268 pointsby filipnover 4 years ago

10 comments

tptacekover 4 years ago
Most examples of BPF code are written in a mix of Python and C using BCC, the &quot;BPF Compiler Collection&quot;, which essentially treats all of LLVM and clang as a library callable from Python code.<p>I can&#x27;t get my head around using it that way, and have found it pretty straightforward to just write C programs, compiled with clang `-target bpf`. Until very recently, writing anything interesting this way required you to declare all functions inline, compile into a single ELF .o, and, of course, avoid most loops. But most of the kinds of things you&#x27;d write in BPF tend not to be especially loopy (you can factor most algorithmic code out into userland, communicating with BPF using maps).<p>A big issue for this kind of development is kernel compat; struct layouts can change from release to release, for instance. This isn&#x27;t a problem for us at Fly, because we just run the same kernel everywhere, but it&#x27;s a real problem if you&#x27;re trying to ship a tool for other people&#x27;s systems. But that&#x27;s changing with CO-RE; recent kernels can export a simplified symbol table in a BPF-legible format called BTF, and the leader can perform relocations. Facebook has written a bunch of good stuff about this:<p><a href="https:&#x2F;&#x2F;facebookmicrosites.github.io&#x2F;bpf&#x2F;blog&#x2F;2020&#x2F;02&#x2F;20&#x2F;bcc-to-libbpf-howto-guide.html" rel="nofollow">https:&#x2F;&#x2F;facebookmicrosites.github.io&#x2F;bpf&#x2F;blog&#x2F;2020&#x2F;02&#x2F;20&#x2F;bcc...</a>
评论 #25492139 未加载
评论 #25491488 未加载
评论 #25491178 未加载
评论 #25491905 未加载
评论 #25493332 未加载
评论 #25491745 未加载
mhh__over 4 years ago
Spectre mitigations can make it go from awesome to useful.<p>The documentation is also pretty dire, but it&#x27;s mostly implement-once remember-forever in my experience - it&#x27;s all there but kernel samples are quite hard to read, and I&#x27;d rather not guess based on struct listings (e.g. variable length structs aren&#x27;t particularly fun when you&#x27;re fumbling around)
ncmncmover 4 years ago
It seems worth mentioning that the code actually executing in the kernel, when it is running your eBPF, is native machine code, ahead-of-time compiled from the bytecode program you gave to the kernel.
评论 #25491737 未加载
thomashabets2over 4 years ago
Yup, it is. My recent epiphany-blogpost:<p><a href="https:&#x2F;&#x2F;blog.habets.se&#x2F;2020&#x2F;11&#x2F;BPF-the-future-of-configs.html" rel="nofollow">https:&#x2F;&#x2F;blog.habets.se&#x2F;2020&#x2F;11&#x2F;BPF-the-future-of-configs.htm...</a>
buckminsterover 4 years ago
&gt; running a user space program inside the kernel<p>Isn&#x27;t it actually running a user program in kernel space?
perlgeekover 4 years ago
Is it possible to write device drivers in eBPF?<p>(I&#x27;ve asked this before, but haven&#x27;t gotten any response, and no clear answer from Google&#x2F;DDG either).
评论 #25493527 未加载
评论 #25494244 未加载
polskibusover 4 years ago
What are the benefits of using eBPF besides a promise of observability &quot;for free&quot;?<p>Can eBPF be used for observability using platforms like Java or .net core, or does their platform VMs obfuscate too much and monitoring them using eBPF is not feasible?<p>How does eBPF work wrt OpenTelemetry etc.? Should OpenTelemetry be seen as standardized interfaces to which eBPF reports data?
评论 #25493982 未加载
评论 #25535430 未加载
knorkerover 4 years ago
&gt; The eBPF program is written in a pseudo-C code<p>Pseudo? This is a nit, but isn&#x27;t it actually regular C?
waynesonfireover 4 years ago
I just happen to run into a freebsd video on dtrace (similar technology to eBPF, I think) that was created three weeks ago.<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=E06GVdH-LX0" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=E06GVdH-LX0</a>
评论 #25498880 未加载
ChrisMarshallNYover 4 years ago
That sounds extremely cool.<p>Sadly, I don&#x27;t program in Linux, so I can&#x27;t use it. :&#x27;(
评论 #25491508 未加载
评论 #25491435 未加载
评论 #25491539 未加载
评论 #25491902 未加载