Skip to content
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

Enable kernel headers for eBPF tools. #7437

Closed
chadbrewbaker opened this issue Sep 19, 2021 · 9 comments
Closed

Enable kernel headers for eBPF tools. #7437

chadbrewbaker opened this issue Sep 19, 2021 · 9 comments
Assignees
Labels

Comments

@chadbrewbaker
Copy link

chadbrewbaker commented Sep 19, 2021

Is your feature request related to a problem? Please describe.
Kernel headers are turned off Microsoft/config-wsl which barfs eBPF tracing tools:

# CONFIG_IKHEADERS is not set

should be

CONFIG_IKHEADERS=y

Describe the solution you'd like
Enable the flag so Prodfiler and bccutils work.

Describe alternatives you've considered
You can build your own kernel, but this should be a default for non-technical users.

Additional context
I tested on https://github.com/microsoft/WSL2-Linux-Kernel/releases/tag/linux-msft-wsl-5.10.43.3 and it seems to work.

@tyhicks if you were doing a build for Linux Plumbers Conf next week, please include this :)

@benhillis benhillis self-assigned this Sep 23, 2021
@benhillis
Copy link
Member

Thanks for the suggestion, taking a look at adding this.

@chadbrewbaker
Copy link
Author

chadbrewbaker commented Sep 23, 2021

I should probably create another ticket, but your releases could also include the perf binary pinned to Microsoft's WSL2 kernel build. I know WSL2 hasn't exposed all the hardware counters yet - but at least you wouldn't have to build from source yourself, and there would be eyeballs on missing features.

@acmel I haven't seen your LCPC talk but I linked it - seems perf itself will need ebpf support? https://www.youtube.com/watch?v=q-LJ32BCiSQ&t=5726s

@arcamelo
Copy link

perf probably was the first tool to link with libbpf, for 'perf trace', nowadays, besides that, it also uses BPF skels, as mentioned in my talk.
Also perf's version doesn't need to be the same as the kernel it runs on, fallbacks happen when using a new perf on an older kernel and older tools also should work on newer kernels, when possible (matching requested features from tool/kernel features).

@chadbrewbaker
Copy link
Author

@arcamelo can you point me to the list of kernel config settings that the latest perf needs? I didn't see it when browsing the docs: https://github.com/torvalds/linux/tree/master/tools/perf/Documentation

@tyhicks
Copy link
Collaborator

tyhicks commented Oct 6, 2021

@chadbrewbaker does it make more sense to enable CONFIG_DEBUG_INFO_BTF, instead of using the kernel headers provided by CONFIG_IKHEADERS, as mentioned in this blog post?

@teknoraver
Copy link

I vote for BTF debuginfo too.

@tyhicks
Copy link
Collaborator

tyhicks commented Oct 6, 2021

After reading some more, the benefit of going the BTF and CO-RE route is that we aren't going to break BTF binaries in the process of performing a stable kernel update (5.10.43 -> 5.10.60) or, even more likely, when doing a major kernel version update (5.10.60 -> 5.16.8).

There may be other valid reasons to enable CONFIG_IKHEADERS in the WSL2 kernel but CONFIG_DEBUG_INFO_BTF seems like the better choice for eBPF tools.

@chadbrewbaker
Copy link
Author

chadbrewbaker commented Oct 6, 2021

I will test it tonight. @SeanHeelan might have more input.

@tyhicks
Copy link
Collaborator

tyhicks commented Nov 10, 2021

We've enabled BTF support in 5.10.74.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants