From: Alan Maguire <almagui@kernel.org>
To: dwarves@vger.kernel.org
Cc: Alan Maguire <almagui@kernel.org>
Subject: [PATCH dwarves 6/6] CI: Add clang ThinLTO kernel build to test matrix
Date: Mon, 16 Nov 2026 11:20:43 +0000 [thread overview]
Message-ID: <20261116112043.3831978-7-almagui@kernel.org> (raw)
In-Reply-To: <20261116112043.3831978-1-almagui@kernel.org>
LTO kernels are an important case for BTF generation: cross-CU
inlining and function merging change what pahole sees in DWARF and
the ELF symbol table. Add an x86_64 clang job that builds the kernel
with CONFIG_LTO_CLANG_THIN=y.
vmtest.yml gets an optional "lto" input (default "none") that is
passed to build-kernel.sh, which enables LTO_CLANG_THIN via
scripts/config. Since olddefconfig silently falls back to LTO_NONE
when a dependency is unmet (e.g. KASAN, GCOV), fail the build if
ThinLTO did not end up enabled rather than quietly testing a non-LTO
kernel. The function comparison step reuses the existing .config, so
the baseline build is LTO too. The ondemand workflow gets a matching
"lto" input.
The tests runner starts all tests in parallel by default. Several of
them load the full vmlinux with pahole/pfunct, and on a ThinLTO kernel
running them concurrently can exhaust the runner's memory. Have
run-selftests.sh pass -j $SELFTEST_JOBS to the tests runner when set,
and set it to 2 for LTO jobs in vmtest.yml. Non-LTO jobs keep running
all tests in parallel.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Alan Maguire <almagui@kernel.org>
---
.github/scripts/build-kernel.sh | 30 +++++++++++++++++++++++++++++-
.github/scripts/run-selftests.sh | 2 +-
.github/workflows/ondemand.yml | 7 ++++++-
.github/workflows/test.yml | 8 ++++++++
.github/workflows/vmtest.yml | 11 ++++++++++-
5 files changed, 54 insertions(+), 4 deletions(-)
diff --git a/.github/scripts/build-kernel.sh b/.github/scripts/build-kernel.sh
index 8326e1d..18a6f47 100755
--- a/.github/scripts/build-kernel.sh
+++ b/.github/scripts/build-kernel.sh
@@ -11,6 +11,7 @@ REPO_BRANCH=${REPO_BRANCH:-master}
REPO_TARGET=${GITHUB_WORKSPACE}/.kernel
CC=${CC:-gcc}
LLVM_VERSION=${LLVM_VERSION:-22}
+LTO=${LTO:-none}
export PATH=${GITHUB_WORKSPACE}/install/usr/local/bin:${PATH}
export PAHOLE=${GITHUB_WORKSPACE}/install/usr/local/bin/pahole
@@ -36,7 +37,34 @@ cat tools/testing/selftests/bpf/config \
if [[ -f tools/testing/selftests/bpf/config.vm ]]; then
cat tools/testing/selftests/bpf/config.vm >> .config
fi
-make $buildopts olddefconfig && make prepare
+make $buildopts olddefconfig
+
+case "$LTO" in
+none)
+ ;;
+thin)
+ if [[ "$CC" != "clang" ]]; then
+ echo "LTO=thin requires CC=clang" >&2
+ exit 1
+ fi
+ echo "Enabling Clang ThinLTO"
+ scripts/config -d LTO_NONE -e LTO_CLANG_THIN
+ make $buildopts olddefconfig
+ # olddefconfig silently falls back to LTO_NONE if a dependency
+ # is not met (e.g. KASAN, GCOV); fail rather than test non-LTO.
+ if ! grep -q '^CONFIG_LTO_CLANG_THIN=y' .config; then
+ echo "CONFIG_LTO_CLANG_THIN could not be enabled:" >&2
+ grep -E 'LTO|HAS_LTO' .config >&2
+ exit 1
+ fi
+ ;;
+*)
+ echo "Unsupported LTO mode '$LTO'" >&2
+ exit 1
+ ;;
+esac
+
+make $buildopts prepare
cat .config
make -j $((4*$(nproc))) $buildopts all
diff --git a/.github/scripts/run-selftests.sh b/.github/scripts/run-selftests.sh
index bb826bf..748c4b9 100755
--- a/.github/scripts/run-selftests.sh
+++ b/.github/scripts/run-selftests.sh
@@ -13,5 +13,5 @@ export LLVM_OBJCOPY=objcopy
which pahole
pahole --version
bpftool --version
-vmlinux=$VMLINUX ./tests
+vmlinux=$VMLINUX ./tests ${SELFTEST_JOBS:+-j $SELFTEST_JOBS}
diff --git a/.github/workflows/ondemand.yml b/.github/workflows/ondemand.yml
index 09e7ccb..d9f8617 100644
--- a/.github/workflows/ondemand.yml
+++ b/.github/workflows/ondemand.yml
@@ -21,10 +21,14 @@ on:
cc:
default: 'gcc'
required: true
+ lto:
+ description: 'kernel LTO mode (none or thin; thin requires cc=clang)'
+ default: 'none'
+ required: true
jobs:
vmtest:
- name: ${{ inputs.kernel }} kernel ${{ inputs.cc }} llvm-${{ inputs.llvm-version }} pahole@${{ inputs.pahole }}
+ name: ${{ inputs.kernel }} kernel ${{ inputs.cc }} lto-${{ inputs.lto }} llvm-${{ inputs.llvm-version }} pahole@${{ inputs.pahole }}
uses: ./.github/workflows/vmtest.yml
with:
runs_on: ${{ inputs.runs-on }}
@@ -33,3 +37,4 @@ jobs:
llvm-version: ${{ inputs.llvm-version }}
pahole: ${{ inputs.pahole }}
cc: ${{ inputs.cc }}
+ lto: ${{ inputs.lto }}
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 8bff4e4..8bc3897 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -28,6 +28,13 @@ jobs:
llvm-version: '22'
pahole: 'none'
cc: 'clang'
+ - kernel: 'LATEST'
+ runs_on: 'ubuntu-24.04'
+ arch: 'x86_64'
+ llvm-version: '22'
+ pahole: 'none'
+ cc: 'clang'
+ lto: 'thin'
- kernel: 'LATEST'
runs_on: 'ubuntu-24.04-arm'
arch: 'aarch64'
@@ -49,3 +56,4 @@ jobs:
llvm-version: ${{ matrix.llvm-version }}
pahole: ${{ matrix.pahole }}
cc: ${{ matrix.cc }}
+ lto: ${{ matrix.lto || 'none' }}
diff --git a/.github/workflows/vmtest.yml b/.github/workflows/vmtest.yml
index 0bc19d7..7010205 100644
--- a/.github/workflows/vmtest.yml
+++ b/.github/workflows/vmtest.yml
@@ -31,10 +31,15 @@ on:
description: 'compiler'
required: true
type: string
+ lto:
+ description: 'kernel LTO mode (none or thin; thin requires clang)'
+ required: false
+ default: 'none'
+ type: string
jobs:
vmtest:
- name: pahole-${{ inputs.cc }}@${{ inputs.arch }}
+ name: pahole-${{ inputs.cc }}${{ inputs.lto != 'none' && format('-lto-{0}', inputs.lto) || '' }}@${{ inputs.arch }}
runs-on: ${{ inputs.runs_on }}
steps:
@@ -64,10 +69,14 @@ jobs:
env:
CC: ${{ inputs.cc }}
LLVM_VERSION: ${{ inputs.llvm-version }}
+ LTO: ${{ inputs.lto }}
run: .github/scripts/build-kernel.sh
- name: Run selftests
shell: bash
+ env:
+ # ThinLTO vmlinux is large; limit how many tests load it at once.
+ SELFTEST_JOBS: ${{ inputs.lto != 'none' && '2' || '' }}
run: .github/scripts/run-selftests.sh
- name: Compare functions generated
--
2.56.0
prev parent reply other threads:[~2026-11-16 11:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 11:20 [PATCH dwarves 0/6] Add support for LTO kernel builds, other CI fixes Alan Maguire
2026-11-16 11:20 ` [PATCH dwarves 1/6] CI: Make kernel source fetch tolerant of git host failures Alan Maguire
2026-11-16 11:20 ` [PATCH dwarves 2/6] tests: Match BTF and DWARF functions with set operations in btf_functions.sh Alan Maguire
2026-11-16 11:20 ` [PATCH dwarves 3/6] CI: Scope workflow concurrency groups to the branch for push runs Alan Maguire
2026-11-16 11:20 ` [PATCH dwarves 4/6] tests: Expect no DWARF loader threads in reproducible_build.sh when CUs are merged Alan Maguire
2026-11-16 11:20 ` [PATCH dwarves 5/6] CI: Fix ondemand workflow inputs and LLVM version in function comparison Alan Maguire
2026-11-16 11:20 ` Alan Maguire [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261116112043.3831978-7-almagui@kernel.org \
--to=almagui@kernel.org \
--cc=dwarves@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.