Skip to content

Commit 8070931

Browse files
committed
sched_ext: test with patches from scx-for-6.13-fixes
1 parent a4ad95c commit 8070931

9 files changed

+425
-7
lines changed

.github/scripts/matrix.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ def tests(self) -> Dict[str, Any]:
9898
if self.toolchain.version >= 18:
9999
tests_list.append("test_progs_cpuv4")
100100

101-
# if self.arch in [Arch.X86_64, Arch.AARCH64]:
102-
# tests_list.append("sched_ext")
101+
if self.arch in [Arch.X86_64, Arch.AARCH64]:
102+
tests_list.append("sched_ext")
103103

104104
if not self.parallel_tests:
105105
tests_list = [test for test in tests_list if not test.endswith("parallel")]

.github/workflows/kernel-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
ARTIFACTS_ARCHIVE: "vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst"
4949
BPF_NEXT_BASE_BRANCH: 'master'
5050
BPF_NEXT_FETCH_DEPTH: 64 # A bit of history is needed to facilitate incremental builds
51-
# BUILD_SCHED_EXT_SELFTESTS: ${{ inputs.arch == 'x86_64' || inputs.arch == 'aarch64' && 'true' || '' }}
51+
BUILD_SCHED_EXT_SELFTESTS: ${{ inputs.arch == 'x86_64' || inputs.arch == 'aarch64' && 'true' || '' }}
5252
KBUILD_OUTPUT: ${{ github.workspace }}/kbuild-output
5353
KERNEL: ${{ inputs.kernel }}
5454
KERNEL_ROOT: ${{ github.workspace }}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
From 793baff3f24f16dab9061045e23eea67724feae6 Mon Sep 17 00:00:00 2001
2+
From: Honglei Wang <jameshongleiwang@126.com>
3+
Date: Fri, 29 Nov 2024 17:10:03 +0800
4+
Subject: [PATCH 1000/1008] sched_ext: Add __weak to fix the build errors
5+
6+
commit 5cbb302880f5 ("sched_ext: Rename
7+
scx_bpf_dispatch[_vtime]_from_dsq*() -> scx_bpf_dsq_move[_vtime]*()")
8+
introduced several new functions which caused compilation errors when
9+
compiled with clang.
10+
11+
Let's fix this by adding __weak markers.
12+
13+
Signed-off-by: Honglei Wang <jameshongleiwang@126.com>
14+
Signed-off-by: Tejun Heo <tj@kernel.org>
15+
Fixes: 5cbb302880f5 ("sched_ext: Rename scx_bpf_dispatch[_vtime]_from_dsq*() -> scx_bpf_dsq_move[_vtime]*()")
16+
Acked-by: Andrii Nakryiko <andrii@kernel.org>
17+
---
18+
tools/sched_ext/include/scx/common.bpf.h | 6 +++---
19+
1 file changed, 3 insertions(+), 3 deletions(-)
20+
21+
diff --git a/tools/sched_ext/include/scx/common.bpf.h b/tools/sched_ext/include/scx/common.bpf.h
22+
index 2f36b7b6418d..625f5b046776 100644
23+
--- a/tools/sched_ext/include/scx/common.bpf.h
24+
+++ b/tools/sched_ext/include/scx/common.bpf.h
25+
@@ -40,9 +40,9 @@ void scx_bpf_dsq_insert(struct task_struct *p, u64 dsq_id, u64 slice, u64 enq_fl
26+
void scx_bpf_dsq_insert_vtime(struct task_struct *p, u64 dsq_id, u64 slice, u64 vtime, u64 enq_flags) __ksym __weak;
27+
u32 scx_bpf_dispatch_nr_slots(void) __ksym;
28+
void scx_bpf_dispatch_cancel(void) __ksym;
29+
-bool scx_bpf_dsq_move_to_local(u64 dsq_id) __ksym;
30+
-void scx_bpf_dsq_move_set_slice(struct bpf_iter_scx_dsq *it__iter, u64 slice) __ksym;
31+
-void scx_bpf_dsq_move_set_vtime(struct bpf_iter_scx_dsq *it__iter, u64 vtime) __ksym;
32+
+bool scx_bpf_dsq_move_to_local(u64 dsq_id) __ksym __weak;
33+
+void scx_bpf_dsq_move_set_slice(struct bpf_iter_scx_dsq *it__iter, u64 slice) __ksym __weak;
34+
+void scx_bpf_dsq_move_set_vtime(struct bpf_iter_scx_dsq *it__iter, u64 vtime) __ksym __weak;
35+
bool scx_bpf_dsq_move(struct bpf_iter_scx_dsq *it__iter, struct task_struct *p, u64 dsq_id, u64 enq_flags) __ksym __weak;
36+
bool scx_bpf_dsq_move_vtime(struct bpf_iter_scx_dsq *it__iter, struct task_struct *p, u64 dsq_id, u64 enq_flags) __ksym __weak;
37+
u32 scx_bpf_reenqueue_local(void) __ksym;
38+
--
39+
2.47.1
40+
Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
From ef7009decc30eb2515a64253791d61b72229c119 Mon Sep 17 00:00:00 2001
2+
From: Ihor Solodrai <ihor.solodrai@pm.me>
3+
Date: Thu, 21 Nov 2024 21:40:17 +0000
4+
Subject: [PATCH 1001/1008] selftests/sched_ext: fix build after renames in
5+
sched_ext API
6+
7+
The selftests are falining to build on current tip of bpf-next and
8+
sched_ext [1]. This has broken BPF CI [2] after merge from upstream.
9+
10+
Use appropriate function names in the selftests according to the
11+
recent changes in the sched_ext API [3].
12+
13+
[1] https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=fc39fb56917bb3cb53e99560ca3612a84456ada2
14+
[2] https://github.com/kernel-patches/bpf/actions/runs/11959327258/job/33340923745
15+
[3] https://lore.kernel.org/all/20241109194853.580310-1-tj@kernel.org/
16+
17+
Signed-off-by: Ihor Solodrai <ihor.solodrai@pm.me>
18+
Acked-by: Andrea Righi <arighi@nvidia.com>
19+
Acked-by: David Vernet <void@manifault.com>
20+
Signed-off-by: Tejun Heo <tj@kernel.org>
21+
---
22+
.../testing/selftests/sched_ext/ddsp_bogus_dsq_fail.bpf.c | 2 +-
23+
.../selftests/sched_ext/ddsp_vtimelocal_fail.bpf.c | 4 ++--
24+
tools/testing/selftests/sched_ext/dsp_local_on.bpf.c | 2 +-
25+
.../selftests/sched_ext/enq_select_cpu_fails.bpf.c | 2 +-
26+
tools/testing/selftests/sched_ext/exit.bpf.c | 4 ++--
27+
tools/testing/selftests/sched_ext/maximal.bpf.c | 4 ++--
28+
tools/testing/selftests/sched_ext/select_cpu_dfl.bpf.c | 2 +-
29+
.../selftests/sched_ext/select_cpu_dfl_nodispatch.bpf.c | 2 +-
30+
.../testing/selftests/sched_ext/select_cpu_dispatch.bpf.c | 2 +-
31+
.../selftests/sched_ext/select_cpu_dispatch_bad_dsq.bpf.c | 2 +-
32+
.../selftests/sched_ext/select_cpu_dispatch_dbl_dsp.bpf.c | 4 ++--
33+
tools/testing/selftests/sched_ext/select_cpu_vtime.bpf.c | 8 ++++----
34+
12 files changed, 19 insertions(+), 19 deletions(-)
35+
36+
diff --git a/tools/testing/selftests/sched_ext/ddsp_bogus_dsq_fail.bpf.c b/tools/testing/selftests/sched_ext/ddsp_bogus_dsq_fail.bpf.c
37+
index 37d9bf6fb745..6f4c3f5a1c5d 100644
38+
--- a/tools/testing/selftests/sched_ext/ddsp_bogus_dsq_fail.bpf.c
39+
+++ b/tools/testing/selftests/sched_ext/ddsp_bogus_dsq_fail.bpf.c
40+
@@ -20,7 +20,7 @@ s32 BPF_STRUCT_OPS(ddsp_bogus_dsq_fail_select_cpu, struct task_struct *p,
41+
* If we dispatch to a bogus DSQ that will fall back to the
42+
* builtin global DSQ, we fail gracefully.
43+
*/
44+
- scx_bpf_dispatch_vtime(p, 0xcafef00d, SCX_SLICE_DFL,
45+
+ scx_bpf_dsq_insert_vtime(p, 0xcafef00d, SCX_SLICE_DFL,
46+
p->scx.dsq_vtime, 0);
47+
return cpu;
48+
}
49+
diff --git a/tools/testing/selftests/sched_ext/ddsp_vtimelocal_fail.bpf.c b/tools/testing/selftests/sched_ext/ddsp_vtimelocal_fail.bpf.c
50+
index dffc97d9cdf1..e4a55027778f 100644
51+
--- a/tools/testing/selftests/sched_ext/ddsp_vtimelocal_fail.bpf.c
52+
+++ b/tools/testing/selftests/sched_ext/ddsp_vtimelocal_fail.bpf.c
53+
@@ -17,8 +17,8 @@ s32 BPF_STRUCT_OPS(ddsp_vtimelocal_fail_select_cpu, struct task_struct *p,
54+
55+
if (cpu >= 0) {
56+
/* Shouldn't be allowed to vtime dispatch to a builtin DSQ. */
57+
- scx_bpf_dispatch_vtime(p, SCX_DSQ_LOCAL, SCX_SLICE_DFL,
58+
- p->scx.dsq_vtime, 0);
59+
+ scx_bpf_dsq_insert_vtime(p, SCX_DSQ_LOCAL, SCX_SLICE_DFL,
60+
+ p->scx.dsq_vtime, 0);
61+
return cpu;
62+
}
63+
64+
diff --git a/tools/testing/selftests/sched_ext/dsp_local_on.bpf.c b/tools/testing/selftests/sched_ext/dsp_local_on.bpf.c
65+
index 6a7db1502c29..6325bf76f47e 100644
66+
--- a/tools/testing/selftests/sched_ext/dsp_local_on.bpf.c
67+
+++ b/tools/testing/selftests/sched_ext/dsp_local_on.bpf.c
68+
@@ -45,7 +45,7 @@ void BPF_STRUCT_OPS(dsp_local_on_dispatch, s32 cpu, struct task_struct *prev)
69+
70+
target = bpf_get_prandom_u32() % nr_cpus;
71+
72+
- scx_bpf_dispatch(p, SCX_DSQ_LOCAL_ON | target, SCX_SLICE_DFL, 0);
73+
+ scx_bpf_dsq_insert(p, SCX_DSQ_LOCAL_ON | target, SCX_SLICE_DFL, 0);
74+
bpf_task_release(p);
75+
}
76+
77+
diff --git a/tools/testing/selftests/sched_ext/enq_select_cpu_fails.bpf.c b/tools/testing/selftests/sched_ext/enq_select_cpu_fails.bpf.c
78+
index 1efb50d61040..a7cf868d5e31 100644
79+
--- a/tools/testing/selftests/sched_ext/enq_select_cpu_fails.bpf.c
80+
+++ b/tools/testing/selftests/sched_ext/enq_select_cpu_fails.bpf.c
81+
@@ -31,7 +31,7 @@ void BPF_STRUCT_OPS(enq_select_cpu_fails_enqueue, struct task_struct *p,
82+
/* Can only call from ops.select_cpu() */
83+
scx_bpf_select_cpu_dfl(p, 0, 0, &found);
84+
85+
- scx_bpf_dispatch(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, enq_flags);
86+
+ scx_bpf_dsq_insert(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, enq_flags);
87+
}
88+
89+
SEC(".struct_ops.link")
90+
diff --git a/tools/testing/selftests/sched_ext/exit.bpf.c b/tools/testing/selftests/sched_ext/exit.bpf.c
91+
index d75d4faf07f6..4bc36182d3ff 100644
92+
--- a/tools/testing/selftests/sched_ext/exit.bpf.c
93+
+++ b/tools/testing/selftests/sched_ext/exit.bpf.c
94+
@@ -33,7 +33,7 @@ void BPF_STRUCT_OPS(exit_enqueue, struct task_struct *p, u64 enq_flags)
95+
if (exit_point == EXIT_ENQUEUE)
96+
EXIT_CLEANLY();
97+
98+
- scx_bpf_dispatch(p, DSQ_ID, SCX_SLICE_DFL, enq_flags);
99+
+ scx_bpf_dsq_insert(p, DSQ_ID, SCX_SLICE_DFL, enq_flags);
100+
}
101+
102+
void BPF_STRUCT_OPS(exit_dispatch, s32 cpu, struct task_struct *p)
103+
@@ -41,7 +41,7 @@ void BPF_STRUCT_OPS(exit_dispatch, s32 cpu, struct task_struct *p)
104+
if (exit_point == EXIT_DISPATCH)
105+
EXIT_CLEANLY();
106+
107+
- scx_bpf_consume(DSQ_ID);
108+
+ scx_bpf_dsq_move_to_local(DSQ_ID);
109+
}
110+
111+
void BPF_STRUCT_OPS(exit_enable, struct task_struct *p)
112+
diff --git a/tools/testing/selftests/sched_ext/maximal.bpf.c b/tools/testing/selftests/sched_ext/maximal.bpf.c
113+
index 4d4cd8d966db..4c005fa71810 100644
114+
--- a/tools/testing/selftests/sched_ext/maximal.bpf.c
115+
+++ b/tools/testing/selftests/sched_ext/maximal.bpf.c
116+
@@ -20,7 +20,7 @@ s32 BPF_STRUCT_OPS(maximal_select_cpu, struct task_struct *p, s32 prev_cpu,
117+
118+
void BPF_STRUCT_OPS(maximal_enqueue, struct task_struct *p, u64 enq_flags)
119+
{
120+
- scx_bpf_dispatch(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, enq_flags);
121+
+ scx_bpf_dsq_insert(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, enq_flags);
122+
}
123+
124+
void BPF_STRUCT_OPS(maximal_dequeue, struct task_struct *p, u64 deq_flags)
125+
@@ -28,7 +28,7 @@ void BPF_STRUCT_OPS(maximal_dequeue, struct task_struct *p, u64 deq_flags)
126+
127+
void BPF_STRUCT_OPS(maximal_dispatch, s32 cpu, struct task_struct *prev)
128+
{
129+
- scx_bpf_consume(SCX_DSQ_GLOBAL);
130+
+ scx_bpf_dsq_move_to_local(SCX_DSQ_GLOBAL);
131+
}
132+
133+
void BPF_STRUCT_OPS(maximal_runnable, struct task_struct *p, u64 enq_flags)
134+
diff --git a/tools/testing/selftests/sched_ext/select_cpu_dfl.bpf.c b/tools/testing/selftests/sched_ext/select_cpu_dfl.bpf.c
135+
index f171ac470970..13d0f5be788d 100644
136+
--- a/tools/testing/selftests/sched_ext/select_cpu_dfl.bpf.c
137+
+++ b/tools/testing/selftests/sched_ext/select_cpu_dfl.bpf.c
138+
@@ -30,7 +30,7 @@ void BPF_STRUCT_OPS(select_cpu_dfl_enqueue, struct task_struct *p,
139+
}
140+
scx_bpf_put_idle_cpumask(idle_mask);
141+
142+
- scx_bpf_dispatch(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, enq_flags);
143+
+ scx_bpf_dsq_insert(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, enq_flags);
144+
}
145+
146+
SEC(".struct_ops.link")
147+
diff --git a/tools/testing/selftests/sched_ext/select_cpu_dfl_nodispatch.bpf.c b/tools/testing/selftests/sched_ext/select_cpu_dfl_nodispatch.bpf.c
148+
index 9efdbb7da928..815f1d5d61ac 100644
149+
--- a/tools/testing/selftests/sched_ext/select_cpu_dfl_nodispatch.bpf.c
150+
+++ b/tools/testing/selftests/sched_ext/select_cpu_dfl_nodispatch.bpf.c
151+
@@ -67,7 +67,7 @@ void BPF_STRUCT_OPS(select_cpu_dfl_nodispatch_enqueue, struct task_struct *p,
152+
saw_local = true;
153+
}
154+
155+
- scx_bpf_dispatch(p, dsq_id, SCX_SLICE_DFL, enq_flags);
156+
+ scx_bpf_dsq_insert(p, dsq_id, SCX_SLICE_DFL, enq_flags);
157+
}
158+
159+
s32 BPF_STRUCT_OPS(select_cpu_dfl_nodispatch_init_task,
160+
diff --git a/tools/testing/selftests/sched_ext/select_cpu_dispatch.bpf.c b/tools/testing/selftests/sched_ext/select_cpu_dispatch.bpf.c
161+
index 59bfc4f36167..4bb99699e920 100644
162+
--- a/tools/testing/selftests/sched_ext/select_cpu_dispatch.bpf.c
163+
+++ b/tools/testing/selftests/sched_ext/select_cpu_dispatch.bpf.c
164+
@@ -29,7 +29,7 @@ s32 BPF_STRUCT_OPS(select_cpu_dispatch_select_cpu, struct task_struct *p,
165+
cpu = prev_cpu;
166+
167+
dispatch:
168+
- scx_bpf_dispatch(p, dsq_id, SCX_SLICE_DFL, 0);
169+
+ scx_bpf_dsq_insert(p, dsq_id, SCX_SLICE_DFL, 0);
170+
return cpu;
171+
}
172+
173+
diff --git a/tools/testing/selftests/sched_ext/select_cpu_dispatch_bad_dsq.bpf.c b/tools/testing/selftests/sched_ext/select_cpu_dispatch_bad_dsq.bpf.c
174+
index 3bbd5fcdfb18..2a75de11b2cf 100644
175+
--- a/tools/testing/selftests/sched_ext/select_cpu_dispatch_bad_dsq.bpf.c
176+
+++ b/tools/testing/selftests/sched_ext/select_cpu_dispatch_bad_dsq.bpf.c
177+
@@ -18,7 +18,7 @@ s32 BPF_STRUCT_OPS(select_cpu_dispatch_bad_dsq_select_cpu, struct task_struct *p
178+
s32 prev_cpu, u64 wake_flags)
179+
{
180+
/* Dispatching to a random DSQ should fail. */
181+
- scx_bpf_dispatch(p, 0xcafef00d, SCX_SLICE_DFL, 0);
182+
+ scx_bpf_dsq_insert(p, 0xcafef00d, SCX_SLICE_DFL, 0);
183+
184+
return prev_cpu;
185+
}
186+
diff --git a/tools/testing/selftests/sched_ext/select_cpu_dispatch_dbl_dsp.bpf.c b/tools/testing/selftests/sched_ext/select_cpu_dispatch_dbl_dsp.bpf.c
187+
index 0fda57fe0ecf..99d075695c97 100644
188+
--- a/tools/testing/selftests/sched_ext/select_cpu_dispatch_dbl_dsp.bpf.c
189+
+++ b/tools/testing/selftests/sched_ext/select_cpu_dispatch_dbl_dsp.bpf.c
190+
@@ -18,8 +18,8 @@ s32 BPF_STRUCT_OPS(select_cpu_dispatch_dbl_dsp_select_cpu, struct task_struct *p
191+
s32 prev_cpu, u64 wake_flags)
192+
{
193+
/* Dispatching twice in a row is disallowed. */
194+
- scx_bpf_dispatch(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, 0);
195+
- scx_bpf_dispatch(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, 0);
196+
+ scx_bpf_dsq_insert(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, 0);
197+
+ scx_bpf_dsq_insert(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, 0);
198+
199+
return prev_cpu;
200+
}
201+
diff --git a/tools/testing/selftests/sched_ext/select_cpu_vtime.bpf.c b/tools/testing/selftests/sched_ext/select_cpu_vtime.bpf.c
202+
index e6c67bcf5e6e..bfcb96cd4954 100644
203+
--- a/tools/testing/selftests/sched_ext/select_cpu_vtime.bpf.c
204+
+++ b/tools/testing/selftests/sched_ext/select_cpu_vtime.bpf.c
205+
@@ -2,8 +2,8 @@
206+
/*
207+
* A scheduler that validates that enqueue flags are properly stored and
208+
* applied at dispatch time when a task is directly dispatched from
209+
- * ops.select_cpu(). We validate this by using scx_bpf_dispatch_vtime(), and
210+
- * making the test a very basic vtime scheduler.
211+
+ * ops.select_cpu(). We validate this by using scx_bpf_dsq_insert_vtime(),
212+
+ * and making the test a very basic vtime scheduler.
213+
*
214+
* Copyright (c) 2024 Meta Platforms, Inc. and affiliates.
215+
* Copyright (c) 2024 David Vernet <dvernet@meta.com>
216+
@@ -47,13 +47,13 @@ s32 BPF_STRUCT_OPS(select_cpu_vtime_select_cpu, struct task_struct *p,
217+
cpu = prev_cpu;
218+
scx_bpf_test_and_clear_cpu_idle(cpu);
219+
ddsp:
220+
- scx_bpf_dispatch_vtime(p, VTIME_DSQ, SCX_SLICE_DFL, task_vtime(p), 0);
221+
+ scx_bpf_dsq_insert_vtime(p, VTIME_DSQ, SCX_SLICE_DFL, task_vtime(p), 0);
222+
return cpu;
223+
}
224+
225+
void BPF_STRUCT_OPS(select_cpu_vtime_dispatch, s32 cpu, struct task_struct *p)
226+
{
227+
- if (scx_bpf_consume(VTIME_DSQ))
228+
+ if (scx_bpf_dsq_move_to_local(VTIME_DSQ))
229+
consumed = true;
230+
}
231+
232+
--
233+
2.47.1
234+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
From f24d192985cbd6782850fdbb3839039da2f0ee76 Mon Sep 17 00:00:00 2001
2+
From: guanjing <guanjing@cmss.chinamobile.com>
3+
Date: Sun, 17 Nov 2024 10:51:29 +0800
4+
Subject: [PATCH 1002/1008] sched_ext: fix application of sizeof to pointer
5+
6+
sizeof when applied to a pointer typed expression gives the size of
7+
the pointer.
8+
9+
The proper fix in this particular case is to code sizeof(*cpuset)
10+
instead of sizeof(cpuset).
11+
12+
This issue was detected with the help of Coccinelle.
13+
14+
Fixes: 22a920209ab6 ("sched_ext: Implement tickless support")
15+
Signed-off-by: guanjing <guanjing@cmss.chinamobile.com>
16+
Acked-by: Andrea Righi <arighi@nvidia.com>
17+
Signed-off-by: Tejun Heo <tj@kernel.org>
18+
---
19+
tools/sched_ext/scx_central.c | 2 +-
20+
1 file changed, 1 insertion(+), 1 deletion(-)
21+
22+
diff --git a/tools/sched_ext/scx_central.c b/tools/sched_ext/scx_central.c
23+
index 21deea320bd7..e938156ed0a0 100644
24+
--- a/tools/sched_ext/scx_central.c
25+
+++ b/tools/sched_ext/scx_central.c
26+
@@ -97,7 +97,7 @@ int main(int argc, char **argv)
27+
SCX_BUG_ON(!cpuset, "Failed to allocate cpuset");
28+
CPU_ZERO(cpuset);
29+
CPU_SET(skel->rodata->central_cpu, cpuset);
30+
- SCX_BUG_ON(sched_setaffinity(0, sizeof(cpuset), cpuset),
31+
+ SCX_BUG_ON(sched_setaffinity(0, sizeof(*cpuset), cpuset),
32+
"Failed to affinitize to central CPU %d (max %d)",
33+
skel->rodata->central_cpu, skel->rodata->nr_cpu_ids - 1);
34+
CPU_FREE(cpuset);
35+
--
36+
2.47.1
37+

ci/diffs/9999-scx-Fix-maximal-BPF-selftest-prog.patch renamed to ci/diffs/1003-scx-Fix-maximal-BPF-selftest-prog.patch

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
From 70414cacbe536a197d56f58a42f9563e5a01b8ec Mon Sep 17 00:00:00 2001
1+
From b8f614207b0d5e4abd6df8d5cb3cc11f009d1d93 Mon Sep 17 00:00:00 2001
22
From: David Vernet <void@manifault.com>
33
Date: Mon, 9 Dec 2024 09:29:24 -0600
4-
Subject: [PATCH] scx: Fix maximal BPF selftest prog
4+
Subject: [PATCH 1003/1008] scx: Fix maximal BPF selftest prog
55

66
maximal.bpf.c is still dispatching to and consuming from SCX_DSQ_GLOBAL.
77
Let's have it use its own DSQ to avoid any runtime errors.
88

99
Signed-off-by: David Vernet <void@manifault.com>
10+
Tested-by: Andrea Righi <arighi@nvidia.com>
11+
Signed-off-by: Tejun Heo <tj@kernel.org>
1012
---
1113
tools/testing/selftests/sched_ext/maximal.bpf.c | 8 +++++---
1214
1 file changed, 5 insertions(+), 3 deletions(-)

ci/diffs/9998-sched_ext-Fix-invalid-irq-restore-in-scx_ops_bypass.patch renamed to ci/diffs/1006-sched_ext-Fix-invalid-irq-restore-in-scx_ops_bypass.patch

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
From 10e1d78546b3dd4ea9d773c0b0257064a99211e9 Mon Sep 17 00:00:00 2001
1+
From 18b2093f4598d8ee67a8153badc93f0fa7686b8a Mon Sep 17 00:00:00 2001
22
From: Tejun Heo <tj@kernel.org>
33
Date: Wed, 11 Dec 2024 11:01:51 -1000
4-
Subject: [PATCH] sched_ext: Fix invalid irq restore in scx_ops_bypass()
4+
Subject: [PATCH 1006/1008] sched_ext: Fix invalid irq restore in
5+
scx_ops_bypass()
56

67
While adding outer irqsave/restore locking, 0e7ffff1b811 ("scx: Fix raciness
78
in scx_ops_bypass()") forgot to convert an inner rq_unlock_irqrestore() to
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
From 35bf430e08a18fdab6eb94492a06d9ad14c6179b Mon Sep 17 00:00:00 2001
2+
From: Henry Huang <henry.hj@antgroup.com>
3+
Date: Sun, 22 Dec 2024 23:43:16 +0800
4+
Subject: [PATCH 1007/1008] sched_ext: initialize kit->cursor.flags
5+
6+
struct bpf_iter_scx_dsq *it maybe not initialized.
7+
If we didn't call scx_bpf_dsq_move_set_vtime and scx_bpf_dsq_move_set_slice
8+
before scx_bpf_dsq_move, it would cause unexpected behaviors:
9+
1. Assign a huge slice into p->scx.slice
10+
2. Assign a invalid vtime into p->scx.dsq_vtime
11+
12+
Signed-off-by: Henry Huang <henry.hj@antgroup.com>
13+
Fixes: 6462dd53a260 ("sched_ext: Compact struct bpf_iter_scx_dsq_kern")
14+
Cc: stable@vger.kernel.org # v6.12
15+
Signed-off-by: Tejun Heo <tj@kernel.org>
16+
---
17+
kernel/sched/ext.c | 2 +-
18+
1 file changed, 1 insertion(+), 1 deletion(-)
19+
20+
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
21+
index 98519e6d0dcd..19d2699cf638 100644
22+
--- a/kernel/sched/ext.c
23+
+++ b/kernel/sched/ext.c
24+
@@ -7013,7 +7013,7 @@ __bpf_kfunc int bpf_iter_scx_dsq_new(struct bpf_iter_scx_dsq *it, u64 dsq_id,
25+
return -ENOENT;
26+
27+
INIT_LIST_HEAD(&kit->cursor.node);
28+
- kit->cursor.flags |= SCX_DSQ_LNODE_ITER_CURSOR | flags;
29+
+ kit->cursor.flags = SCX_DSQ_LNODE_ITER_CURSOR | flags;
30+
kit->cursor.priv = READ_ONCE(kit->dsq->seq);
31+
32+
return 0;
33+
--
34+
2.47.1
35+

0 commit comments

Comments
 (0)