mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH sched_ext/for-7.4-fixes] sched_ext: Fix scx_bpf_dsq_reenq() kerneldoc claiming NMI calls are allowed
@ 2026-10-29 23:52 Tejun Heo
  2026-10-30  6:11 ` Andrea Righi
  0 siblings, 1 reply; 2+ messages in thread
From: Tejun Heo @ 2026-10-29 23:52 UTC (permalink / raw)
  To: sched-ext
  Cc: David Vernet, Andrea Righi, Changwoo Min, Emil Tsalapatis,
	David Dai, linux-kernel, Tejun Heo

c659e506f9a7 ("sched_ext: Reject NMI calls to lock-taking kfuncs") made
scx_bpf_dsq_reenq() abort the scheduler when called from NMI. The kerneldocs
of scx_bpf_dsq_reenq() and of its wrapper scx_bpf_reenqueue_local___v2()
still say the kfuncs can be called from anywhere. Update both to exclude
NMI.

While at it, fix the wrapper's kerneldoc, which says it re-enqueues the
calling CPU's local DSQ rather than the one SCX_DSQ_LOCAL resolves to, and
the SCX_RENQ_* typo in the scx_bpf_dsq_reenq() kerneldoc.

Signed-off-by: Tejun Heo <tj@kernel.org>
---
 kernel/sched/ext/ext.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
index 15123f181b5b..cd923f9f1f2a 100644
--- a/kernel/sched/ext/ext.c
+++ b/kernel/sched/ext/ext.c
@@ -11115,7 +11115,7 @@ __bpf_kfunc struct task_struct *scx_bpf_dsq_peek(u64 dsq_id,
 /**
  * scx_bpf_dsq_reenq - Re-enqueue tasks on a DSQ
  * @dsq_id: DSQ to re-enqueue
- * @reenq_flags: %SCX_RENQ_*
+ * @reenq_flags: %SCX_REENQ_*
  * @aux: implicit BPF argument to access bpf_prog_aux hidden from BPF progs
  *
  * Iterate over all of the tasks currently enqueued on the DSQ identified by
@@ -11125,8 +11125,9 @@ __bpf_kfunc struct task_struct *scx_bpf_dsq_peek(u64 dsq_id,
  * - Local DSQs (%SCX_DSQ_LOCAL or %SCX_DSQ_LOCAL_ON | $cpu)
  * - User DSQs
  *
- * Re-enqueues are performed asynchronously. Can be called from anywhere. A
- * re-enqueue of an inactive cpu's local DSQ is ignored.
+ * Re-enqueues are performed asynchronously. Can be called from any context
+ * except NMI. A call from NMI aborts the scheduler. A re-enqueue of an inactive
+ * cpu's local DSQ is ignored.
  *
  * %SCX_DSQ_LOCAL resolves to the local DSQ of the rq the current scheduler
  * operation is locked to - e.g. the rq being dispatched for in ops.dispatch() -
@@ -11223,9 +11224,10 @@ __bpf_kfunc bool scx_bpf_dsq_reenq_task(struct bpf_iter_scx_dsq *it__iter,
  * scx_bpf_reenqueue_local___v2 - Re-enqueue tasks on a local DSQ
  * @aux: implicit BPF argument to access bpf_prog_aux hidden from BPF progs
  *
- * Iterate over all of the tasks currently enqueued on the local DSQ of the
- * caller's CPU, and re-enqueue them in the BPF scheduler. Can be called from
- * anywhere.
+ * Iterate over all of the tasks currently enqueued on the local DSQ of the rq
+ * the current scheduler operation is locked to, or the calling CPU's when no rq
+ * is locked, and re-enqueue them in the BPF scheduler. Can be called from any
+ * context except NMI. A call from NMI aborts the scheduler.
  *
  * This is now a special case of scx_bpf_dsq_reenq() and may be removed in the
  * future.
-- 
2.56.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH sched_ext/for-7.4-fixes] sched_ext: Fix scx_bpf_dsq_reenq() kerneldoc claiming NMI calls are allowed
  2026-10-29 23:52 [PATCH sched_ext/for-7.4-fixes] sched_ext: Fix scx_bpf_dsq_reenq() kerneldoc claiming NMI calls are allowed Tejun Heo
@ 2026-10-30  6:11 ` Andrea Righi
  0 siblings, 0 replies; 2+ messages in thread
From: Andrea Righi @ 2026-10-30  6:11 UTC (permalink / raw)
  To: Tejun Heo
  Cc: sched-ext, David Vernet, Changwoo Min, Emil Tsalapatis,
	David Dai, linux-kernel

On Thu, Oct 29, 2026 at 01:52:51PM -1000, Tejun Heo wrote:
> c659e506f9a7 ("sched_ext: Reject NMI calls to lock-taking kfuncs") made
> scx_bpf_dsq_reenq() abort the scheduler when called from NMI. The kerneldocs
> of scx_bpf_dsq_reenq() and of its wrapper scx_bpf_reenqueue_local___v2()
> still say the kfuncs can be called from anywhere. Update both to exclude
> NMI.
> 
> While at it, fix the wrapper's kerneldoc, which says it re-enqueues the
> calling CPU's local DSQ rather than the one SCX_DSQ_LOCAL resolves to, and
> the SCX_RENQ_* typo in the scx_bpf_dsq_reenq() kerneldoc.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>

Acked-by: Andrea Righi <arighi@nvidia.com>

Thanks,
-Andrea

> ---
>  kernel/sched/ext/ext.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
> index 15123f181b5b..cd923f9f1f2a 100644
> --- a/kernel/sched/ext/ext.c
> +++ b/kernel/sched/ext/ext.c
> @@ -11115,7 +11115,7 @@ __bpf_kfunc struct task_struct *scx_bpf_dsq_peek(u64 dsq_id,
>  /**
>   * scx_bpf_dsq_reenq - Re-enqueue tasks on a DSQ
>   * @dsq_id: DSQ to re-enqueue
> - * @reenq_flags: %SCX_RENQ_*
> + * @reenq_flags: %SCX_REENQ_*
>   * @aux: implicit BPF argument to access bpf_prog_aux hidden from BPF progs
>   *
>   * Iterate over all of the tasks currently enqueued on the DSQ identified by
> @@ -11125,8 +11125,9 @@ __bpf_kfunc struct task_struct *scx_bpf_dsq_peek(u64 dsq_id,
>   * - Local DSQs (%SCX_DSQ_LOCAL or %SCX_DSQ_LOCAL_ON | $cpu)
>   * - User DSQs
>   *
> - * Re-enqueues are performed asynchronously. Can be called from anywhere. A
> - * re-enqueue of an inactive cpu's local DSQ is ignored.
> + * Re-enqueues are performed asynchronously. Can be called from any context
> + * except NMI. A call from NMI aborts the scheduler. A re-enqueue of an inactive
> + * cpu's local DSQ is ignored.
>   *
>   * %SCX_DSQ_LOCAL resolves to the local DSQ of the rq the current scheduler
>   * operation is locked to - e.g. the rq being dispatched for in ops.dispatch() -
> @@ -11223,9 +11224,10 @@ __bpf_kfunc bool scx_bpf_dsq_reenq_task(struct bpf_iter_scx_dsq *it__iter,
>   * scx_bpf_reenqueue_local___v2 - Re-enqueue tasks on a local DSQ
>   * @aux: implicit BPF argument to access bpf_prog_aux hidden from BPF progs
>   *
> - * Iterate over all of the tasks currently enqueued on the local DSQ of the
> - * caller's CPU, and re-enqueue them in the BPF scheduler. Can be called from
> - * anywhere.
> + * Iterate over all of the tasks currently enqueued on the local DSQ of the rq
> + * the current scheduler operation is locked to, or the calling CPU's when no rq
> + * is locked, and re-enqueue them in the BPF scheduler. Can be called from any
> + * context except NMI. A call from NMI aborts the scheduler.
>   *
>   * This is now a special case of scx_bpf_dsq_reenq() and may be removed in the
>   * future.
> -- 
> 2.56.0
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-30  6:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-29 23:52 [PATCH sched_ext/for-7.4-fixes] sched_ext: Fix scx_bpf_dsq_reenq() kerneldoc claiming NMI calls are allowed Tejun Heo
2026-10-30  6:11 ` Andrea Righi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®