Skip to content

Commit

Permalink
Merge pull request #1020 from likewhatevs/fix-build
Browse files Browse the repository at this point in the history
scx: fix build
  • Loading branch information
likewhatevs authored Dec 2, 2024
2 parents c6486d1 + 5c3f427 commit 91b147c
Show file tree
Hide file tree
Showing 21 changed files with 121 additions and 137 deletions.
7 changes: 6 additions & 1 deletion .github/actions/install-deps-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ runs:
linux-headers-generic linux-tools-common linux-tools-generic make \
ninja-build pahole pkg-config python3-dev python3-pip python3-requests \
qemu-kvm rsync stress-ng udev zstd libseccomp-dev libcap-ng-dev \
llvm clang python3-full curl meson bpftrace cargo rustc dwarves
llvm clang python3-full curl meson bpftrace dwarves rustup
shell: bash
# ensure some toolchain is installed
- run: |
rustup default nightly
shell: bash
# virtme-ng
Expand Down
4 changes: 1 addition & 3 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
[toolchain]
channel = "nightly-2024-09-10"
components = [ "rustfmt", "rustc-dev" ]
profile = "minimal"
channel = "nightly-2024-11-26"
2 changes: 1 addition & 1 deletion rust/scx_loader/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ use std::path::Path;
use anyhow::Result;
use serde::Deserialize;

use crate::get_name_from_scx;
use crate::SchedMode;
use crate::SupportedSched;
use crate::get_name_from_scx;

#[derive(Debug, PartialEq, Default, Deserialize)]
#[serde(default)]
Expand Down
17 changes: 7 additions & 10 deletions rust/scx_loader/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ mod config;
mod logger;

use std::process::Stdio;
use std::sync::Arc;
use std::sync::atomic::AtomicU32;
use std::sync::atomic::Ordering;
use std::sync::Arc;

use anyhow::Context;
use anyhow::Result;
Expand All @@ -25,8 +25,8 @@ use tokio::sync::mpsc::UnboundedReceiver;
use tokio::sync::mpsc::UnboundedSender;
use tokio::time::Duration;
use tokio::time::Instant;
use zbus::interface;
use zbus::Connection;
use zbus::interface;
use zvariant::Type;
use zvariant::Value;

Expand Down Expand Up @@ -319,14 +319,11 @@ async fn main() -> Result<()> {
let connection = Connection::system().await?;
connection
.object_server()
.at(
"/org/scx/Loader",
ScxLoader {
current_scx: None,
current_mode: SchedMode::Auto,
channel: channel.clone(),
},
)
.at("/org/scx/Loader", ScxLoader {
current_scx: None,
current_mode: SchedMode::Auto,
channel: channel.clone(),
})
.await?;

connection.request_name("org.scx.Loader").await?;
Expand Down
33 changes: 15 additions & 18 deletions scheds/rust/scx_bpfland/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,29 @@ use std::ffi::c_int;
use std::fs::File;
use std::io::Read;
use std::mem::MaybeUninit;
use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering;
use std::sync::Arc;
use std::time::Duration;

use anyhow::bail;
use anyhow::Context;
use anyhow::Result;
use anyhow::bail;
use clap::Parser;
use crossbeam::channel::RecvTimeoutError;
use libbpf_rs::OpenObject;
use libbpf_rs::ProgramInput;
use libbpf_rs::skel::OpenSkel;
use libbpf_rs::skel::Skel;
use libbpf_rs::skel::SkelBuilder;
use libbpf_rs::OpenObject;
use libbpf_rs::ProgramInput;
use log::info;
use log::warn;
use scx_stats::prelude::*;
use scx_utils::CoreType;
use scx_utils::Cpumask;
use scx_utils::NR_CPU_IDS;
use scx_utils::Topology;
use scx_utils::UserExitInfo;
use scx_utils::build_id;
use scx_utils::import_enums;
use scx_utils::scx_enums;
Expand All @@ -43,11 +48,6 @@ use scx_utils::scx_ops_open;
use scx_utils::set_rlimit_infinity;
use scx_utils::uei_exited;
use scx_utils::uei_report;
use scx_utils::CoreType;
use scx_utils::Cpumask;
use scx_utils::Topology;
use scx_utils::UserExitInfo;
use scx_utils::NR_CPU_IDS;
use stats::Metrics;

const SCHEDULER_NAME: &'static str = "scx_bpfland";
Expand Down Expand Up @@ -406,15 +406,12 @@ impl<'a> Scheduler<'a> {
"powersave" => 0,
_ => -1,
};
info!(
"cpufreq performance level: {}",
match perf_lvl {
1024 => "max".into(),
0 => "min".into(),
n if n < 0 => "auto".into(),
_ => perf_lvl.to_string(),
}
);
info!("cpufreq performance level: {}", match perf_lvl {
1024 => "max".into(),
0 => "min".into(),
n if n < 0 => "auto".into(),
_ => perf_lvl.to_string(),
});
skel.maps.bss_data.cpufreq_perf_lvl = perf_lvl;

Ok(())
Expand Down
4 changes: 2 additions & 2 deletions scheds/rust/scx_bpfland/src/stats.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use std::io::Write;
use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering;
use std::sync::Arc;
use std::time::Duration;

use anyhow::Result;
use scx_stats::prelude::*;
use scx_stats_derive::stat_doc;
use scx_stats_derive::Stats;
use scx_stats_derive::stat_doc;
use serde::Deserialize;
use serde::Serialize;

Expand Down
12 changes: 6 additions & 6 deletions scheds/rust/scx_flash/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,26 @@ use std::ffi::c_int;
use std::fs::File;
use std::io::Read;
use std::mem::MaybeUninit;
use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering;
use std::sync::Arc;
use std::time::Duration;

use anyhow::bail;
use anyhow::Context;
use anyhow::Result;
use anyhow::bail;
use clap::Parser;
use crossbeam::channel::RecvTimeoutError;
use libbpf_rs::OpenObject;
use libbpf_rs::ProgramInput;
use libbpf_rs::skel::OpenSkel;
use libbpf_rs::skel::Skel;
use libbpf_rs::skel::SkelBuilder;
use libbpf_rs::OpenObject;
use libbpf_rs::ProgramInput;
use log::info;
use log::warn;
use scx_stats::prelude::*;
use scx_utils::Topology;
use scx_utils::UserExitInfo;
use scx_utils::build_id;
use scx_utils::import_enums;
use scx_utils::scx_enums;
Expand All @@ -43,8 +45,6 @@ use scx_utils::scx_ops_open;
use scx_utils::set_rlimit_infinity;
use scx_utils::uei_exited;
use scx_utils::uei_report;
use scx_utils::Topology;
use scx_utils::UserExitInfo;
use stats::Metrics;

const SCHEDULER_NAME: &'static str = "scx_flash";
Expand Down
2 changes: 1 addition & 1 deletion scheds/rust/scx_flash/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
// GNU General Public License version 2.

use std::io::Write;
use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering;
use std::sync::Arc;
use std::time::Duration;

use anyhow::Result;
Expand Down
14 changes: 7 additions & 7 deletions scheds/rust/scx_lavd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ mod stats;
use std::cell::Cell;
use std::cell::RefCell;
use std::collections::BTreeMap;
use std::ffi::c_int;
use std::ffi::CStr;
use std::ffi::c_int;
use std::fmt;
use std::fs::File;
use std::io::Read;
use std::mem;
use std::mem::MaybeUninit;
use std::str;
use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering;
use std::sync::Arc;
use std::thread::ThreadId;
use std::time::Duration;

Expand All @@ -38,17 +38,20 @@ use crossbeam::channel::RecvTimeoutError;
use crossbeam::channel::Sender;
use crossbeam::channel::TrySendError;
use itertools::iproduct;
use libbpf_rs::OpenObject;
use libbpf_rs::ProgramInput;
use libbpf_rs::skel::OpenSkel;
use libbpf_rs::skel::Skel;
use libbpf_rs::skel::SkelBuilder;
use libbpf_rs::OpenObject;
use libbpf_rs::ProgramInput;
use libc::c_char;
use log::debug;
use log::info;
use log::warn;
use plain::Plain;
use scx_stats::prelude::*;
use scx_utils::NR_CPU_IDS;
use scx_utils::Topology;
use scx_utils::UserExitInfo;
use scx_utils::build_id;
use scx_utils::import_enums;
use scx_utils::scx_enums;
Expand All @@ -58,9 +61,6 @@ use scx_utils::scx_ops_open;
use scx_utils::set_rlimit_infinity;
use scx_utils::uei_exited;
use scx_utils::uei_report;
use scx_utils::Topology;
use scx_utils::UserExitInfo;
use scx_utils::NR_CPU_IDS;
use stats::SchedSample;
use stats::SchedSamples;
use stats::StatsReq;
Expand Down
17 changes: 7 additions & 10 deletions scheds/rust/scx_lavd/src/stats.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
use std::collections::BTreeMap;
use std::io::Write;
use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering;
use std::sync::Arc;
use std::thread::ThreadId;
use std::time::Duration;

use anyhow::bail;
use anyhow::Result;
use anyhow::bail;
use gpoint::GPoint;
use scx_stats::prelude::*;
use scx_stats_derive::stat_doc;
use scx_stats_derive::Stats;
use scx_stats_derive::stat_doc;
use serde::Deserialize;
use serde::Serialize;

Expand Down Expand Up @@ -333,13 +333,10 @@ pub fn server_data(nr_cpus_onln: u64) -> StatsServerData<StatsReq, StatsRes> {
.add_meta(SysStats::meta())
.add_ops("top", StatsOps { open, close: None })
.add_meta(SchedSample::meta())
.add_ops(
"sched_samples",
StatsOps {
open: samples_open,
close: None,
},
)
.add_ops("sched_samples", StatsOps {
open: samples_open,
close: None,
})
}

pub fn monitor_sched_samples(nr_samples: u64, shutdown: Arc<AtomicBool>) -> Result<()> {
Expand Down
2 changes: 1 addition & 1 deletion scheds/rust/scx_layered/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use anyhow::Result;
use serde::Deserialize;
use serde::Serialize;

use crate::bpf_intf;
use crate::LayerGrowthAlgo;
use crate::bpf_intf;

#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(transparent)]
Expand Down
2 changes: 1 addition & 1 deletion scheds/rust/scx_layered/src/layer_core_growth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use scx_utils::Topology;
use serde::Deserialize;
use serde::Serialize;

use crate::bpf_intf;
use crate::CpuPool;
use crate::LayerSpec;
use crate::bpf_intf;

#[derive(Clone, Debug, Parser, Serialize, Deserialize)]
#[clap(rename_all = "snake_case")]
Expand Down
2 changes: 1 addition & 1 deletion scheds/rust/scx_layered/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ pub mod bpf_intf;

use std::collections::BTreeMap;

use anyhow::bail;
use anyhow::Result;
use anyhow::bail;
use bitvec::prelude::*;
pub use config::LayerCommon;
pub use config::LayerConfig;
Expand Down
Loading

0 comments on commit 91b147c

Please sign in to comment.