[BUG] sched_ext: Failed to register kfunc sets (-22); six znver4 GCC 7.3 kernels lack scx_bpf_error_bstr in BTF

Open
#1,173 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c

Research direction

Start with kernel/sched/ext/ext.c and the upstream workaround commit f2f095c87603 named in the report; compare how scx_bpf_error_bstr() is built in the affected znver4 GCC kernels. Check the package build log for the reported resolve_btfids warning, then rebuild an affected package and inspect its packaged build/vmlinux BTF for scx_bpf_error_bstr. Done means the kfunc appears in BTF and sched_ext initializes.

Written by the indexing model from the issue text.

Description

Pre-flight checklist
  • I have searched existing issues and this is not a duplicate.
  • I have read the Contributing Guidelines.
  • I have verified the issue is reproducible with the latest available CachyOS kernel.
  • I have tried to reproduce the issue on Arch Linux's linux kernel.

Box 4 is open on purpose. Arch's linux kernel was not booted for this report. The table below covers its packaged image, and that image does not have the defect.

Upstream / vanilla kernel check

I have not tested with a vanilla/upstream kernel

Kernel variant

linux-cachyos-server

System information (cachyos-bugreport.sh)
Not attached. The defect is in the packaged kernel image. The second command block under "Steps to reproduce" shows it on any machine, without a boot. Ask if you need the full log.
Manual system information (if cachyos-bugreport.sh is unavailable)
Kernel:        7.3.6-1-cachyos-server (linux-cachyos-server 7.3.6-1, repo cachyos-znver4, built 2026-11-23)
CPU:           AMD Ryzen Threadripper PRO 9995WX
Architecture:  znver4
SCX scheduler: scx_lavd through scx_loader (scx-scheds 1.1.4-2, scx-tools 1.1.3-1.1). It cannot start.
Kernel build:  gcc 16.2.1 20261122, CONFIG_PAHOLE_VERSION=132, CONFIG_MZEN4=y, -O3, no LTO
Bug description

Six GCC-built 7.3 kernels of the cachyos-znver4 repo lack the kfunc scx_bpf_error_bstr in the BTF of their vmlinux: server, gcc, bore, eevdf and rt-bore 7.3.6-1, and deckify 7.3.5-2. linux-cachyos-server was booted. The other five were read as images.

On the booted kernel sched_ext does not initialize. The kernel prints sched_ext: Failed to register kfunc sets (-22), /sys/kernel/sched_ext does not exist, and no scx scheduler can start.

In all six images the BTF has no FUNC entry for scx_bpf_error_bstr and none for scx_bpf_error_bstr_impl, while the symbol table lists the function. The kfunc ID set scx_kfunc_ids_any therefore holds one entry of 0, and the kernel refuses a set with such an entry.

The table compares build/vmlinux of thirteen -headers packages. Each was downloaded on 2026-11-25 and matched the sha256 in the live repo database. On the booted server kernel, the running BTF gives the same result as the packaged image (see "Steps to reproduce").

Package Repo Version Compiler Target scx_bpf_error_bstr in BTF Entries equal to 0 / all entries of the scx kfunc ID sets
linux-cachyos-server cachyos-znver4 7.3.6-1 gcc 16.2.1 20261122 znver4 no 1 of 111
linux-cachyos-gcc cachyos-znver4 7.3.6-1 gcc 16.2.1 20261122 znver4 no 1 of 111
linux-cachyos-bore cachyos-znver4 7.3.6-1 gcc 16.2.1 20261122 znver4 no 1 of 111
linux-cachyos-eevdf cachyos-znver4 7.3.6-1 gcc 16.2.1 20261122 znver4 no 1 of 111
linux-cachyos-rt-bore cachyos-znver4 7.3.6-1 gcc 16.2.1 20261122 znver4 no 1 of 111
linux-cachyos-deckify cachyos-znver4 7.3.5-2 gcc 16.2.1 20260810 znver4 no 1 of 107
linux-cachyos cachyos-znver4 7.3.6-2 clang 23.1.5, ThinLTO znver4 yes 0 of 111
linux-cachyos-server cachyos-v3 7.3.6-1 gcc 16.2.1 20261122 x86-64-v3 yes 0 of 111
linux-cachyos-gcc cachyos-v3 7.3.6-1 gcc 16.2.1 20261122 x86-64-v3 yes 0 of 111
linux-cachyos-server cachyos-v4 7.3.5-2 gcc 16.2.1 20260810 x86-64-v4 yes 0 of 107
linux-cachyos-server cachyos 7.3.5-2 gcc 16.2.1 20260810 x86-64 yes 0 of 107
linux-cachyos-lts cachyos-znver4 6.18.65-1 gcc 16.2.1 20261122 znver4 yes 0 of 53
linux (Arch) core 7.3.6.arch1-1 gcc 16.2.1 20260810 generic yes 0 of 111

In this set, the defect is absent with kernel 6.18 instead of 7.3, with clang and ThinLTO instead of GCC, and with an x86-64, x86-64-v3 or x86-64-v4 target instead of -march=znver4 (CONFIG_MZEN4). Every CachyOS build here used pahole 1:1.32-2 and -O3 (Arch: 1:1.32-1 and -O2), so the set does not show whether the pahole release or -O3 matters.

Of the 7.3 kernels in cachyos-znver4, the table leaves out only linux-cachyos-bmq 7.3.6-1, which is built without sched_ext.

On this machine the line is in the kernel log of all 24 boots whose start the journal still holds, from 2026-10-29 to 2026-11-25. They ran the server packages 7.3.0-2, 7.3.1-1, 7.3.3-1, 7.3.4-1, 7.3.5-1, 7.3.5-2 and 7.3.6-1. The journal has no start lines of an older boot, so the last good kernel on this machine is not on record.

Steps to reproduce
  1. Install linux-cachyos-server and linux-cachyos-server-headers 7.3.6-1 from cachyos-znver4, and bpf for bpftool.
  2. Boot that kernel and run the first block.
  3. Run the second block. It needs no boot, because it reads the image that the -headers package ships.
$ journalctl -k -b -o cat | grep sched_ext
sched_ext: Failed to register kfunc sets (-22)
$ ls /sys/kernel/sched_ext
ls: cannot access '/sys/kernel/sched_ext': No such file or directory
$ bpftool btf dump file /sys/kernel/btf/vmlinux format raw 2>/dev/null | grep -c "FUNC 'scx_bpf_error_bstr'"
0
$ bpftool btf dump file /sys/kernel/btf/vmlinux format raw 2>/dev/null | grep -c "FUNC 'scx_bpf_exit_bstr'"
1
$ grep -c ' scx_bpf_error_bstr$' /proc/kallsyms
1
$ bpftool btf dump file /usr/lib/modules/7.3.6-1-cachyos-server/build/vmlinux format raw | grep -c "FUNC 'scx_bpf_error_bstr'"
0
Expected behavior

sched_ext initializes at boot, and scx_loader starts the configured scheduler.

Actual behavior

sched_ext stays off for the whole boot. scx_loader tries five times and gives up. scxctl get still answers running Lavd in Gaming mode.

Logs / stack traces
Kernel log:
sched_ext: Failed to register kfunc sets (-22)

Two lines of "journalctl -u scx_loader -b -o cat":
Error: Failed to open or read file "/sys/kernel/sched_ext/hotplug_seq"
[ERROR]: Failed to start scheduler (attempt 5/5)

Summary of a readelf, od and bpftool read of build/vmlinux of
linux-cachyos-server 7.3.6-1 (cachyos-znver4). The script is available on request.
  set scx_kfunc_ids_any: 44 entries, 1 entry is 0, 43 resolve to a BTF FUNC
  declared in the set, without a BTF FUNC: scx_bpf_error_bstr
  BTF has:    scx_bpf_dump_bstr, scx_bpf_dump_bstr_impl, scx_bpf_exit_bstr, scx_bpf_exit_bstr_impl
  BTF lacks:  scx_bpf_error_bstr, scx_bpf_error_bstr_impl
  System.map: scx_bpf_error_bstr is present
  the other 10 scx kfunc sets: no entry of 0
Additional system information

The refusal, in the v7.3.6 source. btf_check_kfunc_protos() returns -EINVAL for an id that is not a FUNC (kernel/bpf/btf.c, lines 8965 to 8967), and id 0 is the void type. scx_init() then prints the line and returns before it creates /sys/kernel/sched_ext (kernel/sched/ext/ext.c, lines 11530, 11531 and 11564).

The cause, shown on one affected build. The cachyos-znver4 repo ships the unstripped vmlinux of linux-cachyos-gcc 7.3.6-1 as linux-cachyos-gcc-dbg. It has the same build ID as the vmlinux of the matching -headers package (the second row of the table). Its DWARF gives data__sz of scx_bpf_error_bstr() the single location DW_OP_reg6 (RBP), the callee-saved register that the prologue moves it to. It gives fmt, data and aux their argument registers RDI, RSI and RCX. pahole 1:1.32-2, run on that vmlinux with the flags that scripts/Makefile.btf sets for pahole 1.32 and with -V, prints this line and writes no FUNC for the function:

scx_bpf_error_bstr : skipping BTF encoding of function due to unexpected register usage for parameter

In the cachyos-v3 build of the same package, the location list of data__sz starts in RDX, and the same pahole run encodes the function. In the same znver4 build, data__sz of scx_bpf_exit_bstr() starts in RDX, and pahole encodes that function. The other five affected kernels have no current -dbg package.

The same class upstream. Upstream worked around this failure for another kfunc in 7.4 with commit f2f095c87603, "sched_ext: Work around pahole 1.32 dropping scx_bpf_task_set_lazy_resched() from BTF" (https://git.kernel.org/torvalds/c/f2f095c87603). Its message says that clang described an argument only after the prologue moved it into a callee-saved register, and that pahole 1.32 rejects that. The commit keeps the argument in memory with barrier_data().

A downstream workaround exists. SkillFishOS builds 7.3 with gcc -O3 -march=znver2, reports this same drop of scx_bpf_error_bstr, and carries a one-line workaround: barrier_data(&data__sz); at the start of the function (https://github.com/MTSistemi/SkillFishOS/blob/26cf2e60ebab7651d790f68f0cd14953b99e600d/kernel-build/userpatches-350/0212-nostra-0022-scx-error-bstr-btf-znver2.mypatch). Its patch names the same DW_OP_reg6 location, and it says that a generic x86-64 build and an -O2 build are not affected. Nobody built or tested that patch for this report.

A check on your side. The build log of an affected package should hold the resolve_btfids warning that the SkillFishOS patch quotes: no BTF func for kfunc scx_bpf_error_bstr in scx_kfunc_ids_any. I have no CachyOS build log.

Upstream on 2026-11-25. torvalds/linux master (4dce97c6c265) has no barrier_data() call in scx_bpf_error_bstr(). The newest tag in pahole.git on git.kernel.org is v1.32.

Seen elsewhere. A user posted the same kernel line for 7.3.3-1-cachyos-bore in the CachyOS Discord channel core on 2026-11-07.

Request. Could the znver4 GCC builds carry a workaround of this kind until pahole or upstream has a fix? The second block under "Steps to reproduce", with the new version in the path, checks a rebuilt package without a boot.

An AI agent ran the searches and the commands on my machine and drafted this report. I approved it for filing. The measurements come from those commands. Source lines, commits and tags come from the public sources named above.

Dominant language
Shell
Stars
4.9k
Forks
190
Avg merge
1d 3h
Merged PRs (30d)
2

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from CachyOS/linux-cachyos

All issues in CachyOS/linux-cachyos

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.