linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] sched_ext: Introduce rq lock tracking
@ 2025-04-19 12:24 Andrea Righi
  2025-04-19 12:24 ` [PATCH 1/2] sched_ext: Track currently locked rq Andrea Righi
  2025-04-19 12:24 ` [PATCH 2/2] sched_ext: Fix missing rq lock in scx_bpf_cpuperf_set() Andrea Righi
  0 siblings, 2 replies; 18+ messages in thread
From: Andrea Righi @ 2025-04-19 12:24 UTC (permalink / raw)
  To: Tejun Heo, David Vernet, Changwoo Min; +Cc: linux-kernel

Add rq lock tracking to sched_ext ops callbacks to enable scx_bpf_*()
kfuncs to detect whether a specific rq is currently locked and safely
operate with it.

If no rq is locked, the target rq lock can be acquired. If a different rq
is already locked, the operation can either fail (triggering an ops error),
deferred using IRQ work, or managed accordingly to avoid deadlocks.

This patchset is also available in the following git branch:

 git://git.kernel.org/pub/scm/linux/kernel/git/arighi/linux.git scx-rq-lock-tracking

diffstat follows:

Andrea Righi (2):
      sched_ext: Track currently locked rq
      sched_ext: Fix missing rq lock in scx_bpf_cpuperf_set()

 include/linux/sched/ext.h |   1 +
 kernel/sched/ext.c        | 153 ++++++++++++++++++++++++++++++----------------
 kernel/sched/ext_idle.c   |   2 +-
 3 files changed, 101 insertions(+), 55 deletions(-)

^ permalink raw reply	[flat|nested] 18+ messages in thread
* [PATCH v2 0/2] sched_ext: Introduce rq lock tracking
@ 2025-04-20 19:30 Andrea Righi
  2025-04-20 19:30 ` [PATCH 1/2] sched_ext: Track currently locked rq Andrea Righi
  0 siblings, 1 reply; 18+ messages in thread
From: Andrea Righi @ 2025-04-20 19:30 UTC (permalink / raw)
  To: Tejun Heo, David Vernet, Changwoo Min; +Cc: linux-kernel

Add rq lock tracking to sched_ext ops callbacks to enable scx_bpf_*()
kfuncs to detect whether a specific rq is currently locked and safely
operate with it.

If no rq is locked, the target rq lock can be acquired. If a different rq
is already locked, the operation can either fail (triggering an ops error),
deferred using IRQ work, or managed accordingly to avoid deadlocks.

This patchset is also available in the following git branch:

 git://git.kernel.org/pub/scm/linux/kernel/git/arighi/linux.git scx-rq-lock-tracking

Changes in v2:
 - store currently locked rq in a percpu variable
 - link to v1: https://lore.kernel.org/all/20250419123536.154469-1-arighi@nvidia.com

Andrea Righi (2):
      sched_ext: Track currently locked rq
      sched_ext: Fix missing rq lock in scx_bpf_cpuperf_set()

 kernel/sched/ext.c      | 163 ++++++++++++++++++++++++++++++++----------------
 kernel/sched/ext_idle.c |   2 +-
 2 files changed, 110 insertions(+), 55 deletions(-)

^ permalink raw reply	[flat|nested] 18+ messages in thread
* [PATCH v3 0/2] sched_ext: Introduce rq lock tracking
@ 2025-04-22  8:26 Andrea Righi
  2025-04-22  8:26 ` [PATCH 1/2] sched_ext: Track currently locked rq Andrea Righi
  0 siblings, 1 reply; 18+ messages in thread
From: Andrea Righi @ 2025-04-22  8:26 UTC (permalink / raw)
  To: Tejun Heo, David Vernet, Changwoo Min; +Cc: linux-kernel

Add rq lock tracking to sched_ext ops callbacks to enable scx_bpf_*()
kfuncs to detect whether a specific rq is currently locked and safely
operate with it.

If no rq is locked, the target rq lock can be acquired. If a different rq
is already locked, the operation can either fail (triggering an ops error),
deferred using IRQ work, or managed accordingly to avoid deadlocks.

This patchset is also available in the following git branch:

 git://git.kernel.org/pub/scm/linux/kernel/git/arighi/linux.git scx-rq-lock-tracking

Changes in v3:
 - remove unnecessary rq != NULL optimization check in SCX_CALL_OP()
 - reorder SCX_CALL_OP*() arguments to group static args together
 - link to v2: https://lore.kernel.org/all/20250420193106.42533-1-arighi@nvidia.com/

Changes in v2:
 - store currently locked rq in a percpu variable
 - link to v1: https://lore.kernel.org/all/20250419123536.154469-1-arighi@nvidia.com

Andrea Righi (2):
      sched_ext: Track currently locked rq
      sched_ext: Fix missing rq lock in scx_bpf_cpuperf_set()

 kernel/sched/ext.c      | 179 +++++++++++++++++++++++++++++++-----------------
 kernel/sched/ext_idle.c |   2 +-
 2 files changed, 118 insertions(+), 63 deletions(-)

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

end of thread, other threads:[~2025-07-16 12:43 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-19 12:24 [PATCH 0/2] sched_ext: Introduce rq lock tracking Andrea Righi
2025-04-19 12:24 ` [PATCH 1/2] sched_ext: Track currently locked rq Andrea Righi
2025-04-19 17:34   ` Tejun Heo
2025-04-19 20:10     ` Andrea Righi
2025-04-19 20:30       ` Andrea Righi
2025-04-19 21:27         ` Andrea Righi
2025-04-20 17:44         ` Tejun Heo
2025-04-20 18:34           ` Andrea Righi
2025-04-19 12:24 ` [PATCH 2/2] sched_ext: Fix missing rq lock in scx_bpf_cpuperf_set() Andrea Righi
  -- strict thread matches above, loose matches on Subject: below --
2025-04-20 19:30 [PATCH v2 0/2] sched_ext: Introduce rq lock tracking Andrea Righi
2025-04-20 19:30 ` [PATCH 1/2] sched_ext: Track currently locked rq Andrea Righi
2025-04-21 19:03   ` Tejun Heo
2025-04-22  6:27     ` Andrea Righi
2025-04-22  8:26 [PATCH v3 0/2] sched_ext: Introduce rq lock tracking Andrea Righi
2025-04-22  8:26 ` [PATCH 1/2] sched_ext: Track currently locked rq Andrea Righi
2025-07-15  9:13   ` Breno Leitao
2025-07-15 17:20     ` Andrea Righi
2025-07-16 10:47       ` Breno Leitao
2025-07-16 12:40         ` Andrea Righi
2025-07-16 12:43           ` Breno Leitao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).