Skip to content

SCHED_CLASS_EXT enablement#59190

Merged
Duncaen merged 4 commits intovoid-linux:masterfrom
CosmicToast:sched-ext
Mar 13, 2026
Merged

SCHED_CLASS_EXT enablement#59190
Duncaen merged 4 commits intovoid-linux:masterfrom
CosmicToast:sched-ext

Conversation

@CosmicToast
Copy link
Copy Markdown
Contributor

Testing the changes

  • I tested the changes in this PR: YES
    • Commits pushed from a system running the modified kernel and scx_lavd for the last several days
    • PR opened from system running scx_lavd (not the modified kernel, it's running linux-asahi) for the last week

New package

  • This new package conforms to the package requirements: YES, it should be installed system-wide and requires compilation

Local build testing

  • I built this PR locally for these architectures (if supported. mark crossbuilds):
    • aarch64-musl
    • x86_64-musl
    • i686 (cross-build using -A)

@CosmicToast
Copy link
Copy Markdown
Contributor Author

CosmicToast commented Feb 28, 2026

Creating this as draft because:

  1. These are highly related changes, and I couldn't find guidance in CONTRIBUTING besides

    Most pull requests should only contain a single package and dependencies which are not part of void-packages yet.

    In this case, scx-loader needs scx, and scx needs the modified kernel, so I opened the PR with all of them. Let me know if I should proceed otherwise.

  2. Most (useful) scx_ schedulers require debugfs. My approach here has been to add it as a core service and check for it in scx-loader/run, but it can be done in a number of different ways, e.g. mounting it as part of scx-loader/run, or simply requiring the user to have it in fstab.

  3. Both scx and scx-loader are marked as nocross. The error seems related to rust specifics when cross-compiling, so it's possible I just lack context for it, since I don't usually cross-compile with rust (and my system CC is typically clang). It's possible that this is a known issue (e.g. with the build_style or similar), so it would be nice to have comments so I can fix it (if possible).

  4. I marked myself as maintainer for the new packages. If it's too early to do this I'm perfectly happy to mark them as orphaned. scx-loader in particular shouldn't need many updates (while for scx it would be preferable).

CC @Duncaen let me know if you want any changes (seeing the above and the changeset in general)

@CosmicToast
Copy link
Copy Markdown
Contributor Author

force push is to resolve conflict (linux6.19 got updated to 6.19.5 in the meanwhile)

Comment thread srcpkgs/scx-loader/template Outdated
@CosmicToast CosmicToast marked this pull request as ready for review March 4, 2026 05:54
@CosmicToast
Copy link
Copy Markdown
Contributor Author

force push to correct typo that snuck in while fixing review comments (s/Nes/New/)

@CosmicToast
Copy link
Copy Markdown
Contributor Author

force push to rebase on latest linux6.19 bump

@Duncaen
Copy link
Copy Markdown
Member

Duncaen commented Mar 5, 2026

Cross compilation works if you unset the CFLAGS etc. and set target specific flags to work around this open cc-rs issue rust-lang/cc-rs#1469 where it will use the CFLAGS variable for both the host and the target.

--- a/srcpkgs/scx/template
+++ b/srcpkgs/scx/template
@@ -9,14 +9,26 @@ build_style=cargo
 make_check_args="-- --skip test_thread_operations"
 # based on package documentation
 # I suspect clang isn't actually used, and may resolve nocross
-makedepends="clang libbpf-devel bpftool elfutils-devel zlib-devel libzstd-devel pkgconf libseccomp-devel"
+hostmakedepends="clang pkg-config elfutils-devel libseccomp-devel"
+makedepends="libbpf-devel bpftool elfutils-devel zlib-devel libzstd-devel libseccomp-devel"
 short_desc="Sched_ext schedulers and tools"
 maintainer="Chloé Vulquin <code@toast.bunkerlabs.net>"
 license="GPL-2.0-only"
 homepage="https://github.com/sched-ext/scx"
 distfiles="https://github.com/sched-ext/scx/archive/refs/tags/v${version}.tar.gz"
 checksum=d9c6b3230915dafe21556da28c6ef2a11f272770f12912842ae1ad23b54d963e
-nocross="cargo:warning=cc1: error: bad value 'armv8-a' for '-march=' switch"
+
+pre_build() {
+       # workaround the cc-rs mixing CFLAGS for host and target.
+       # https://github.com/rust-lang/cc-rs/issues/1469
+       export CFLAGS_${RUST_BUILD//-/_}="${CFLAGS_host}" \
+               CXXFLAGS_${RUST_BUILD//-/_}="${CXXFLAGS_host}" \
+               LDFLAGS_${RUST_BUILD//-/_}="${LDFLAGS_host}" \
+               CFLAGS_${RUST_TARGET//-/_}="${CFLAGS}" \
+               CXXFLAGS_${RUST_TARGET//-/_}="${CXXFLAGS}" \
+               LDFLAGS_${RUST_TARGET//-/_}="${LDFLAGS}" \
+               CFLAGS="" CXXFLAGS="" LDFLAGS=""
+}
 
 # cargo install does not support workspaces
 # alternative: specify the wanted packages only

@CosmicToast
Copy link
Copy Markdown
Contributor Author

Thanks for letting me know! I'll test it locally saturday and add an update (will also make it easier for me to test building, -A is very slow).

@CosmicToast CosmicToast marked this pull request as draft March 5, 2026 20:37
@CosmicToast CosmicToast marked this pull request as ready for review March 7, 2026 05:42
@CosmicToast CosmicToast requested a review from Duncaen March 7, 2026 10:57
@Duncaen
Copy link
Copy Markdown
Member

Duncaen commented Mar 12, 2026

[ci skip][skip ci]

@Duncaen Duncaen merged commit 2b87e3f into void-linux:master Mar 13, 2026
0 of 8 checks passed
@Jipok
Copy link
Copy Markdown

Jipok commented Mar 22, 2026

Glad to see this. Maintaining my own kernel version with scx was inconvenient. Will you add this to linux-lts? That would be great.

@Jipok
Copy link
Copy Markdown

Jipok commented Mar 22, 2026

_scx_bins="scx_beerland scx_bpfland scx_chaos scx_cosmos scx_flash scx_lavd scx_layered scx_mitosis scx_p2dq scx_rlfifo scx_rustland scx_rusty scx_tickless scx_wd40 scxcash scxtop"

# Instruct cargo to only compile the specified binaries (skips selftests that crash/bloat compilation)
make_build_args="--bin ${_scx_bins// / --bin }"

do_install() {
	for bin in ${_scx_bins}; do
		vbin "target/${RUST_TARGET}/release/${bin}"
	done
}

Wouldn't this implementation be cleaner?

@CosmicToast
Copy link
Copy Markdown
Contributor Author

Wouldn't this implementation be cleaner?

That's what this comment is about: "alternative: specify the wanted packages only".

The reason I didn't ultimately go for this is that the list of bundled schedulers changes semi-regularly, so whenever a version bump is warranted it would require checking for which new ones exist, figuring out whether they should be included or exist purely as examples, etc.
Including everything programmatically is just a lot easier in the long run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants