Commit Graph

679 Commits

Author SHA1 Message Date
David Vernet
ffced1f615
rusty: Remove explicit padding
As of libbpf-rs 0.23.0 (which contains commit
9d9e979fcf),
libbpf-rs now generates rust structs that honor padding. We can
therefore remove the custom padding in scx_rusty's struct pcpu_ctx.

For example, here is the generated pub struct pcpu_ctx:

pub struct pcpu_ctx {
    pub dom_rr_cur: u32,
    pub dom_id: u32,
    pub nr_node_doms: u32,
    pub node_doms: [u32; 64],
    pub __pad_268: [u8; 52],
}

And here is the matching struct in the BPF object file:

struct pcpu_ctx {
        u32                        dom_rr_cur;           /*     0     4 */
        u32                        dom_id;               /*     4     4 */
        u32                        nr_node_doms;         /*     8     4 */
        u32                        node_doms[64];        /*    12   256 */

        /* size: 320, cachelines: 5, members: 4 */
        /* padding: 52 */
} __attribute__((__aligned__(64)));

Signed-off-by: David Vernet <void@manifault.com>
2024-04-12 13:52:13 -05:00
David Vernet
5404303bc2
Merge pull request #228 from sched-ext/refactor
Small rusty cleanup
2024-04-12 10:02:09 -05:00
David Vernet
e032ee7cc0
rusty: Add lookup_pcpu_ctx() helper
Getting rid of more boilerplate

Signed-off-by: David Vernet <void@manifault.com>
2024-04-11 19:30:23 -05:00
David Vernet
885a9fd7da
rusty: Make lookup_task_ctx() static
It doesn't need to be a global prog. Let's make it static.

Signed-off-by: David Vernet <void@manifault.com>
2024-04-11 19:30:23 -05:00
David Vernet
0ff73754cf
rusty: Add create_save_cpumask() helper
We have a lot of boilerplate code where we create a cpumask, initialize
it, and then bpf_kptr_xchg() it into the map. In an effort to slightly
reduce the amount of boilerplate, let's create a helper that can
alleviate some of it.

Signed-off-by: David Vernet <void@manifault.com>
2024-04-11 19:30:21 -05:00
David Vernet
e27d5b4e67
rusty: Fix a few random issues
There are some random issues in the code, like unused variables, and bad
print formatters. I'm not sure why the compiler isn't consistently
complaining, but let's fix them.

Signed-off-by: David Vernet <void@manifault.com>
2024-04-11 19:21:02 -05:00
Tejun Heo
52d8a5d770
Merge pull request #226 from sched-ext/numa_dsq
rusty: Allocate DSQ on appropriate NUMA node
2024-04-11 09:05:42 -10:00
David Vernet
31cc2dccb9
rusty: Allocate DSQ on appropriate NUMA node
In scx_rusty, now that we have a complete view of the host's topology
thanks to the Topology crate, we can update our calls to
scx_bpf_create_dsq() to create the DSQ on the NUMA node of the domain.
It's unclear how much this will end up mattering for performance in the
typical case, but we might as well do the right thing given that host
topolgoy is static, and we have the information.

Signed-off-by: David Vernet <void@manifault.com>
2024-04-11 00:01:25 -05:00
David Vernet
47ab9331f4
Merge pull request #225 from sched-ext/error-typo
Fix error typo
2024-04-10 15:05:13 -05:00
Dan Schatzberg
6eefc8c27f
Fix error typo
ENONET means "Machine is not on the network" - this was supposed to be ENOENT "No such file or directory"
2024-04-10 15:28:05 -04:00
Changwoo Min
f53c29759e
scx_lavd: support preemption (in some scenarios) (#224)
* scx-lavd: preemption of a lower-priority task using kick cpu

When a task is enqueued to the global queue, the scheduler checks if
there is a lower priority task than the enqueued task. If so, it kicks
out the lower-priority task, hoping the newly enqueued task or another
higher-priority task runs on the kicked CPU. Kicking another CPU is
expensive as an IPI is involved, so the scheduler judiciously kicks the
CPU when its benefit (i.e., priority gap) is clear enough.

Signed-off-by: Changwoo Min <changwoo@igalia.com>
2024-04-09 14:25:53 +09:00
Tejun Heo
994d2a586c
Merge pull request #222 from jordalgo/header-paths
Sync libbpf_h and libbpf_local_h
2024-04-04 14:46:04 -10:00
Jordan Rome
c1925f07b4 Sync libbpf_h and libbpf_local_h
Make sure these include the same header directories.
2024-04-04 17:32:37 -07:00
Tejun Heo
1b897ae24b
Merge pull request #221 from sched-ext/htejun/misc
meson.build: Update libbpf and bpftool version requirements
2024-04-04 13:49:45 -10:00
Tejun Heo
4a77c8f8fb meson.build: Update libbpf and bpftool version requirements
The recent compat additions require new libbpf and bpftool. Update the
requirements.

- libbpf >= 1.4
- bpftool >= 7.4
2024-04-04 13:16:08 -10:00
Tejun Heo
8271bdd818
Merge pull request #220 from ThinkerYzu/uapi-path
meson: Add missing path to libbpf_local_h.
2024-04-04 11:57:48 -10:00
David Vernet
9a8ed8ab44
Merge pull request #218 from sched-ext/rusty_hotplug
Gracefully handle hotplug in scx_rusty
2024-04-04 16:03:59 -05:00
Tejun Heo
d2905e3328
Merge pull request #219 from sched-ext/rustland-core-0.2
scx_rustland_core: bump up version to 0.2
2024-04-04 11:03:34 -10:00
Kui-Feng Lee
b61dec6815 meson: Add missing path to libbpf_local_h.
The build system included linux/btf.h from system even there is one in
libbpf.  Adding libbpf/include/uapi to libbpf_local_h, the build
system will include linux/btf.h provided by libbpf.

Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
2024-04-04 14:01:59 -07:00
Andrea Righi
17a30bddc9 scx_rustland_core: bump up version to 0.2
Bump up the version of the crate and update dependencies.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-04-04 22:44:55 +02:00
David Vernet
622b61dd2f
rusty: Support restarting rusty on hotplug events
The scx_rusty scheduler does not support hotplug, and expects a static
host topology throughout its runtime. Though the kernel does have
support for detecting hotplug events, we currently don't detect this in
the kernel, nor surface it to user space when it happens. Now that we
have scx_bpf_exit(), we can gracefully exit the kernel in the event of a
hotplug, and communicate to user space that it should restart the
scheduler.

This patch adds that support to scx_rusty. Note that this assumes that
we're running on a recent enough kernel that has scx_bpf_exit(). If it
doesn't, then we instead just error out of the kernel scheduler and exit
the application.

Signed-off-by: David Vernet <void@manifault.com>
2024-04-04 14:52:48 -05:00
David Vernet
052ce428a3
uei: Export exit_code from UserExitInfo
Newer kernels also support exiting gracefully with an exit code. Let's
update the UserExitInfo struct to also read and export this value.

Signed-off-by: David Vernet <void@manifault.com>
2024-04-04 14:52:45 -05:00
Tejun Heo
1c6af78b79
Merge pull request #217 from sched-ext/fix-rustland-core-crate
scx_rustland_core: separate crate source code from assets
2024-04-04 09:51:43 -10:00
Andrea Righi
85a32a7b51 scx_rustland_core: separate crate source code from assets
scx_rustland_core needs to ship both a binary part and a source code
part, which will be used to build schedulers based on it.

To effectively publish the scx_rustland_core crate on crates.io we need
to properly separate the source code assets from the crate's main source
code.

To achieve this, move the assets into a separate directory and declare
them inside a [lib] section in Cargo.toml.

This allows to publish the crate on crates.io, providing also a clear
separation between source code and assets.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-04-04 21:31:02 +02:00
Tejun Heo
939ffdf0f0
Merge pull request #216 from sirlucjan/systemd-reorder
systemd: Move services to separate directory
2024-04-04 08:51:36 -10:00
Piotr Gorski
ef60559cb5
systemd: Move services to separate directory
Signed-off-by: Piotr Gorski <lucjan.lucjanov@gmail.com>
2024-04-04 20:29:54 +02:00
David Vernet
163e96db59
Merge pull request #215 from sched-ext/htejun/misc
scx_lavd: Add .gitignore
2024-04-04 12:32:08 -05:00
Tejun Heo
ba52cc131b scx_lavd: Add .gitignore 2024-04-04 07:15:37 -10:00
Andrea Righi
c6fda263bd
Merge pull request #214 from sched-ext/rustland-core-update-libbpf-rs-api
scx_rustland_core: re-introduce consume_raw() libbpf-rs API
2024-04-04 18:09:54 +02:00
Andrea Righi
fbccb161a3 scx_rustland_core: re-introduce consume_raw() libbpf-rs API
Now that libbpf-rs 0.23 has been officially released with the new
consume_raw() API (https://github.com/libbpf/libbpf-rs/pull/680) we can
re-introduce the change in rustland-core that allows to use this API to
improve the quality of the code and make it slightly more efficient when
consuming tasks from BPF to user-space.

Fixes: bd2c18a ("Revert "scx_rustland_core: use new consume_raw() libbpf-rs API"")
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-04-04 17:34:57 +02:00
Andrea Righi
bc1b0e99e6
Merge pull request #213 from sched-ext/fix-ci-build
ci: make test build more robust
2024-04-04 17:34:38 +02:00
Andrea Righi
a20b0669bc ci: mitigate build overload
During the build meson attempts to distribute the workload of multiple
sub-projects across all available CPUs and parallelize each build within
those projects, resulting in an NxN task generation.

This process could potentially overload the CI systems, leading to
potential failures (see for example issue #202).

To mitigate this, always use --jobs=1 during the CI run, which
serializes the build of sub-projects and restricts the level of
parallelization to N.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-04-04 12:29:27 +02:00
Andrea Righi
3166338a74 ci: update list of build dependencies
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-04-04 12:28:57 +02:00
Andrea Righi
39e154f4e9 ci: make sure to use the proper kernel headers
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-04-04 12:28:57 +02:00
Andrea Righi
eca7ecd24e build: introduce kernel_headers build option
If we try to cross-build scx on builders with older versions of system's
linux headers (such as those provided by linux-libc-headers in older
releases of Ubuntu), we may hit build failures, due to the different
kernel ABI, such as:

 error: invalid use of undefined type ‘struct btf_enum64’

To address this, introduce a new build option called "kernel_headers"
that allows to specify a custom path for the kernel headers required
during the build process.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-04-04 10:53:36 +02:00
Tejun Heo
7d335fa197
Merge pull request #211 from nycko123/main
openrc init support
2024-04-03 10:25:06 -10:00
Tejun Heo
7b068d310a
Merge pull request #212 from sched-ext/sccache
Doc & build: Warn about sccache
2024-04-03 10:24:31 -10:00
Tejun Heo
d62a15193e Doc & build: Warn about sccache
Build fails with sccache.

- Update meson-scripts/build_bpftool to support sccache. Unfortunately, this
  isn't enough.

- Update README to warn about sccache and add the instruction to disable it
  for buliding scx.

- Also add ⚠️ to make boot loader update step more prominent in arch
  installation instruction.
2024-04-03 10:18:45 -10:00
Damian N
a176c1344f
Merge branch 'sched-ext:main' into main 2024-04-03 22:04:28 +02:00
Damian N.
2f998e2a2b
services/openrc: symlinking fix 2024-04-03 22:02:14 +02:00
Tejun Heo
f8c150cbaf
Merge pull request #210 from jordalgo/fedora
Add install instructions for Fedora
2024-04-03 09:38:02 -10:00
Jordan Rome
a880ca5433 Add install instructions for Fedora
Also create a separate INSTALL.md as the primary REAME.md is
getting a big long.
2024-04-03 12:34:37 -07:00
Damian N.
33abc27183
openrc meson.build: symlinking 1st try 2024-04-03 21:21:26 +02:00
Damian N.
505f4c47a0
services/openrc: mesonfile 2024-04-03 19:57:32 +02:00
Damian N.
e7b4a03034
fixed option name in meson.build 2024-04-03 19:49:37 +02:00
Damian N.
5163d8b441
deleted: services/scx.initrd 2024-04-03 19:47:41 +02:00
Damian N.
3e6bcab337
mv scx.initrd openrc/scx.initrd 2024-04-03 19:45:55 +02:00
Damian N.
6e02c8eb5c
main meson: added openrc options 2024-04-03 19:38:28 +02:00
Damian N.
e19bc1b62d
openrc init.d service file 2024-04-03 19:30:22 +02:00
Tejun Heo
86f1550181
Update README.md 2024-04-03 06:48:30 -10:00