diff --git a/.clangd b/.clangd new file mode 100644 index 000000000..d25c55292 --- /dev/null +++ b/.clangd @@ -0,0 +1,2 @@ +CompileFlags: + Add: [-DLSP, -Wno-missing-declarations, -Wno-typedef-redefinition, -Wno-ignored-attributes, -xc] \ No newline at end of file diff --git a/rust/scx_rustland_core/assets/bpf/main.bpf.c b/rust/scx_rustland_core/assets/bpf/main.bpf.c index d373c8c1a..a832bee28 100644 --- a/rust/scx_rustland_core/assets/bpf/main.bpf.c +++ b/rust/scx_rustland_core/assets/bpf/main.bpf.c @@ -27,7 +27,13 @@ * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ +#ifdef LSP +#define __bpf__ +#include "../../../../scheds/include/scx/common.bpf.h" +#else #include +#endif + #include "intf.h" char _license[] SEC("license") = "GPL"; diff --git a/scheds/include/scx/common.bpf.h b/scheds/include/scx/common.bpf.h index 848f5ee13..593fdb9fc 100644 --- a/scheds/include/scx/common.bpf.h +++ b/scheds/include/scx/common.bpf.h @@ -7,7 +7,13 @@ #ifndef __SCX_COMMON_BPF_H #define __SCX_COMMON_BPF_H +#ifdef LSP +#define __bpf__ +#include "../vmlinux/vmlinux.h" +#else #include "vmlinux.h" +#endif + #include #include #include diff --git a/scheds/include/scx/user_exit_info.h b/scheds/include/scx/user_exit_info.h index 891693ee6..8ce273440 100644 --- a/scheds/include/scx/user_exit_info.h +++ b/scheds/include/scx/user_exit_info.h @@ -25,7 +25,11 @@ struct user_exit_info { #ifdef __bpf__ +#ifdef LSP +#include "../vmlinux/vmlinux.h" +#else #include "vmlinux.h" +#endif #include #define UEI_DEFINE(__name) \ diff --git a/scheds/rust/scx_layered/src/bpf/intf.h b/scheds/rust/scx_layered/src/bpf/intf.h index b76030775..0037b0bdf 100644 --- a/scheds/rust/scx_layered/src/bpf/intf.h +++ b/scheds/rust/scx_layered/src/bpf/intf.h @@ -20,7 +20,12 @@ typedef unsigned u32; typedef unsigned long long u64; #endif +#ifdef LSP +#define __bpf__ +#include "../../../../include/scx/ravg.bpf.h" +#else #include +#endif enum consts { MAX_CPUS_SHIFT = 9, diff --git a/scheds/rust/scx_layered/src/bpf/main.bpf.c b/scheds/rust/scx_layered/src/bpf/main.bpf.c index d5ba2a4c2..72a700583 100644 --- a/scheds/rust/scx_layered/src/bpf/main.bpf.c +++ b/scheds/rust/scx_layered/src/bpf/main.bpf.c @@ -1,6 +1,13 @@ /* Copyright (c) Meta Platforms, Inc. and affiliates. */ +#ifdef LSP +#define __bpf__ +#include "../../../../include/scx/common.bpf.h" +#include "../../../../include/scx/ravg_impl.bpf.h" +#else #include #include +#endif + #include "intf.h" #include diff --git a/scheds/rust/scx_mitosis/src/bpf/intf.h b/scheds/rust/scx_mitosis/src/bpf/intf.h index 59c5ac240..1b3dffd66 100644 --- a/scheds/rust/scx_mitosis/src/bpf/intf.h +++ b/scheds/rust/scx_mitosis/src/bpf/intf.h @@ -11,7 +11,12 @@ typedef unsigned int u32; typedef _Bool bool; #endif +#ifdef LSP +#define __bpf__ +#include "../../../../include/scx/ravg.bpf.h" +#else #include +#endif enum consts { MAX_CPUS_SHIFT = 9, diff --git a/scheds/rust/scx_mitosis/src/bpf/mitosis.bpf.c b/scheds/rust/scx_mitosis/src/bpf/mitosis.bpf.c index 875b8eb64..e53d63432 100644 --- a/scheds/rust/scx_mitosis/src/bpf/mitosis.bpf.c +++ b/scheds/rust/scx_mitosis/src/bpf/mitosis.bpf.c @@ -11,9 +11,18 @@ * Each cell has an associated DSQ which it uses for vtime scheduling of the * cgroups belonging to the cell. */ + #include "intf.h" + +#ifdef LSP +#define __bpf__ +#include "../../../../include/scx/common.bpf.h" +#include "../../../../include/scx/ravg_impl.bpf.h" +#else #include #include +#endif + char _license[] SEC("license") = "GPL"; diff --git a/scheds/rust/scx_rusty/src/bpf/intf.h b/scheds/rust/scx_rusty/src/bpf/intf.h index 29143d81f..ac8dc4155 100644 --- a/scheds/rust/scx_rusty/src/bpf/intf.h +++ b/scheds/rust/scx_rusty/src/bpf/intf.h @@ -19,7 +19,12 @@ typedef unsigned int u32; typedef unsigned long long u64; #endif +#ifdef LSP +#define __bpf__ +#include "../../../../include/scx/ravg.bpf.h" +#else #include +#endif enum consts { MAX_CPUS = 512, diff --git a/scheds/rust/scx_rusty/src/bpf/main.bpf.c b/scheds/rust/scx_rusty/src/bpf/main.bpf.c index 4764b1d25..4d42ad82d 100644 --- a/scheds/rust/scx_rusty/src/bpf/main.bpf.c +++ b/scheds/rust/scx_rusty/src/bpf/main.bpf.c @@ -35,8 +35,16 @@ * task weight, dom mask and current dom in the task_data map and executes the * load balance based on userspace populating the lb_data map. */ + +#ifdef LSP +#define __bpf__ +#include "../../../../include/scx/common.bpf.h" +#include "../../../../include/scx/ravg_impl.bpf.h" +#else #include #include +#endif + #include "intf.h" #include