Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 86 additions & 2 deletions .github/workflows/test-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
description: Mainline (-rc) version to build and install with --mainline
required: false
default: 7.3-rc7
full_build:
description: Run the full CachyOS/BMQ/hardened kernel builds (hours)
type: boolean
default: false
schedule:
# Weekly, off the hour (#43): the kernel.org stable release moves on its
# own, so a new kernel that breaks the build must show up without anyone
Expand Down Expand Up @@ -393,9 +397,43 @@ jobs:
path: /var/log/kernel-installer/kernel_installer.log
if-no-files-found: ignore

config-only:
name: Config ${{ matrix.name }}
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- name: BORE
args: "--source cachyos --sched bore --profile workstation"
- name: BORE+LTO
args: "--source cachyos --sched bore --profile workstation --lto thin"
- name: BMQ
args: "--source cachyos --sched bmq --profile workstation"
- name: RT
args: "--source cachyos --sched bore --profile workstation --rt"
- name: hardened
args: "--hardened --profile workstation --base-config none"
- name: AutoFDO
args: "--source cachyos --autofdo-collect --profile workstation"
container:
image: debian:13
env:
TERM: xterm
steps:
- name: Install container prerequisites
run: |
apt-get update -qq
apt-get install -y -qq git ca-certificates lsb-release procps
- uses: actions/checkout@v4
- name: Validate configuration only
run: ./kernel_installer.sh --config-only ${{ matrix.args }}

cachyos-bore-smoke:
name: CachyOS BORE + LTO ${{ matrix.name }}
if: github.event_name != 'schedule'
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.full_build == 'true')
runs-on: ubuntu-latest
timeout-minutes: 240
strategy:
Expand Down Expand Up @@ -470,7 +508,7 @@ jobs:

hardened-smoke:
name: Hardened (linux-hardened 7.3.1)
if: github.event_name != 'schedule'
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.full_build == 'true')
runs-on: ubuntu-latest
timeout-minutes: 180
container:
Expand Down Expand Up @@ -512,6 +550,52 @@ jobs:
path: /var/log/kernel-installer/kernel_installer.log
if-no-files-found: ignore

bmq-smoke:
name: BMQ (CachyOS 7.3.4)
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.full_build == 'true')
runs-on: ubuntu-latest
timeout-minutes: 240
container:
image: debian:13
env:
TERM: xterm
steps:
- name: Install container prerequisites
run: |
apt-get update -qq
apt-get install -y -qq git ca-certificates lsb-release procps initramfs-tools qemu-system-x86
- uses: actions/checkout@v4
- name: Build and install the BMQ kernel
run: ./kernel_installer.sh --source cachyos --sched bmq --profile workstation
- name: Show installer log on failure
if: failure()
run: |
echo "=== /var/log/kernel-installer/kernel_installer.log (last 200 lines) ==="
tail -n 200 /var/log/kernel-installer/kernel_installer.log || true
- name: Verify the BMQ kernel
run: |
set -eux
set -- /boot/vmlinuz-*
test "$#" -eq 1
release="${1##*/vmlinuz-}"
test "$release" = "7.3.4-cachyos-workstation-bmq"
cfg="/boot/config-${release}"
test -f "$cfg"
grep -q '^CONFIG_CACHY=y$' "$cfg"
grep -q '^CONFIG_SCHED_ALT=y$' "$cfg"
grep -q '^CONFIG_SCHED_BMQ=y$' "$cfg"
grep -q '^CONFIG_HZ=1000$' "$cfg"
echo "BMQ verified in $cfg"
- name: Boot smoke test
run: ./scripts/boot-smoke.sh
- name: Upload installer logs
if: always()
uses: actions/upload-artifact@v4
with:
name: kernel-installer-logs-bmq
path: /var/log/kernel-installer/kernel_installer.log
if-no-files-found: ignore

# Issue #43: every other job here passes -k, --mainline or --custom-config,
# so none of them installs the way a user does -- and a Fedora install of a
# *current* kernel broke with no job noticing. These jobs run
Expand Down
63 changes: 57 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Usage: kernel_installer.sh [options]
--list-profiles |-lp list optimization profiles and exit
--base-config |-bc profile base config: running, a path, cachyos, or none
--source | kernel source: vanilla (kernel.org) or cachyos (pinned)
--sched | scheduler for the cachyos source: eevdf or bore
--sched | scheduler for the cachyos source: eevdf, bore, or bmq
--cpu | CPU tuning: generic, native, zen4, x86-64-v3, x86-64-v4
--lto | LTO: none, thin, or full (requires clang/lld)
--hz | timer frequency: 100, 250, 300, 500, 600, 750, 1000
Expand All @@ -157,6 +157,9 @@ Usage: kernel_installer.sh [options]
--sched-ext | enable sched_ext and BTF for userspace BPF schedulers
--rt | build a PREEMPT_RT real-time kernel (6.12+)
--hardened | apply the pinned linux-hardened patch (vanilla 7.3.1)
--autofdo <profile> | build with an AutoFDO sample profile (clang 17+)
--autofdo-collect | build a profiling kernel for AutoFDO (clang 17+)
--config-only | validate the configuration and exit before compiling
--no-sign | disable automatic Secure Boot kernel signing
--kernel-tag | custom localversion suffix (default: auto from source/profile)
--verbose |-v increase verbosity
Expand Down Expand Up @@ -314,6 +317,10 @@ sudo ./kernel_installer.sh -d /path/to/parent \
`--source cachyos`: the BORE patch does not apply cleanly to the vanilla
kernel.org 7.3.4 tree. `--sched eevdf` is the default and does not apply
the BORE patch.
- `--sched bmq` applies the pinned PRJC/BMQ patch and enables
`CONFIG_SCHED_ALT=y` + `CONFIG_SCHED_BMQ=y`. It requires `--source cachyos`
and is mutually exclusive with BORE. BMQ targets desktop interactivity; the
patch is pinned by SHA256 like the BORE patch.
- CI builds and boots the BORE kernel with Clang ThinLTO on Debian 13 and
Ubuntu 24.04, with the `workstation` profile. Native CPU tuning is available
but is not part of the default CI matrix because it depends on the build
Expand All @@ -332,10 +339,10 @@ sudo ./kernel_installer.sh -d /path/to/parent \
`clang`, `lld`, and `llvm` on demand, configure `LTO_CLANG_THIN`/`FULL`, and
build with `LLVM=1 LLVM_IAS=1`; `none` is the default. The kernel is
boot-smoked after the build.
- This is the CachyOS base patchset plus BORE, not the full CachyOS variant
matrix. BMQ and the remaining wiki features are separate follow-ups;
sched_ext, PREEMPT_RT, and linux-hardened are available through
`--sched-ext`, `--rt`, and `--hardened`.
- This is the CachyOS base patchset plus BORE or BMQ, not the full CachyOS
variant matrix. The remaining wiki features are separate follow-ups;
sched_ext, PREEMPT_RT, linux-hardened, and AutoFDO are available through
`--sched-ext`, `--rt`, `--hardened`, and `--autofdo`.

### Kernel naming

Expand All @@ -344,7 +351,7 @@ Optimized builds get a `CONFIG_LOCALVERSION` so they are distinguishable in
`.deb` names:

```text
<version>-<source>-<profile>[-<scheduler>][-<cpu>][-<lto>][-hz<n>][-bbr3][-binder][-sched-ext][-rt]
<version>-<source>-<profile>[-<scheduler>][-<cpu>][-<lto>][-hz<n>][-bbr3][-binder][-sched-ext][-rt][-autofdo]
```

| Build | `uname -r` |
Expand All @@ -355,6 +362,7 @@ Optimized builds get a `CONFIG_LOCALVERSION` so they are distinguishable in
| same + 600 Hz + BBR3 + Binder + sched_ext | `7.3.4-cachyos-workstation-bore-hz600-bbr3-binder-sched-ext` |
| same + PREEMPT_RT | `7.3.4-cachyos-workstation-bore-rt` |
| vanilla workstation + linux-hardened | `7.3.1-hardened1-vanilla-workstation` |
| vanilla workstation + AutoFDO | `7.3.4-vanilla-workstation-autofdo` |
| CachyOS EEVDF server | `7.3.4-cachyos-server` |
| vanilla desktop | `7.3.4-vanilla-desktop` |

Expand Down Expand Up @@ -422,6 +430,42 @@ options do not collide in `/lib/modules` or DKMS:
7.3.4-cachyos-workstation-bore-lto-hz600-bbr3-binder-sched-ext
```

### AutoFDO

AutoFDO is profile-guided optimization from hardware sampling. You build a
profiling kernel, run a representative workload while `perf` records branch
samples, convert the samples into an AutoFDO profile, and rebuild the kernel
with that profile. Clang then places the hot code and branches where the CPU
can fetch them faster. It is not a scheduler or instrumentation; the gain
depends on how well the workload matches the profile.

Requirements: clang/LLVM 17 or newer, a kernel source with
`CONFIG_AUTOFDO_CLANG` (7.x; not 6.12), and an x86 CPU with LBR or BRS
(Zen 3 BRS, Zen 4+ `amd_lbr_v2`).

```bash
# 1. profiling kernel (no profile yet)
sudo ./kernel_installer.sh --autofdo-collect --profile workstation
# reboot into it, then sample the workload
perf record --pfm-events RETIRED_TAKEN_BRANCH_INSTRUCTIONS:k \
-a -N -b -c 500009 -o perf.data -- <your workload>
# 2. convert (create_llvm_prof from the AutoFDO project)
create_llvm_prof --binary=/path/to/vmlinux-<release> \
--profile=perf.data --out=autofdo.profdata
# 3. rebuild with the profile
sudo ./kernel_installer.sh --autofdo autofdo.profdata --profile workstation
```

The `--autofdo-collect` build saves `vmlinux-<release>` in the `--dir` parent
directory (default `/opt`), because the profile conversion needs the
unstripped binary. `--autofdo <profile>` passes the profile to clang and tags
the kernel `-autofdo`; `--autofdo-collect` tags it `-autofdo-collect`.

Limits: the profile is workload-specific; regenerate it when the kernel or
the workload changes. If the source enables Rust and your `rustc` lacks
sample-profile support, disable Rust for the AutoFDO build with
`--custom-config 'scripts/config --disable RUST'`.

### Secure Boot auto-signing

When a MOK key pair is present, the installer signs the kernel it installs and
Expand Down Expand Up @@ -547,6 +591,13 @@ To uninstall previously installed kernel:
Tested and working on: Debian 12/13, Ubuntu 22.04/24.04 and Fedora 44 (see [test-install.yml](.github/workflows/test-install.yml))

- Each CI run uploads the installer log of every distro as a workflow artifact (`kernel-installer-logs-<distro>`) on the [Actions](https://github.com/tmiland/kernel-installer/actions/workflows/test-install.yml) page
- For a fast configuration check without compiling:

```bash
sudo ./kernel_installer.sh --config-only --source cachyos --sched bmq --profile workstation
```

The config-only matrix runs on every PR; the full kernel build/boot matrix runs on `main` and on demand (`workflow_dispatch` with `full_build=true`).

## Maintenance

Expand Down
Loading
Loading