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

armbian-kernel.sh: introduce KERNEL_BTF=no to opt-out of BTF/CO-RE type-info on low-RAM machines #7675

Conversation

rpardini
Copy link
Member

@rpardini rpardini commented Jan 8, 2025

armbian-kernel.sh: introduce KERNEL_BTF=no to opt-out of BTF/CO-RE type-info on low-RAM machines

  • armbian-kernel.sh: introduce KERNEL_BTF=no to opt-out of BTF/CO-RE type-info on low-RAM machines
    • turns out pahole for vmlinux can take multiple gigabytes of RAM to run successfully
    • I can't simply decide based on available RAM, as that would make .config hashes mismatch
    • thus, introduce:
      • default is to enable BTF; if on low-ram host, error out unless KERNEL_BTF=yes is passed
      • if KERNEL_BTF=no is passed, the BTF debug info is always disabled
      • if KERNEL_BTF=yes is passed, then a warning is produced, but BTF is still enabled
    • the magic number "6451 MiB" was determined empirically (and is probably bs)

@github-actions github-actions bot added size/medium PR with more then 50 and less then 250 lines Needs review Seeking for review Framework Framework components labels Jan 8, 2025
@rpardini rpardini force-pushed the pr/armbian-kernelsh-introduce-KERNELBTFno-to-opt-out-of-BTFCO-RE-type-info-on-low-RAM-machines branch from 4092bf5 to ab6192d Compare January 23, 2025 19:02
@rpardini rpardini marked this pull request as ready for review January 23, 2025 19:02
@rpardini rpardini requested a review from a team as a code owner January 23, 2025 19:02
@rpardini rpardini mentioned this pull request Jan 23, 2025
7 tasks
@igorpecovnik igorpecovnik added the Needs Documentation New feature needs documentation entry label Jan 23, 2025
@rpardini rpardini force-pushed the pr/armbian-kernelsh-introduce-KERNELBTFno-to-opt-out-of-BTFCO-RE-type-info-on-low-RAM-machines branch from ab6192d to cf72bb4 Compare January 26, 2025 06:33
…type-info on low-RAM machines

- turns out `pahole` for `vmlinux` can take multiple gigabytes of RAM to run successfully
- I can't simply decide based on available RAM, as that would make .config hashes mismatch
- thus, introduce:
  - default is to enable BTF; if on low-ram host, error out unless KERNEL_BTF=yes is passed
  - if KERNEL_BTF=no is passed, the BTF debug info is always disabled
  - if KERNEL_BTF=yes is passed, then a warning is produced, but BTF is still enabled
- the magic number "6451 MiB" was determined empirically (and is probably bs)
@rpardini rpardini force-pushed the pr/armbian-kernelsh-introduce-KERNELBTFno-to-opt-out-of-BTFCO-RE-type-info-on-low-RAM-machines branch from cf72bb4 to 2a65b10 Compare February 1, 2025 14:02
@igorpecovnik
Copy link
Member

igorpecovnik commented Feb 5, 2025

Merging to 25.02 ? Can something be added to the docs as this is new features.

@igorpecovnik igorpecovnik added 02 Milestone: First quarter release 05 Milestone: Second quarter release labels Feb 5, 2025
@rpardini
Copy link
Member Author

rpardini commented Feb 5, 2025

Docs would go along the lines of

  • KERNEL_BTF=yes|no: default is to auto-detect based on build host available RAM. If not enough RAM available, use =no to accept building without BTF debug information, or use =yes to force building with BTF even if low RAM. Family code can set this to opt-out of BTF. For more information on BTF see https://docs.kernel.org/bpf/btf.html

igorpecovnik added a commit to armbian/documentation that referenced this pull request Feb 9, 2025
@igorpecovnik igorpecovnik added Ready to merge Reviewed, tested and ready for merge and removed Needs review Seeking for review Needs Documentation New feature needs documentation entry labels Feb 9, 2025
@igorpecovnik igorpecovnik merged commit 51b300e into armbian:main Feb 9, 2025
12 checks passed
@igorpecovnik
Copy link
Member

igorpecovnik commented Feb 9, 2025

When changing KERNEL_BTF it does not recompile kernel. Is this expected? armhf / mvebu

@rpardini
Copy link
Member Author

rpardini commented Feb 9, 2025

When changing KERNEL_BTF it does not recompile kernel. Is this expected? armhf / mvebu

Might be it was already disabled there? Still the hash change should cause at least some recompile.
Can you check the config of the produced kernel for CONFIG_DEBUG_INFO_BTF ?

@igorpecovnik
Copy link
Member

Can you check the config of the produced kernel for CONFIG_DEBUG_INFO_BTF ?

Yes, it was there.

@rpardini
Copy link
Member Author

rpardini commented Feb 9, 2025

Can you check the config of the produced kernel for CONFIG_DEBUG_INFO_BTF ?

Yes, it was there.

Then it is not working the way I intended it to. Can you post the ./compile.sh invocations you used?

igorpecovnik added a commit to armbian/documentation that referenced this pull request Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
02 Milestone: First quarter release 05 Milestone: Second quarter release Framework Framework components Ready to merge Reviewed, tested and ready for merge size/medium PR with more then 50 and less then 250 lines
Development

Successfully merging this pull request may close these issues.

2 participants