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

enable ide's etc. to work on the bpf.c files #668

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CompileFlags:
Add: [-DLSP, -Wno-missing-declarations, -Wno-typedef-redefinition, -Wno-ignored-attributes, -xc]
likewhatevs marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 6 additions & 0 deletions rust/scx_rustland_core/assets/bpf/main.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <scx/common.bpf.h>
#endif

#include "intf.h"

char _license[] SEC("license") = "GPL";
Expand Down
6 changes: 6 additions & 0 deletions scheds/include/scx/common.bpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
#include <asm-generic/errno.h>
Expand Down
4 changes: 4 additions & 0 deletions scheds/include/scx/user_exit_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ struct user_exit_info {

#ifdef __bpf__

#ifdef LSP
#include "../vmlinux/vmlinux.h"
#else
#include "vmlinux.h"
#endif
#include <bpf/bpf_core_read.h>

#define UEI_DEFINE(__name) \
Expand Down
5 changes: 5 additions & 0 deletions scheds/rust/scx_layered/src/bpf/intf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <scx/ravg.bpf.h>
#endif

enum consts {
MAX_CPUS_SHIFT = 9,
Expand Down
7 changes: 7 additions & 0 deletions scheds/rust/scx_layered/src/bpf/main.bpf.c
Original file line number Diff line number Diff line change
@@ -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 <scx/common.bpf.h>
#include <scx/ravg_impl.bpf.h>
#endif

#include "intf.h"

#include <errno.h>
Expand Down
5 changes: 5 additions & 0 deletions scheds/rust/scx_mitosis/src/bpf/intf.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ typedef unsigned int u32;
typedef _Bool bool;
#endif

#ifdef LSP
#define __bpf__
#include "../../../../include/scx/ravg.bpf.h"
#else
#include <scx/ravg.bpf.h>
#endif

enum consts {
MAX_CPUS_SHIFT = 9,
Expand Down
9 changes: 9 additions & 0 deletions scheds/rust/scx_mitosis/src/bpf/mitosis.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <scx/common.bpf.h>
#include <scx/ravg_impl.bpf.h>
#endif


char _license[] SEC("license") = "GPL";

Expand Down
5 changes: 5 additions & 0 deletions scheds/rust/scx_rusty/src/bpf/intf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <scx/ravg.bpf.h>
#endif

enum consts {
MAX_CPUS = 512,
Expand Down
8 changes: 8 additions & 0 deletions scheds/rust/scx_rusty/src/bpf/main.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <scx/common.bpf.h>
#include <scx/ravg_impl.bpf.h>
#endif

#include "intf.h"

#include <errno.h>
Expand Down
Loading