Expand description
Build script support for a Rust BPF sched_ext scheduler: build its no_std BPF crate for the BPF target with the toolchain that builds the scheduler, and add to each object’s BTF what the Rust toolchain does not emit. A scheduler’s build.rs fills a Spec and calls build().
Re-exports§
pub(crate) use env;🔒pub(crate) use env;🔒pub(crate) use ffi::CString;🔒pub(crate) use fs;🔒pub(crate) use path::PathBuf;🔒pub(crate) use process::Command;🔒pub(crate) use libbpf_rs::libbpf_sys;🔒
Modules§
- catalog 🔒
Macros§
- kfuncs
- Expand a kfunc catalog, see scx_rustsched’s kfuncs.rs, into a
kfuncs()function listing it for Spec.
Structs§
- Kfunc
- A kfunc of the catalog in scx_rustsched’s kfuncs.rs: its name, parameters and return type, whether a kernel may lack it, and whether it takes a trailing size parameter on kernels that pass the structure’s size.
- Spec
- What a Rust BPF scheduler hands the build: where its BPF crate is, what it calls and reads from the kernel, and the object variants to build.
Enums§
- Ty
- The parameter and return types the catalog names, see the BPF side’s aliases in scx_rustsched’s src/kfuncs.rs.
Constants§
- KSYM_
DOMAIN_ POINTER - KSYM_
INT - The kinds of per-CPU kernel variables, see Spec: an int, a struct sched_domain pointer or a struct rq.
- KSYM_RQ
- RUNTIME_
KSYMS - The per-CPU kernel variables scx_rustsched reads.
Functions§
- add_btf 🔒
- Add to the BTF of
objectwhat the Rust toolchain does not emit: the kfuncs’ prototypes and.ksymsentries, the ksym variables, and thearg:trustedtags, and replace the object’s.BTFsection with it. - build
- Build the BPF crate of
specfor each of its variants, with the toolchain that builds the scheduler or the rustup toolchain BPF_RUST_TOOLCHAIN names, and patch each object’s BTF. - build_
default - Build the BPF crate in bpf/ beside the build script, for a scheduler
that calls and reads nothing from the kernel but through scx_rustsched: the
runtime’s kfuncs, kernel variables and global functions, and an object
for each kind of kernel. The whole build script of such a scheduler is
fn main() { scx_rustsched_build::build_default(); }. - checked 🔒
- missing_
tools 🔒 - What the Rust BPF build needs that this host lacks: the toolchain with rust-src, bpf-linker and llvm-objcopy.
- resolved 🔒 ⚠
- The type
idnames once its typedefs and qualifiers are peeled off. - runs 🔒
- Whether
programruns withargs. - runtime_
kfuncs - The kfuncs of scx_rustsched’s catalog.
- trusted_
arguments 🔒 ⚠ - The parameters of the object’s global functions that are a pointer to a task_struct, as (function, parameter index).
- undefined_
symbols 🔒