Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sched_ext: Fix enq_last_no_enq_fails selftest

cc9877fb7677 ("sched_ext: Improve error reporting during loading") changed
how load failures are reported so that more error context can be
communicated. This breaks the enq_last_no_enq_fails test as attach no longer
fails. The scheduler is guaranteed to be ejected on attach completion with
full error information. Update enq_last_no_enq_fails so that it checks that
the scheduler is ejected using ops.exit().

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Vishal Chourasia <vishalc@linux.ibm.com>
Link: http://lkml.kernel.org/r/Zxknp7RAVNjmdJSc@linux.ibm.com
Fixes: cc9877fb7677 ("sched_ext: Improve error reporting during loading")

+15 -3
+8
tools/testing/selftests/sched_ext/enq_last_no_enq_fails.bpf.c
··· 12 12 13 13 char _license[] SEC("license") = "GPL"; 14 14 15 + u32 exit_kind; 16 + 17 + void BPF_STRUCT_OPS_SLEEPABLE(enq_last_no_enq_fails_exit, struct scx_exit_info *info) 18 + { 19 + exit_kind = info->kind; 20 + } 21 + 15 22 SEC(".struct_ops.link") 16 23 struct sched_ext_ops enq_last_no_enq_fails_ops = { 17 24 .name = "enq_last_no_enq_fails", 18 25 /* Need to define ops.enqueue() with SCX_OPS_ENQ_LAST */ 19 26 .flags = SCX_OPS_ENQ_LAST, 27 + .exit = (void *) enq_last_no_enq_fails_exit, 20 28 .timeout_ms = 1000U, 21 29 };
+7 -3
tools/testing/selftests/sched_ext/enq_last_no_enq_fails.c
··· 31 31 struct bpf_link *link; 32 32 33 33 link = bpf_map__attach_struct_ops(skel->maps.enq_last_no_enq_fails_ops); 34 - if (link) { 35 - SCX_ERR("Incorrectly succeeded in to attaching scheduler"); 34 + if (!link) { 35 + SCX_ERR("Incorrectly failed at attaching scheduler"); 36 + return SCX_TEST_FAIL; 37 + } 38 + if (!skel->bss->exit_kind) { 39 + SCX_ERR("Incorrectly stayed loaded"); 36 40 return SCX_TEST_FAIL; 37 41 } 38 42 ··· 54 50 55 51 struct scx_test enq_last_no_enq_fails = { 56 52 .name = "enq_last_no_enq_fails", 57 - .description = "Verify we fail to load a scheduler if we specify " 53 + .description = "Verify we eject a scheduler if we specify " 58 54 "the SCX_OPS_ENQ_LAST flag without defining " 59 55 "ops.enqueue()", 60 56 .setup = setup,