The per-cpu kick lists are protected by IRQ masking which doesn't stop NMIs, so scx_bpf_kick_cpu() from NMI silently drops the kick after a one-time warning. A dropped kick can leave a CPU idle when the scheduler believes it was woken, which is a correctness problem for the scheduler even if the kernel is fine. Now that scx_error() works from NMI, abort the scheduler instead so that the bug is surfaced deterministically. The warned_nmi_kick tracking is no longer needed.
Showing the changes to kernel (2 of 2 files). Show all
Unified · Split
| @@ -9219,11 +9219,7 @@ void scx_kick_cpu(struct scx_sched *sch, s32 cpu, u64 flags) · 9218 unmodified lines | |||
| 9219 | * not mask NMIs, so kicking from NMI could corrupt it and is unsupported. | 9219 | * not mask NMIs, so kicking from NMI could corrupt it and is unsupported. |
| 9220 | */ | 9220 | */ |
| 9221 | if (unlikely(in_nmi())) { | 9221 | if (unlikely(in_nmi())) { |
| 9222 | if (!sch->warned_nmi_kick) { | 9222 | scx_error(sch, "scx_bpf_kick_cpu() called from NMI"); |
| 9223 | sch->warned_nmi_kick = true; | ||
| 9224 | pr_warn("sched_ext: %s: scx_bpf_kick_cpu() from NMI ignored\n", | ||
| 9225 | sch->ops.name); | ||
| 9226 | } | ||
| 9227 | return; | 9223 | return; |
| 9228 | } | 9224 | } |
| 9229 | 9225 | ||
| @@ -1543,7 +1543,6 @@ struct scx_sched { · 1542 unmodified lines | |||
| 1543 | */ | 1543 | */ |
| 1544 | bool warned_zero_slice:1; | 1544 | bool warned_zero_slice:1; |
| 1545 | bool warned_unassoc_progs:1; | 1545 | bool warned_unassoc_progs:1; |
| 1546 | bool warned_nmi_kick:1; | ||
| 1547 | 1546 | ||
| 1548 | struct list_head all; | 1547 | struct list_head all; |
| 1549 | 1548 | ||