Skip to content

[BOLT][perf2bolt] BOLTing the Linux Kernel, perf2bolt stage fails #138957

@MichaelDeets

Description

@MichaelDeets

I'm trying to BOLT my Linux Kernel. I've run a quick perf, then, while attempting to convert into a usable BOLT profile using perf2bolt, it results in this error:

Linux kernel version is unknown

I attempted to circumvent by patching bolt/lib/Rewrite/LinuxKernelRewriter.cpp and removed the check, which then, after re-running perf2bolt, results in this error:

BOLT-ERROR: while running linux-kernel-rewriter in pre-CFG state: invalid target of static keys jump at 0xffffffff81321c9c : 0xffffffff8120556e

Which stumped me for a while, as this is my first attempt at using BOLT and I'm unfamiliar with most things regarding it. What worked for me, was setting the "CONFIG_JUMP_LABEL=n" option in my Linux Kernel's configuration. I'm also using LTO, which might've contribute to this problem. I'll upload my full kernel configuration for reference.

I just hadn't seen anything regarding "CONFIG_JUMP_LABEL=n" being a requirement, and couldn't find anyone else online with similar issues, hence this bug report. Apologies in advanced if I had missed an existing bug report regarding this problem. I'm happy to attach anything else required, please let me know!

For all my LLVM related packages, I have them installed using my package manager (Portage), but for BOLT I simply build using 20.1.4 source, and also attempted the latest git version, but no changes between them.

Steps that resulted in the error:

Using https://github.com/llvm/llvm-project/blob/main/bolt/docs/OptimizingLinux.md as the guide:

1: Built the Linux Kernel with various options, like LTO, AutoFDO, Propeller, etc. enabled, all built using LLVM/Clang 20.1.4

2: Performed a perf using the command perf record -a -e cycles -j any,k -F 5000 -- sleep 600

3: Ran the command perf2bolt -p perf.data -o perf.fdata, which returned the first error.

I repeated the same steps after patching this out, and received the second error.

Only after setting "CONFIG_JUMP_LABEL=n", rebuilding the kernel, then repeating the steps, would it result in the perf.fdata file.

I have included the output from perf2bolt on the second error, but I'm using a different vmlinux binary so it might appear somewhat off, but it results in the same error.

perf2bolt.log

config.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions