]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.17-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Nov 2025 14:20:27 +0000 (15:20 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Nov 2025 14:20:27 +0000 (15:20 +0100)
added patches:
sched_ext-fix-flag-check-for-deferred-callbacks.patch
sched_ext-fix-scx_kick_pseqs-corruption-on-concurrent-scheduler-loads.patch

queue-6.17/sched_ext-fix-flag-check-for-deferred-callbacks.patch [new file with mode: 0644]
queue-6.17/sched_ext-fix-scx_kick_pseqs-corruption-on-concurrent-scheduler-loads.patch [new file with mode: 0644]
queue-6.17/series

diff --git a/queue-6.17/sched_ext-fix-flag-check-for-deferred-callbacks.patch b/queue-6.17/sched_ext-fix-flag-check-for-deferred-callbacks.patch
new file mode 100644 (file)
index 0000000..64101f1
--- /dev/null
@@ -0,0 +1,33 @@
+From a3c4a0a42e61aad1056a3d33fd603c1ae66d4288 Mon Sep 17 00:00:00 2001
+From: Emil Tsalapatis <etsal@meta.com>
+Date: Thu, 16 Oct 2025 11:11:26 -0700
+Subject: sched_ext: fix flag check for deferred callbacks
+
+From: Emil Tsalapatis <etsal@meta.com>
+
+commit a3c4a0a42e61aad1056a3d33fd603c1ae66d4288 upstream.
+
+When scheduling the deferred balance callbacks, check SCX_RQ_BAL_CB_PENDING
+instead of SCX_RQ_BAL_PENDING. This way schedule_deferred() properly tests
+whether there is already a pending request for queue_balance_callback() to
+be invoked at the end of .balance().
+
+Fixes: a8ad873113d3 ("sched_ext: defer queue_balance_callback() until after ops.dispatch")
+Signed-off-by: Emil Tsalapatis <emil@etsalapatis.com>
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/sched/ext.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/kernel/sched/ext.c
++++ b/kernel/sched/ext.c
+@@ -821,7 +821,7 @@ static void schedule_deferred(struct rq
+               return;
+       /* Don't do anything if there already is a deferred operation. */
+-      if (rq->scx.flags & SCX_RQ_BAL_PENDING)
++      if (rq->scx.flags & SCX_RQ_BAL_CB_PENDING)
+               return;
+       /*
diff --git a/queue-6.17/sched_ext-fix-scx_kick_pseqs-corruption-on-concurrent-scheduler-loads.patch b/queue-6.17/sched_ext-fix-scx_kick_pseqs-corruption-on-concurrent-scheduler-loads.patch
new file mode 100644 (file)
index 0000000..3e13f01
--- /dev/null
@@ -0,0 +1,48 @@
+From 05e63305c85c88141500f0a2fb02afcfba9396e1 Mon Sep 17 00:00:00 2001
+From: Andrea Righi <arighi@nvidia.com>
+Date: Mon, 13 Oct 2025 22:36:34 +0200
+Subject: sched_ext: Fix scx_kick_pseqs corruption on concurrent scheduler loads
+
+From: Andrea Righi <arighi@nvidia.com>
+
+commit 05e63305c85c88141500f0a2fb02afcfba9396e1 upstream.
+
+If we load a BPF scheduler while another scheduler is already running,
+alloc_kick_pseqs() would be called again, overwriting the previously
+allocated arrays.
+
+Fix by moving the alloc_kick_pseqs() call after the scx_enable_state()
+check, ensuring that the arrays are only allocated when a scheduler can
+actually be loaded.
+
+Fixes: 14c1da3895a11 ("sched_ext: Allocate scx_kick_cpus_pnt_seqs lazily using kvzalloc()")
+Signed-off-by: Andrea Righi <arighi@nvidia.com>
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/sched/ext.c |   10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+--- a/kernel/sched/ext.c
++++ b/kernel/sched/ext.c
+@@ -4632,15 +4632,15 @@ static int scx_enable(struct sched_ext_o
+       mutex_lock(&scx_enable_mutex);
+-      ret = alloc_kick_pseqs();
+-      if (ret)
+-              goto err_unlock;
+-
+       if (scx_enable_state() != SCX_DISABLED) {
+               ret = -EBUSY;
+-              goto err_free_pseqs;
++              goto err_unlock;
+       }
++      ret = alloc_kick_pseqs();
++      if (ret)
++              goto err_unlock;
++
+       sch = scx_alloc_and_add_sched(ops);
+       if (IS_ERR(sch)) {
+               ret = PTR_ERR(sch);
index 35c6b93dec846f68a2b8fea4b12150dce3d0d32f..12b0073a1b3b54b8758b56b64bdcf279e98b3e76 100644 (file)
@@ -171,3 +171,5 @@ drm-amd-display-prevent-gating-dtbclk-before-it-is-properly-latched.patch
 tty-vt-fix-up-incorrect-backport-to-stable-releases.patch
 revert-drm-i915-dp-reject-hbr3-when-sink-doesn-t-support-tps4.patch
 drm-i915-dp-add-device-specific-quirk-to-limit-edp-rate-to-hbr2.patch
+sched_ext-fix-scx_kick_pseqs-corruption-on-concurrent-scheduler-loads.patch
+sched_ext-fix-flag-check-for-deferred-callbacks.patch