Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scx schedulers installed from cargo are segfaulting #1074

Open
arighi opened this issue Dec 8, 2024 · 7 comments
Open

scx schedulers installed from cargo are segfaulting #1074

arighi opened this issue Dec 8, 2024 · 7 comments
Labels
bug Something isn't working build Build related issues

Comments

@arighi
Copy link
Contributor

arighi commented Dec 8, 2024

ubuntu@ubuntu:~$ sudo ~/.cargo/bin/scx_bpfland
08:40:08 [INFO] scx_bpfland 1.0.8 x86_64-unknown-linux-gnu SMT off
...
Segmentation fault
ubuntu@ubuntu:~$ sudo ~/.cargo/bin/scx_lavd
08:40:13 [INFO] Autopilot mode is enabled by default.
...
Segmentation fault

It seems to happen both on Ubuntu and CachyOS.

@likewhatevs
Copy link
Contributor

gentoo also (so probably everywhere)

@JohnRTitor
Copy link

JohnRTitor commented Dec 8, 2024

I believe we had the same problem on NixOS (#927), it was solved by adding proper include paths of compiled libbpf through environment variables BPF_EXTRA_CFLAGS_PRE_INCL and RUSTFLAGS.

https://github.com/NixOS/nixpkgs/blob/909365d2203fe5570203a5032af3a564b6ab4705/pkgs/os-specific/linux/scx/scx_rustscheds.nix#L37-L48

If that's hard to read, we are just adding include paths of the compiled libbpf.

When using meson to compile scx, this is done automatically.

scx/meson.build

Lines 321 to 327 in b4db5ee

foreach header: libbpf_h
cargo_env.append('BPF_EXTRA_CFLAGS_PRE_INCL', '-I' + header, separator: ' ')
endforeach
cargo_env.append('RUSTFLAGS',
'-C relocation-model=pic -C link-args=-lelf -C link-args=-lz -C link-args=-lzstd -L '
+ fs.parent(libbpf_a), separator: ' ')

@etsal
Copy link
Contributor

etsal commented Dec 8, 2024

gentoo also (so probably everywhere)

Yeah can reproduce on arch too.

@likewhatevs
Copy link
Contributor

likewhatevs commented Dec 9, 2024

BTW i think the "fix" is folks need to install scx schedulers using cargo install --locked. Not the first time I've seen this on a project (iirc zellij does that also), so maybe this is why.

  • that or (maybe and) we pin more versions of packages to avoid this issue.

@likewhatevs
Copy link
Contributor

something is pulling in libbpf-sys v1.5.0+v1.5.0 when cargo install runs so I think pinning to versions specified here might fix this: #1015

@etsal
Copy link
Contributor

etsal commented Dec 9, 2024

I think that's fair as a temporary measure, however we should also check why 1.5.0 is failing because we need it to support multiple compilation units in Rust.

@etsal
Copy link
Contributor

etsal commented Dec 9, 2024

Turns out that the versions specified in #1015 are perfectly fine for multiple compilation units, so there is no downside to going with them.

@hodgesds hodgesds added bug Something isn't working build Build related issues labels Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working build Build related issues
Projects
None yet
Development

No branches or pull requests

5 participants