Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Commit

Permalink
scx: Validate that cpu callbacks can be sleepable
Browse files Browse the repository at this point in the history
Now that ops.cpu_online() and ops.cpu_offline() can be sleepable,
let's update their test BPF progs to be sleepable to validate.

Signed-off-by: David Vernet <void@manifault.com>
  • Loading branch information
Byte-Lab committed Jun 6, 2024
1 parent a5a1608 commit 36773d9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tools/testing/selftests/sched_ext/hotplug.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ void BPF_STRUCT_OPS(hotplug_exit, struct scx_exit_info *ei)

static void exit_from_hotplug(s32 cpu, bool onlining)
{
/*
* Ignored, just used to verify that we can invoke blocking kfuncs
* from the hotplug path.
*/
scx_bpf_create_dsq(0, -1);

s64 code = SCX_ECODE_ACT_RESTART | HOTPLUG_EXIT_RSN;

if (onlining)
Expand All @@ -28,12 +34,12 @@ static void exit_from_hotplug(s32 cpu, bool onlining)
onlining ? "online" : "offline");
}

void BPF_STRUCT_OPS(hotplug_cpu_online, s32 cpu)
void BPF_STRUCT_OPS_SLEEPABLE(hotplug_cpu_online, s32 cpu)
{
exit_from_hotplug(cpu, true);
}

void BPF_STRUCT_OPS(hotplug_cpu_offline, s32 cpu)
void BPF_STRUCT_OPS_SLEEPABLE(hotplug_cpu_offline, s32 cpu)
{
exit_from_hotplug(cpu, false);
}
Expand Down

0 comments on commit 36773d9

Please sign in to comment.