Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
cd95ae1
ipc: re-enable test IPC0028
lsf37 Jun 17, 2024
b82f10a
SCHED022: test self core-migration on non-MCS
midnightveil May 8, 2026
957f657
SCHED_CONTEXT_SMP_001: add
midnightveil May 11, 2026
3688e7d
SCHED_CONTEXT_SMP_001: remove unnecessary helper thread
midnightveil May 11, 2026
9c668cc
[unrelated] add BIND007 that tests current MCS design quirk behaviour
midnightveil May 11, 2026
0111440
[unrelated] add a test BIND008 to just confirm signal and lazy rebind…
midnightveil May 11, 2026
68ee258
SMP/MCS: add test for passive server setup on other core
midnightveil May 12, 2026
1d29a0d
SCHED_CONTEXT_SMP_002: make deterministic using NBSendWait
midnightveil May 13, 2026
c3945a0
add SCHED_CONTEXT_SMP_004
midnightveil May 13, 2026
b17e95b
SCHED0023: increase a remote task's priority
midnightveil May 13, 2026
326b2f6
SCHED0024: resuming a suspended remote task
midnightveil May 13, 2026
51881ae
SCHED0025: seL4_SchedContext_YieldTo remote task
midnightveil May 13, 2026
c018d86
SCHED_CONTEXT_SMP_005: blocking remote tasks
midnightveil May 13, 2026
ad0e06e
Test core migrations triggerred by remote signals
midnightveil May 13, 2026
67f3684
SCHED0026: SchedControl_Configure/SetAffinity remote tasks work
midnightveil May 13, 2026
220bdb2
SCHED_CONTEXT_SMP_009: take away budget
midnightveil May 13, 2026
1b94e27
SCHED0023: test also lowering
midnightveil May 13, 2026
4ba3065
SCHED_CONTEXT_SMP_009: use timeout fault
midnightveil May 14, 2026
0381ecb
define mcs tests only on mcs
midnightveil May 14, 2026
8218c59
fix SCHED_CONTEXT_SMP_007
midnightveil May 14, 2026
1b09752
increase wait time as this sometimes fails
midnightveil Jul 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions apps/sel4test-tests/src/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,16 +376,26 @@ void set_helper_mcp(env_t env, helper_thread_t *thread, seL4_Word mcp)
assert(error == seL4_NoError);
}

void set_helper_affinity(UNUSED env_t env, helper_thread_t *thread, seL4_Word affinity)
int set_helper_affinity_fallible(UNUSED env_t env, helper_thread_t *thread, seL4_Word affinity)
{
#ifdef CONFIG_KERNEL_MCS
seL4_Time timeslice = CONFIG_BOOT_THREAD_TIME_SLICE * US_IN_S;
int error = seL4_SchedControl_Configure(simple_get_sched_ctrl(&env->simple, affinity),
thread->thread.sched_context.cptr,
timeslice, timeslice, 0, 0);
ZF_LOGF_IF(error, "Failed to configure scheduling context");
return seL4_SchedControl_Configure(simple_get_sched_ctrl(&env->simple, affinity),
thread->thread.sched_context.cptr,
timeslice, timeslice, 0, 0);
#elif CONFIG_MAX_NUM_NODES > 1
return seL4_TCB_SetAffinity(thread->thread.tcb.cptr, affinity);
#else
assert(affinity == 0);
#endif
}

void set_helper_affinity(UNUSED env_t env, helper_thread_t *thread, seL4_Word affinity)
{
int error = set_helper_affinity_fallible(env, thread, affinity);
#ifdef CONFIG_KERNEL_MCS
ZF_LOGF_IF(error, "Failed to configure scheduling context for affinity");
#elif CONFIG_MAX_NUM_NODES > 1
int error = seL4_TCB_SetAffinity(thread->thread.tcb.cptr, affinity);
ZF_LOGF_IF(error, "Failed to set tcb affinity");
#endif
}
Expand Down
7 changes: 6 additions & 1 deletion apps/sel4test-tests/src/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ void set_helper_priority(env_t env, helper_thread_t *thread, seL4_Word prio);
/* set a helper threads max control priority */
void set_helper_mcp(env_t env, helper_thread_t *thread, seL4_Word mcp);

/* set a helper threads core affinity. This will have no effect on passive threads. */
/* set a helper threads core affinity. This will have no effect on passive threads (MCS).
* if it fails, return an error. */
int set_helper_affinity_fallible(env_t env, helper_thread_t *thread, seL4_Word affinity);

/* set a helper threads core affinity. This will have no effect on passive threads (MCS).
* if it fails, calls ZF_LOGF. */
void set_helper_affinity(env_t env, helper_thread_t *thread, seL4_Word affinity);

/* if CONFIG_KERNEL_MCS is set, set the helpers scheduling parameters */
Expand Down
132 changes: 132 additions & 0 deletions apps/sel4test-tests/src/tests/binding.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,3 +292,135 @@ test_notification_binding_with_sc(env_t env)
}
DEFINE_TEST(BIND006, "Test passing thread notification binding with a scheduling context",
test_notification_binding_with_sc, config_set(CONFIG_KERNEL_MCS))

static int
test_active_notification_binding_with_sc(env_t env)
{
seL4_CPtr endpoint, notification;
int error;
helper_thread_t helper;
volatile int state = 0;

endpoint = vka_alloc_endpoint_leaky(&env->vka);
notification = vka_alloc_notification_leaky(&env->vka);

create_helper_thread(env, &helper);

/* set our prio lower so the helper thread runs when we start it */
set_helper_priority(env, &helper, 10);
error = seL4_TCB_SetPriority(env->tcb, env->tcb, 9);
test_eq(error, seL4_NoError);

error = seL4_TCB_BindNotification(helper.thread.tcb.cptr, notification);
test_eq(error, seL4_NoError);

/* start the helper so it is waiting on the endpoint */
start_helper(env, &helper, (helper_fn_t) bind0005_helper, endpoint,
(seL4_Word) &state, 0, 0);
test_eq(state, 1);

/* clear its sc */
error = api_sc_unbind(helper.thread.sched_context.cptr);
test_eq(error, seL4_NoError);

/* signal it */
seL4_Signal(notification);
/* it should not progress until it has an SC */
test_eq(state, 1);

error = api_sc_bind(helper.thread.sched_context.cptr, notification);
test_eq(error, seL4_NoError);

/* now it should have got the signal.
* However: due to a kernel design issue https://github.com/seL4/seL4/issues/1617
* instead it blocks forever.
*/
// test_eq(state, 2);
test_eq(state, 1);

return sel4test_get_result();
}
DEFINE_TEST(BIND007, "Test unbind TCB / rebind ntfn (passive server migration) with an active notification",
test_active_notification_binding_with_sc, config_set(CONFIG_KERNEL_MCS));

static void
bind0008_helper(seL4_CPtr endpoint, volatile int *state)
{
*state = 1;
seL4_Wait(endpoint, NULL);
*state = 2;
seL4_Wait(endpoint, NULL);
*state = 3;
}


static int
test_active_notification_binding_with_sc_lazy_rebind(env_t env)
{
seL4_CPtr endpoint, notification;
int error;
helper_thread_t helper;
volatile int state = 0;

endpoint = vka_alloc_endpoint_leaky(&env->vka);
notification = vka_alloc_notification_leaky(&env->vka);

create_helper_thread(env, &helper);

/* set our prio lower so the helper thread runs when we start it */
set_helper_priority(env, &helper, 10);
error = seL4_TCB_SetPriority(env->tcb, env->tcb, 9);
test_eq(error, seL4_NoError);

/* set up a bound notification (so endpoint wait <-> notification) */
error = seL4_TCB_BindNotification(helper.thread.tcb.cptr, notification);
test_eq(error, seL4_NoError);

/* start the helper so it is waiting on the endpoint */
start_helper(env, &helper, (helper_fn_t) bind0008_helper, endpoint,
(seL4_Word) &state, 0, 0);
test_eq(state, 1);

/* lower the helper priority so it won't be running */
set_helper_priority(env, &helper, 8);

/* signal the notification - will progress to running on the TCB's SC */
seL4_Signal(notification);

/* it should not progress until it is higher priority than us */
test_eq(state, 1);

/* check SC still bound to TCB */
error = api_sc_bind(helper.thread.sched_context.cptr, helper.thread.tcb.cptr);
test_eq(error, seL4_IllegalOperation);

/* perform lazy rebind */
error = api_sc_bind(helper.thread.sched_context.cptr, notification);
test_eq(error, seL4_NoError);

/* allow helper to run by bumping its priority */
set_helper_priority(env, &helper, 10);

/* it should now be waiting on its endpoint and will have unbound its TCB SC */
test_eq(state, 2);

/* bind and unbind TCB SC to demonstrate that it had been unbound */
error = api_sc_bind(helper.thread.sched_context.cptr, helper.thread.tcb.cptr);
test_eq(error, seL4_NoError);

error = api_sc_unbind_object(helper.thread.sched_context.cptr, helper.thread.tcb.cptr);
test_eq(error, seL4_NoError);

/* the notification should still be bound */
error = api_sc_bind(helper.thread.sched_context.cptr, notification);
test_eq(error, seL4_IllegalOperation);

/* signal so it should continue */
seL4_Signal(notification);

test_eq(state, 3);

return sel4test_get_result();
}
DEFINE_TEST(BIND008, "Test lazy SC rebind (passive server migration) with an active notification",
test_active_notification_binding_with_sc_lazy_rebind, config_set(CONFIG_KERNEL_MCS));
6 changes: 2 additions & 4 deletions apps/sel4test-tests/src/tests/ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1356,8 +1356,6 @@ static int test_sched_donation_cross_core(env_t env)

return sel4test_get_result();
}
/* This test currently fails.
See https://github.com/seL4/seL4/issues/941 and https://github.com/seL4/seL4/pull/986 */
DEFINE_TEST(IPC0028, "Cross core sched donation", test_sched_donation_cross_core, false);
/* config_set(CONFIG_KERNEL_MCS) &&(CONFIG_MAX_NUM_NODES > 1)); */
DEFINE_TEST(IPC0028, "Cross core sched donation", test_sched_donation_cross_core,
config_set(CONFIG_KERNEL_MCS) &&(CONFIG_MAX_NUM_NODES > 1));
#endif /* CONFIG_KERNEL_MCS */
Loading
Loading