Skip to content

Commit

Permalink
selftests/bpf: Check for PREEMPTION instead of PREEMPT
Browse files Browse the repository at this point in the history
CONFIG_PREEMPT is a preemtion model the so called "Low-Latency Desktop".
A different preemption model is PREEMPT_RT the so called "Real-Time".
Both implement preemption in kernel and set CONFIG_PREEMPTION.
There is also the so called "LAZY PREEMPT" which the "Scheduler
controlled preemption model". Here we have also preemption in the kernel
the rules are slightly different.

Therefore the testsuite should not check for CONFIG_PREEMPT (as one
model) but for CONFIG_PREEMPTION to figure out if preemption in the
kernel is possible.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Link: https://lore.kernel.org/r/20241119161819.qvEcs-n_@linutronix.de
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
  • Loading branch information
Sebastian Andrzej Siewior authored and Alexei Starovoitov committed Nov 26, 2024
1 parent ef3ba8c commit 6b64128
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions tools/testing/selftests/bpf/map_tests/task_storage_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ void test_task_storage_map_stress_lookup(void)
CHECK(err, "open_and_load", "error %d\n", err);

/* Only for a fully preemptible kernel */
if (!skel->kconfig->CONFIG_PREEMPT) {
printf("%s SKIP (no CONFIG_PREEMPT)\n", __func__);
if (!skel->kconfig->CONFIG_PREEMPTION) {
printf("%s SKIP (no CONFIG_PREEMPTION)\n", __func__);
read_bpf_task_storage_busy__destroy(skel);
skips++;
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ static void test_nodeadlock(void)
/* Unnecessary recursion and deadlock detection are reproducible
* in the preemptible kernel.
*/
if (!skel->kconfig->CONFIG_PREEMPT) {
if (!skel->kconfig->CONFIG_PREEMPTION) {
test__skip();
goto done;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>

extern bool CONFIG_PREEMPT __kconfig __weak;
extern bool CONFIG_PREEMPTION __kconfig __weak;
extern const int bpf_task_storage_busy __ksym;

char _license[] SEC("license") = "GPL";
Expand All @@ -24,7 +24,7 @@ int BPF_PROG(read_bpf_task_storage_busy)
{
int *value;

if (!CONFIG_PREEMPT)
if (!CONFIG_PREEMPTION)
return 0;

if (bpf_get_current_pid_tgid() >> 32 != pid)
Expand Down
4 changes: 2 additions & 2 deletions tools/testing/selftests/bpf/progs/task_storage_nodeadlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ char _license[] SEC("license") = "GPL";
#define EBUSY 16
#endif

extern bool CONFIG_PREEMPT __kconfig __weak;
extern bool CONFIG_PREEMPTION __kconfig __weak;
int nr_get_errs = 0;
int nr_del_errs = 0;

Expand All @@ -29,7 +29,7 @@ int BPF_PROG(socket_post_create, struct socket *sock, int family, int type,
int ret, zero = 0;
int *value;

if (!CONFIG_PREEMPT)
if (!CONFIG_PREEMPTION)
return 0;

task = bpf_get_current_task_btf();
Expand Down

0 comments on commit 6b64128

Please sign in to comment.