Skip to content

Commit

Permalink
Merge pull request #916 from sched-ext/htejun/scx_layered-verifier-wo…
Browse files Browse the repository at this point in the history
…rkaround

scx_layered: Work around older kernels choking on function calls from…
  • Loading branch information
htejun authored Nov 8, 2024
2 parents 5280206 + bb91ad0 commit 38512bf
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions scheds/rust/scx_layered/src/bpf/main.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ static __noinline u64 layer_dsq_id(u32 layer_id, u32 llc_id)
return (layer_id * nr_llcs) + llc_id;
}

static __noinline u32 cpu_to_llc_id(s32 cpu_id)
// XXX - cpu_to_llc_id() must not be inlined to not blow past ins limit when
// topo is enabled but older kernels get confused by RCU state when subprogs are
// called from sleepable functions. Use __always_inline variant from
// layered_init() and __noinline from everywhere else. Remove this once we can
// ignore the older kernels.
static __always_inline u32 __cpu_to_llc_id(s32 cpu_id)
{
const volatile u32 *llc_ptr;

Expand All @@ -116,6 +121,11 @@ static __noinline u32 cpu_to_llc_id(s32 cpu_id)
return *llc_ptr;
}

static __noinline u32 cpu_to_llc_id(u32 cpu_id)
{
return __cpu_to_llc_id(cpu_id);
}

u32 llc_node_id(u32 llc_id)
{
const volatile u32 *llc_ptr;
Expand Down Expand Up @@ -1777,7 +1787,7 @@ static s32 create_cache(u32 cache_id)
return -ENOENT;
}

llc_id = cpu_to_llc_id(cpu);
llc_id = __cpu_to_llc_id(cpu);
if (llc_id != cache_id)
continue;

Expand Down

0 comments on commit 38512bf

Please sign in to comment.