Skip to contentSkip to conversation

selftests/sched_ext: Add tests for SCX_ENQ_IMMED and scx_bpf_dsq_reenq()

PATCH Superseded zhidao su 2 participants 3 messages Mar 22 – Mar 23

Subsystems (2)
lore
Share & tools
lore

zhidao su

author
#0 lore raw

PATCH 1/1 selftests/sched_ext: Add tests for SCX_ENQ_IMMED and scx_bpf_dsq_reenq()

From: Su Zhidao <[email protected]>

Add three selftests covering features introduced in v7.1:

- dsq_reenq: Verify scx_bpf_dsq_reenq() on user DSQs triggers ops.enqueue() with SCX_ENQ_REENQ and SCX_TASK_REENQ_KFUNC in p->scx.flags.

- enq_immed: Verify SCX_OPS_ALWAYS_ENQ_IMMED slow path where tasks dispatched to a busy CPU's local DSQ are re-enqueued through ops.enqueue() with SCX_TASK_REENQ_IMMED.

- consume_immed: Verify SCX_ENQ_IMMED via the consume path using scx_bpf_dsq_move_to_local___v2() with explicit SCX_ENQ_IMMED.

All three tests skip gracefully on kernels that predate the required features by checking availability via __COMPAT_has_ksym() / __COMPAT_read_enum() before loading.

---
 tools/testing/selftests/sched_ext/Makefile    |   3 +
 .../selftests/sched_ext/consume_immed.bpf.c   |  88 +++++++++++++
 .../selftests/sched_ext/consume_immed.c       | 115 +++++++++++++++++
 .../selftests/sched_ext/dsq_reenq.bpf.c       | 120 ++++++++++++++++++
 tools/testing/selftests/sched_ext/dsq_reenq.c |  95 ++++++++++++++
 .../selftests/sched_ext/enq_immed.bpf.c       |  63 +++++++++
 tools/testing/selftests/sched_ext/enq_immed.c | 117 +++++++++++++++++
 7 files changed, 601 insertions(+)
 create mode 100644 tools/testing/selftests/sched_ext/consume_immed.bpf.c
 create mode 100644 tools/testing/selftests/sched_ext/consume_immed.c
 create mode 100644 tools/testing/selftests/sched_ext/dsq_reenq.bpf.c
 create mode 100644 tools/testing/selftests/sched_ext/dsq_reenq.c
 create mode 100644 tools/testing/selftests/sched_ext/enq_immed.bpf.c
 create mode 100644 tools/testing/selftests/sched_ext/enq_immed.c
tools/testing/selftests/sched_ext/Makefile +3 -0
index a3bbe2c7911b..84e4f69b8833 100644
@@ -162,8 +162,11 @@ endef
 all_test_bpfprogs := $(foreach prog,$(wildcard *.bpf.c),$(INCLUDE_DIR)/$(patsubst %.c,%.skel.h,$(prog)))
 
 auto-test-targets :=			\
+	consume_immed			\
 	create_dsq			\
 	dequeue				\
+	dsq_reenq			\
+	enq_immed			\
 	enq_last_no_enq_fails		\
 	ddsp_bogus_dsq_fail		\
 	ddsp_vtimelocal_fail		\
tools/testing/selftests/sched_ext/consume_immed.bpf.c new file +88 -0

88 lines not on this page · raw message

tools/testing/selftests/sched_ext/consume_immed.c new file +115 -0

115 lines not on this page · raw message

tools/testing/selftests/sched_ext/dsq_reenq.bpf.c new file +120 -0

120 lines not on this page · raw message

tools/testing/selftests/sched_ext/dsq_reenq.c new file +95 -0

95 lines not on this page · raw message

tools/testing/selftests/sched_ext/enq_immed.bpf.c new file +63 -0

63 lines not on this page · raw message

tools/testing/selftests/sched_ext/enq_immed.c new file +117 -0

117 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#1 lore raw

PATCH v2 1/1 selftests/sched_ext: Add tests for SCX_ENQ_IMMED and scx_bpf_dsq_reenq()

From: Su Zhidao <[email protected]>

Add three selftests covering features introduced in v7.1:

- dsq_reenq: Verify scx_bpf_dsq_reenq() on user DSQs triggers ops.enqueue() with SCX_ENQ_REENQ and SCX_TASK_REENQ_KFUNC in p->scx.flags.

- enq_immed: Verify SCX_OPS_ALWAYS_ENQ_IMMED slow path where tasks dispatched to a busy CPU's local DSQ are re-enqueued through ops.enqueue() with SCX_TASK_REENQ_IMMED.

- consume_immed: Verify SCX_ENQ_IMMED via the consume path using scx_bpf_dsq_move_to_local___v2() with explicit SCX_ENQ_IMMED.

All three tests skip gracefully on kernels that predate the required features by checking availability via __COMPAT_has_ksym() / __COMPAT_read_enum() before loading.

---
 tools/testing/selftests/sched_ext/Makefile    |   3 +
 .../selftests/sched_ext/consume_immed.bpf.c   |  88 +++++++++++++
 .../selftests/sched_ext/consume_immed.c       | 115 +++++++++++++++++
 .../selftests/sched_ext/dsq_reenq.bpf.c       | 120 ++++++++++++++++++
 tools/testing/selftests/sched_ext/dsq_reenq.c |  95 ++++++++++++++
 .../selftests/sched_ext/enq_immed.bpf.c       |  63 +++++++++
 tools/testing/selftests/sched_ext/enq_immed.c | 117 +++++++++++++++++
 7 files changed, 601 insertions(+)
 create mode 100644 tools/testing/selftests/sched_ext/consume_immed.bpf.c
 create mode 100644 tools/testing/selftests/sched_ext/consume_immed.c
 create mode 100644 tools/testing/selftests/sched_ext/dsq_reenq.bpf.c
 create mode 100644 tools/testing/selftests/sched_ext/dsq_reenq.c
 create mode 100644 tools/testing/selftests/sched_ext/enq_immed.bpf.c
 create mode 100644 tools/testing/selftests/sched_ext/enq_immed.c
tools/testing/selftests/sched_ext/Makefile +3 -0
index a3bbe2c7911b..84e4f69b8833 100644
@@ -162,8 +162,11 @@ endef
 all_test_bpfprogs := $(foreach prog,$(wildcard *.bpf.c),$(INCLUDE_DIR)/$(patsubst %.c,%.skel.h,$(prog)))
 
 auto-test-targets :=			\
+	consume_immed			\
 	create_dsq			\
 	dequeue				\
+	dsq_reenq			\
+	enq_immed			\
 	enq_last_no_enq_fails		\
 	ddsp_bogus_dsq_fail		\
 	ddsp_vtimelocal_fail		\
tools/testing/selftests/sched_ext/consume_immed.bpf.c new file +88 -0

88 lines not on this page · raw message

tools/testing/selftests/sched_ext/consume_immed.c new file +115 -0

115 lines not on this page · raw message

tools/testing/selftests/sched_ext/dsq_reenq.bpf.c new file +120 -0

120 lines not on this page · raw message

tools/testing/selftests/sched_ext/dsq_reenq.c new file +95 -0

95 lines not on this page · raw message

tools/testing/selftests/sched_ext/enq_immed.bpf.c new file +63 -0

63 lines not on this page · raw message

tools/testing/selftests/sched_ext/enq_immed.c new file +117 -0

117 lines not on this page · raw message

Signature · 1 line
2.43.0
reviewer Applied
#2 lore raw

Hello,

Applied to sched_ext/for-7.1.

Thanks.

--
tejun