diff --git a/scheds/rust/scx_rustland/src/main.rs b/scheds/rust/scx_rustland/src/main.rs index b1e0b5a1c..d8cf90274 100644 --- a/scheds/rust/scx_rustland/src/main.rs +++ b/scheds/rust/scx_rustland/src/main.rs @@ -275,15 +275,32 @@ impl<'a> Scheduler<'a> { // Called on exit to get exit code and exit message from the BPF part. fn report_bpf_exit_kind(&mut self) -> Result<()> { + // Report msg if EXT_OPS_EXIT_ERROR. match self.read_bpf_exit_kind() { 0 => Ok(()), - etype => { + // etype can be one of the following (from include/linux/sched/ext.h): + // + // enum scx_exit_kind { + // SCX_EXIT_NONE, + // SCX_EXIT_DONE, + // + // SCX_EXIT_UNREG = 64, /* BPF unregistration */ + // SCX_EXIT_SYSRQ, /* requested by 'S' sysrq */ + // + // SCX_EXIT_ERROR = 1024, /* runtime error, error msg contains details */ + // SCX_EXIT_ERROR_BPF, /* ERROR but triggered through scx_bpf_error() */ + // SCX_EXIT_ERROR_STALL, /* watchdog detected stalled runnable tasks */ + // }; + etype if etype > 64 => { let cstr = unsafe { CStr::from_ptr(self.skel.bss().exit_msg.as_ptr() as *const _) }; let msg = cstr .to_str() .context("Failed to convert exit msg to string") .unwrap(); - info!("BPF exit_kind={} msg={}", etype, msg); + bail!("BPF exit_kind={} msg={}", etype, msg); + } + etype => { + info!("BPF exit_kind={}", etype); Ok(()) } }