Skip to content

Commit

Permalink
get layered past stress test
Browse files Browse the repository at this point in the history
  • Loading branch information
likewhatevs committed Sep 11, 2024
1 parent fb656f5 commit 4d1ba01
Show file tree
Hide file tree
Showing 6 changed files with 310 additions and 165 deletions.
5 changes: 2 additions & 3 deletions rust/scx_utils/src/compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ pub fn check_min_requirements() -> Result<()> {
// ec7e3b0463e1 ("implement-ops") in https://github.com/sched-ext/sched_ext
// is the current minimum required kernel version.
// if let Ok(false) | Err(_) = struct_has_field("sched_ext_ops", "dump") {
// bail!("sched_ext_ops.dump() missing, kernel too old?");
// bail!("sched_ext_ops.dump() missing, kernel too old?");
// }
Ok(())
}
Expand All @@ -187,7 +187,6 @@ macro_rules! scx_ops_open {
};

let ops = skel.struct_ops.[<$ops _mut>]();
// ahh think this part matters a lot.
// let path = std::path::Path::new("/sys/kernel/sched_ext/hotplug_seq");

// let val = match std::fs::read_to_string(&path) {
Expand Down Expand Up @@ -219,7 +218,7 @@ macro_rules! scx_ops_open {
macro_rules! scx_ops_load {
($skel: expr, $ops: ident, $uei: ident) => { 'block: {
scx_utils::paste! {
// scx_utils::uei_set_size!($skel, $ops, $uei);
//scx_utils::uei_set_size!($skel, $ops, $uei);
$skel.load().context("Failed to load BPF program")
}
}};
Expand Down
2 changes: 1 addition & 1 deletion rust/scx_utils/src/user_exit_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This software may be used and distributed according to the terms of the
// GNU General Public License version 2.
use crate::bindings;
//use crate::bindings;
use crate::compat;
use anyhow::bail;
use anyhow::Result;
Expand Down
13 changes: 11 additions & 2 deletions scheds/include/scx/user_exit_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ enum uei_sizes {
};

struct user_exit_info {
int type;
int kind;
// s64 exit_code;
char reason[UEI_REASON_LEN];
char msg[UEI_MSG_LEN];
Expand All @@ -28,6 +28,15 @@ struct user_exit_info {
#include "vmlinux.h"
#include <bpf/bpf_core_read.h>

static inline void uei_record(struct user_exit_info *uei,
const struct scx_exit_info *ei)
{
bpf_probe_read_kernel_str(uei->reason, sizeof(uei->reason), ei->reason);
bpf_probe_read_kernel_str(uei->msg, sizeof(uei->msg), ei->msg);
/* use __sync to force memory barrier */
__sync_val_compare_and_swap(&uei->kind, uei->kind, ei->type);
}

#define UEI_DEFINE(__name) \
char RESIZABLE_ARRAY(data, __name##_dump); \
const volatile u32 __name##_dump_len; \
Expand Down Expand Up @@ -61,7 +70,7 @@ struct user_exit_info {

#define UEI_EXITED(__skel, __uei_name) ({ \
/* use __sync to force memory barrier */ \
__sync_val_compare_and_swap(&(__skel)->data->__uei_name.type, -1, -1); \
__sync_val_compare_and_swap(&(__skel)->data->__uei_name.kind, -1, -1); \
})

#define UEI_REPORT(__skel, __uei_name) ({ \
Expand Down
Loading

0 comments on commit 4d1ba01

Please sign in to comment.