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

pahole: 1.26 -> 1.27 #319160

Merged
merged 3 commits into from
Jul 20, 2024
Merged

pahole: 1.26 -> 1.27 #319160

merged 3 commits into from
Jul 20, 2024

Conversation

martinetd
Copy link
Member

@martinetd martinetd commented Jun 11, 2024

Description of changes

(Note I don't have enough cpu/disk to build a linux kernel with this, so letting ofborg do the work... Always a bit of a bet on staging. Maybe someday...)

From the release e-mail:

        The v1.27 release of pahole and its friends is out, supporting
parallel reproducible builds and encoding kernel kfuncs in BTF, allowing
tools such as bpftrace to enumerate the available kfuncs and obtain its
function signatures and return types.

BTF encoder:

- Inject kfunc decl tags into BTF from the BTF IDs ELF section in the Linux
  kernel vmlinux file.
  
  This allows tools such as bpftools and pfunct to enumerate the available kfuncs
  and to gets its function signature, the type of its return and of its
  arguments. See the example in the BTF loader changes description, below.

- Support parallel reproducible builds, where it doesn't matter how many
  threads are used, the end BTF encoding result is the same.

- Sanitize unsupported DWARF int type with greater-than-16 byte, as BTF doesn't
  support it.

BTF loader:

- Initial support for BTF_KIND_DECL_TAG:

  $ pfunct --prototypes -F btf vmlinux.btf.decl_tag,decl_tag_kfuncs | grep ^bpf_kfunc | head
  bpf_kfunc void cubictcp_init(struct sock * sk);
  bpf_kfunc void cubictcp_cwnd_event(struct sock * sk, enum tcp_ca_event event);
  bpf_kfunc void cubictcp_cong_avoid(struct sock * sk, u32 ack, u32 acked);
  bpf_kfunc u32 cubictcp_recalc_ssthresh(struct sock * sk);
  bpf_kfunc void cubictcp_state(struct sock * sk, u8 new_state);
  bpf_kfunc void cubictcp_acked(struct sock * sk, const struct ack_sample  * sample);
  bpf_kfunc int bpf_iter_css_new(struct bpf_iter_css * it, struct cgroup_subsys_state * start, unsigned
int flags);
  bpf_kfunc struct cgroup_subsys_state * bpf_iter_css_next(struct bpf_iter_css * it);
  bpf_kfunc void bpf_iter_css_destroy(struct bpf_iter_css * it);
  bpf_kfunc s64 bpf_map_sum_elem_count(const struct bpf_map  * map);
  $ pfunct --prototypes -F btf vmlinux.btf.decl_tag,decl_tag_kfuncs | grep ^bpf_kfunc | wc -l
  116
  $

pretty printing:

- Fix hole discovery with inheritance in C++.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@martinetd
Copy link
Member Author

ofborg tests passed, yay.
I'm surprise it didn't add Ccs, so here: @bosu

BTW @delroth -- they added --btf_features=+reproducible_build to build the BTF output in a consistent manner even with multiple threads; I'll send a patch to enable it by default if SOURCE_DATE_EPOCH is set at which point we'll be able to drop the threading-reproducibility.patch

@martinetd
Copy link
Member Author

BTW @delroth -- they added --btf_features=+reproducible_build to build the BTF output in a consistent manner even with multiple threads; I'll send a patch to enable it by default if SOURCE_DATE_EPOCH is set at which point we'll be able to drop the threading-reproducibility.patch

That wasn't so bad so updated patch. The output is identical to -j1 output from what I could see.

@martinetd
Copy link
Member Author

Note this apparently introduces a regression in linux builds with clang with LTO enabled:

I don't think we actively do that, but on the other hand there's no strict hurry to merge this either, so let's put this on hold until that is fixed

@martinetd martinetd marked this pull request as draft June 15, 2024 00:14
New version brought in the --reproducible_build option, which is more
efficient than forcing a single thread, and produces the same output
(tested on linux kernel's vmlinux BTF extraction)
@martinetd martinetd marked this pull request as ready for review June 26, 2024 03:40
@martinetd
Copy link
Member Author

Note this apparently introduces a regression in linux builds with clang with LTO enabled:

I was expecting a new release with it but it's been fixed without such ceremony, so I picked the patch up.

Also didn't get any response to the reproducibility patch so resent it by e-mail, let's see how that one goes.. This PR was only waiting for the clang fix, so marked as ready again.

@vcunat
Copy link
Member

vcunat commented Jul 20, 2024

I believe there's no use in pinging Delroth anymore: #307173

@vcunat vcunat merged commit 622b743 into NixOS:staging Jul 20, 2024
25 checks passed
@martinetd
Copy link
Member Author

Doh, thanks for the heads up.
And thanks for merging as well.

FWIW that patch was more or less refused upstream after a few exchanges with upstream, between pahole folks telling me that this belongs in kbuild, and kbuild folks saying this deserves a new .config option... let's just keep that harmless patch around for now.

@PedroHLC
Copy link
Member

PedroHLC commented Aug 1, 2024

I don't think we actively do that, but on the other hand there's no strict hurry to merge this either, so let's put this on hold until that is fixed

Maybe I should upstream a kernel built with Clang and LTO (would help to assert our kernel modules build against this scenario), mine broke after this bump 😢

EDIT: Solution is a second patch by Arnaldo: https://lore.kernel.org/all/ZnGZ71a4E29kPrvS@x1/

@martinetd
Copy link
Member Author

@PedroHLC doh, sorry... I wish he'd just tagged a fix release instead of posting patches like this :/

especially since on acmel/dwarves#53 someone commented the other patch was enough..

I've just opened #331589 - if you could confirm it works manually that'd be great.
Long term I agree a test would be welcome, the bpf nixos test builds the regular kernel as a dependency but we could use a minimal clang kernel build test. Heck, I can't even build a kernel on my machines because we have way too many modules enabled, I need to figure out how to build a minimal virt kernel so I can run these tests properly... but at least ofborg would build it for now!

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

Successfully merging this pull request may close these issues.

None yet

3 participants