1
0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2026-01-11 17:10:13 +00:00

Compare commits

...

11 Commits

Author SHA1 Message Date
Linus Torvalds
7839932417 sched_ext: Fixes for v6.19-rc3
- Fix uninitialized @ret on alloc_percpu() failure leading to ERR_PTR(0).
 
 - Fix PREEMPT_RT warning when bypass load balancer sends IPI to offline
   CPU by using resched_cpu() instead of resched_curr().
 
 - Fix comment referring to renamed function.
 
 - Update scx_show_state.py for scx_root and scx_aborting changes.
 -----BEGIN PGP SIGNATURE-----
 
 iIQEABYKACwWIQTfIjM1kS57o3GsC/uxYfJx3gVYGQUCaVHQAw4cdGpAa2VybmVs
 Lm9yZwAKCRCxYfJx3gVYGdJ2AP9nLMUa5Rw2hpcKCLvPjgkqe5fDpNteWrQB3ni9
 bu28jQD/XGMwooJbATlDEgCtFqCH74QbddqUABJxBw4FE8qpUgw=
 =hp6J
 -----END PGP SIGNATURE-----

Merge tag 'sched_ext-for-6.19-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext

Pull sched_ext fixes from Tejun Heo:

 - Fix uninitialized @ret on alloc_percpu() failure leading to
   ERR_PTR(0)

 - Fix PREEMPT_RT warning when bypass load balancer sends IPI to offline
   CPU by using resched_cpu() instead of resched_curr()

 - Fix comment referring to renamed function

 - Update scx_show_state.py for scx_root and scx_aborting changes

* tag 'sched_ext-for-6.19-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext:
  tools/sched_ext: update scx_show_state.py for scx_aborting change
  tools/sched_ext: fix scx_show_state.py for scx_root change
  sched_ext: Use the resched_cpu() to replace resched_curr() in the bypass_lb_node()
  sched_ext: Fix some comments in ext.c
  sched_ext: fix uninitialized ret on alloc_percpu() failure
2025-12-28 17:21:36 -08:00
Linus Torvalds
bba0b6a1c4 cgroup: Fixes for v6.19-rc3
- cpuset: Fix spurious warning when disabling remote partition after CPU
   hotplug leaves subpartitions_cpus empty. Guard the warning and invalidate
   affected partitions.
 -----BEGIN PGP SIGNATURE-----
 
 iIQEABYKACwWIQTfIjM1kS57o3GsC/uxYfJx3gVYGQUCaVHNBg4cdGpAa2VybmVs
 Lm9yZwAKCRCxYfJx3gVYGW13AQC7akGwBAjBbR5p0aoLXKl5vZ8UYiwH+7iyep2Z
 INn7ggEA/huYF4smSRk3oR8q7eiISa85mZc85EuVEAjPmBQhpAQ=
 =9UP0
 -----END PGP SIGNATURE-----

Merge tag 'cgroup-for-6.19-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup

Pull cgroup fix from Tejun Heo:

 - Fix a spurious cpuset warning when disabling remote partition after
   CPU hotplug leaves subpartitions_cpus empty. Guard the warning and
   invalidate affected partitions.

* tag 'cgroup-for-6.19-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
  cpuset: fix warning when disabling remote partition
2025-12-28 17:19:09 -08:00
Linus Torvalds
a69eddfd17 This push contains the following changes:
- Fix UAF in seqiv.
 - Fix regression in hisilicon.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEn51F/lCuNhUwmDeSxycdCkmxi6cFAmlRy74ACgkQxycdCkmx
 i6c72BAAhTJWUYKnI3KW65wCLObVR10AL5Hp/kYTRE2eOwkmnNXjlJVe80mnPhaU
 K64l0wsAKCkMjw3O0/KXH3nxqXN0+f67r5FZY07GJBj2yIQzTON2X1DxNcJ3DaUY
 CWEHJXtjipZu9f23K4fuHUQ5jxcvkigrH8Z5cfJ6I/KD/NpsbXUunEnkfV9QTDnX
 BKVEu7t9hdFX0OTLWTFUIAAlnS3Onu67F2uD1voLujBG+2aUNjuIk6ToAjKPTiam
 u03YigOsTsZBOgjM4O60rX33X/XJan2uNTkmvQQIUXWDB0ZvDvvXGZbxayEZXnSJ
 exWWv81uL4jAV76CYWSka8ILxdsqAIjlESnm8Vjn3YuVvEwQoI9Lvpyje64xv1ZR
 MqjfLXKrczu0NgKqP9GN9CqB3Yp6KxX7Xe+U7o+b1X/SSevoyhh18oMF1c4s9dfg
 6IqgK8byLZrge2Shpl7GsT21X9lQ9f/poUvbX9eNoyDn/EeqliR1i+4ydgaCW5Rx
 mK0UDwOpCxCAwd1H02Hy7bExAZnGwKXFsJJHSeHk/9y6gPmht+B4b5tGgDnkTCeu
 od6RXuAwKN+LKhNAybZSw1leEkvD48xggvRFtXg56nsqT4adbgL0QOPB3/iF01gt
 5LQu3I9vc4cjPj6Sx/tpTpkvyBog2C/sYMuHTl70UwpnloDcaKA=
 =vH+M
 -----END PGP SIGNATURE-----

Merge tag 'v6.19-p2' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6

Pull crypto fixes from Herbert Xu:

 - Fix UAF in seqiv

 - Fix regression in hisilicon

* tag 'v6.19-p2' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  crypto: hisilicon/qm - fix incorrect judgment in qm_get_complete_eqe_num()
  crypto: seqiv - Do not use req->iv after crypto_aead_encrypt
2025-12-28 16:55:16 -08:00
Kohei Enju
c9894e6f01 tools/sched_ext: update scx_show_state.py for scx_aborting change
Commit a69040ed57f5 ("sched_ext: Simplify breather mechanism with
scx_aborting flag") removed scx_in_softlockup and scx_breather_depth,
replacing them with scx_aborting.

Update the script accordingly.

Fixes: a69040ed57f5 ("sched_ext: Simplify breather mechanism with scx_aborting flag")
Signed-off-by: Kohei Enju <enjuk@amazon.com>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
2025-12-28 06:11:26 -10:00
Kohei Enju
f92ff79ba2 tools/sched_ext: fix scx_show_state.py for scx_root change
Commit 48e126777386 ("sched_ext: Introduce scx_sched") introduced
scx_root and removed scx_ops, causing scx_show_state.py to fail when
searching for the 'scx_ops' object. [1]

Fix by using 'scx_root' instead, with NULL pointer handling.

[1]
 # drgn -s vmlinux ./tools/sched_ext/scx_show_state.py
 Traceback (most recent call last):
   File "/root/.venv/bin/drgn", line 8, in <module>
     sys.exit(_main())
              ~~~~~^^
   File "/root/.venv/lib64/python3.14/site-packages/drgn/cli.py", line 625, in _main
     runpy.run_path(
     ~~~~~~~~~~~~~~^
         script_path, init_globals={"prog": prog}, run_name="__main__"
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     )
     ^
   File "<frozen runpy>", line 287, in run_path
   File "<frozen runpy>", line 98, in _run_module_code
   File "<frozen runpy>", line 88, in _run_code
   File "./tools/sched_ext/scx_show_state.py", line 30, in <module>
     ops = prog['scx_ops']
           ~~~~^^^^^^^^^^^
 _drgn.ObjectNotFoundError: could not find 'scx_ops'

Fixes: 48e126777386 ("sched_ext: Introduce scx_sched")
Signed-off-by: Kohei Enju <enjuk@amazon.com>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
2025-12-28 06:11:13 -10:00
Zqiang
ccaeeb585c sched_ext: Use the resched_cpu() to replace resched_curr() in the bypass_lb_node()
For the PREEMPT_RT kernels, the scx_bypass_lb_timerfn() running in the
preemptible per-CPU ktimer kthread context, this means that the following
scenarios will occur(for x86 platform):

       cpu1                          cpu2
				 ktimer kthread:
                                 ->scx_bypass_lb_timerfn
                                   ->bypass_lb_node
                                     ->for_each_cpu(cpu, resched_mask)

    migration/1:                       by preempt by migration/2:
    multi_cpu_stop()                     multi_cpu_stop()
    ->take_cpu_down()
      ->__cpu_disable()
	->set cpu1 offline

                                       ->rq1 = cpu_rq(cpu1)
                                       ->resched_curr(rq1)
                                         ->smp_send_reschedule(cpu1)
					   ->native_smp_send_reschedule(cpu1)
					     ->if(unlikely(cpu_is_offline(cpu))) {
                					WARN(1, "sched: Unexpected
							reschedule of offline CPU#%d!\n", cpu);
                					return;
        					}

This commit therefore use the resched_cpu() to replace resched_curr()
in the bypass_lb_node() to avoid send-ipi to offline CPUs.

Signed-off-by: Zqiang <qiang.zhang@linux.dev>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
2025-12-22 17:51:51 -10:00
Zqiang
12494e5e2a sched_ext: Fix some comments in ext.c
This commit update balance_scx() in the comments to balance_one().

Signed-off-by: Zqiang <qiang.zhang@linux.dev>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
2025-12-19 13:11:22 -10:00
Chenghai Huang
b74fd80d7f crypto: hisilicon/qm - fix incorrect judgment in qm_get_complete_eqe_num()
In qm_get_complete_eqe_num(), the function entry has already
checked whether the interrupt is valid, so the interrupt event
can be processed directly. Currently, the interrupt valid bit is
being checked again redundantly, and no interrupt processing is
performed. Therefore, the loop condition should be modified to
directly process the interrupt event, and use do while instead of
the current while loop, because the condition is always satisfied
on the first iteration.

Fixes: f5a332980a68 ("crypto: hisilicon/qm - add the save operation of eqe and aeqe")
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2025-12-19 14:47:46 +08:00
Herbert Xu
50fdb78b7c crypto: seqiv - Do not use req->iv after crypto_aead_encrypt
As soon as crypto_aead_encrypt is called, the underlying request
may be freed by an asynchronous completion.  Thus dereferencing
req->iv after it returns is invalid.

Instead of checking req->iv against info, create a new variable
unaligned_info and use it for that purpose instead.

Fixes: 0a270321dbf9 ("[CRYPTO] seqiv: Add Sequence Number IV Generator")
Reported-by: Xiumei Mu <xmu@redhat.com>
Reported-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2025-12-19 14:47:06 +08:00
Chen Ridong
aa7d3a56a2 cpuset: fix warning when disabling remote partition
A warning was triggered as follows:

WARNING: kernel/cgroup/cpuset.c:1651 at remote_partition_disable+0xf7/0x110
RIP: 0010:remote_partition_disable+0xf7/0x110
RSP: 0018:ffffc90001947d88 EFLAGS: 00000206
RAX: 0000000000007fff RBX: ffff888103b6e000 RCX: 0000000000006f40
RDX: 0000000000006f00 RSI: ffffc90001947da8 RDI: ffff888103b6e000
RBP: ffff888103b6e000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000001 R11: ffff88810b2e2728 R12: ffffc90001947da8
R13: 0000000000000000 R14: ffffc90001947da8 R15: ffff8881081f1c00
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f55c8bbe0b2 CR3: 000000010b14c000 CR4: 00000000000006f0
Call Trace:
 <TASK>
 update_prstate+0x2d3/0x580
 cpuset_partition_write+0x94/0xf0
 kernfs_fop_write_iter+0x147/0x200
 vfs_write+0x35d/0x500
 ksys_write+0x66/0xe0
 do_syscall_64+0x6b/0x390
 entry_SYSCALL_64_after_hwframe+0x4b/0x53
RIP: 0033:0x7f55c8cd4887

Reproduction steps (on a 16-CPU machine):

        # cd /sys/fs/cgroup/
        # mkdir A1
        # echo +cpuset > A1/cgroup.subtree_control
        # echo "0-14" > A1/cpuset.cpus.exclusive
        # mkdir A1/A2
        # echo "0-14" > A1/A2/cpuset.cpus.exclusive
        # echo "root" > A1/A2/cpuset.cpus.partition
        # echo 0 > /sys/devices/system/cpu/cpu15/online
        # echo member > A1/A2/cpuset.cpus.partition

When CPU 15 is offlined, subpartitions_cpus gets cleared because no CPUs
remain available for the top_cpuset, forcing partitions to share CPUs with
the top_cpuset. In this scenario, disabling the remote partition triggers
a warning stating that effective_xcpus is not a subset of
subpartitions_cpus. Partitions should be invalidated in this case to
inform users that the partition is now invalid(cpus are shared with
top_cpuset).

To fix this issue:
1. Only emit the warning only if subpartitions_cpus is not empty and the
   effective_xcpus is not a subset of subpartitions_cpus.
2. During the CPU hotplug process, invalidate partitions if
   subpartitions_cpus is empty.

Fixes: f62a5d39368e ("cgroup/cpuset: Remove remote_partition_check() & make update_cpumasks_hier() handle remote partition")
Signed-off-by: Chen Ridong <chenridong@huawei.com>
Reviewed-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
2025-12-18 06:38:54 -10:00
Liang Jie
b0101ccb5b sched_ext: fix uninitialized ret on alloc_percpu() failure
Smatch reported:

  kernel/sched/ext.c:5332 scx_alloc_and_add_sched() warn: passing zero to 'ERR_PTR'

In scx_alloc_and_add_sched(), the alloc_percpu() failure path jumps to
err_free_gdsqs without initializing @ret. That can lead to returning
ERR_PTR(0), which violates the ERR_PTR() convention and confuses
callers.

Set @ret to -ENOMEM before jumping to the error path when
alloc_percpu() fails.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/r/202512141601.yAXDAeA9-lkp@intel.com/
Reported-by: Dan Carpenter <error27@gmail.com>
Fixes: c201ea1578d3 ("sched_ext: Move event_stats_cpu into scx_sched")
Signed-off-by: Liang Jie <liangjie@lixiang.com>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
2025-12-16 09:15:03 -10:00
5 changed files with 41 additions and 30 deletions

View File

@ -50,6 +50,7 @@ static int seqiv_aead_encrypt(struct aead_request *req)
struct aead_geniv_ctx *ctx = crypto_aead_ctx(geniv); struct aead_geniv_ctx *ctx = crypto_aead_ctx(geniv);
struct aead_request *subreq = aead_request_ctx(req); struct aead_request *subreq = aead_request_ctx(req);
crypto_completion_t compl; crypto_completion_t compl;
bool unaligned_info;
void *data; void *data;
u8 *info; u8 *info;
unsigned int ivsize = 8; unsigned int ivsize = 8;
@ -68,8 +69,9 @@ static int seqiv_aead_encrypt(struct aead_request *req)
memcpy_sglist(req->dst, req->src, memcpy_sglist(req->dst, req->src,
req->assoclen + req->cryptlen); req->assoclen + req->cryptlen);
if (unlikely(!IS_ALIGNED((unsigned long)info, unaligned_info = !IS_ALIGNED((unsigned long)info,
crypto_aead_alignmask(geniv) + 1))) { crypto_aead_alignmask(geniv) + 1);
if (unlikely(unaligned_info)) {
info = kmemdup(req->iv, ivsize, req->base.flags & info = kmemdup(req->iv, ivsize, req->base.flags &
CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL : CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL :
GFP_ATOMIC); GFP_ATOMIC);
@ -89,7 +91,7 @@ static int seqiv_aead_encrypt(struct aead_request *req)
scatterwalk_map_and_copy(info, req->dst, req->assoclen, ivsize, 1); scatterwalk_map_and_copy(info, req->dst, req->assoclen, ivsize, 1);
err = crypto_aead_encrypt(subreq); err = crypto_aead_encrypt(subreq);
if (unlikely(info != req->iv)) if (unlikely(unaligned_info))
seqiv_aead_encrypt_complete2(req, err); seqiv_aead_encrypt_complete2(req, err);
return err; return err;
} }

View File

@ -991,7 +991,7 @@ static void qm_get_complete_eqe_num(struct hisi_qm *qm)
return; return;
poll_data = &qm->poll_data[cqn]; poll_data = &qm->poll_data[cqn];
while (QM_EQE_PHASE(dw0) != qm->status.eqc_phase) { do {
poll_data->qp_finish_id[eqe_num] = dw0 & QM_EQE_CQN_MASK; poll_data->qp_finish_id[eqe_num] = dw0 & QM_EQE_CQN_MASK;
eqe_num++; eqe_num++;
@ -1004,11 +1004,10 @@ static void qm_get_complete_eqe_num(struct hisi_qm *qm)
qm->status.eq_head++; qm->status.eq_head++;
} }
if (eqe_num == (eq_depth >> 1) - 1)
break;
dw0 = le32_to_cpu(eqe->dw0); dw0 = le32_to_cpu(eqe->dw0);
} if (QM_EQE_PHASE(dw0) != qm->status.eqc_phase)
break;
} while (eqe_num < (eq_depth >> 1) - 1);
poll_data->eqe_num = eqe_num; poll_data->eqe_num = eqe_num;
queue_work(qm->wq, &poll_data->work); queue_work(qm->wq, &poll_data->work);

View File

@ -1668,7 +1668,14 @@ static int remote_partition_enable(struct cpuset *cs, int new_prs,
static void remote_partition_disable(struct cpuset *cs, struct tmpmasks *tmp) static void remote_partition_disable(struct cpuset *cs, struct tmpmasks *tmp)
{ {
WARN_ON_ONCE(!is_remote_partition(cs)); WARN_ON_ONCE(!is_remote_partition(cs));
WARN_ON_ONCE(!cpumask_subset(cs->effective_xcpus, subpartitions_cpus)); /*
* When a CPU is offlined, top_cpuset may end up with no available CPUs,
* which should clear subpartitions_cpus. We should not emit a warning for this
* scenario: the hierarchy is updated from top to bottom, so subpartitions_cpus
* may already be cleared when disabling the partition.
*/
WARN_ON_ONCE(!cpumask_subset(cs->effective_xcpus, subpartitions_cpus) &&
!cpumask_empty(subpartitions_cpus));
spin_lock_irq(&callback_lock); spin_lock_irq(&callback_lock);
cs->remote_partition = false; cs->remote_partition = false;
@ -3976,8 +3983,9 @@ retry:
if (remote || (is_partition_valid(cs) && is_partition_valid(parent))) if (remote || (is_partition_valid(cs) && is_partition_valid(parent)))
compute_partition_effective_cpumask(cs, &new_cpus); compute_partition_effective_cpumask(cs, &new_cpus);
if (remote && cpumask_empty(&new_cpus) && if (remote && (cpumask_empty(subpartitions_cpus) ||
partition_is_populated(cs, NULL)) { (cpumask_empty(&new_cpus) &&
partition_is_populated(cs, NULL)))) {
cs->prs_err = PERR_HOTPLUG; cs->prs_err = PERR_HOTPLUG;
remote_partition_disable(cs, tmp); remote_partition_disable(cs, tmp);
compute_effective_cpumask(&new_cpus, cs, parent); compute_effective_cpumask(&new_cpus, cs, parent);
@ -3990,9 +3998,12 @@ retry:
* 1) empty effective cpus but not valid empty partition. * 1) empty effective cpus but not valid empty partition.
* 2) parent is invalid or doesn't grant any cpus to child * 2) parent is invalid or doesn't grant any cpus to child
* partitions. * partitions.
* 3) subpartitions_cpus is empty.
*/ */
if (is_local_partition(cs) && (!is_partition_valid(parent) || if (is_local_partition(cs) &&
tasks_nocpu_error(parent, cs, &new_cpus))) (!is_partition_valid(parent) ||
tasks_nocpu_error(parent, cs, &new_cpus) ||
cpumask_empty(subpartitions_cpus)))
partcmd = partcmd_invalidate; partcmd = partcmd_invalidate;
/* /*
* On the other hand, an invalid partition root may be transitioned * On the other hand, an invalid partition root may be transitioned

View File

@ -1577,7 +1577,7 @@ static bool dequeue_task_scx(struct rq *rq, struct task_struct *p, int deq_flags
* *
* @p may go through multiple stopping <-> running transitions between * @p may go through multiple stopping <-> running transitions between
* here and put_prev_task_scx() if task attribute changes occur while * here and put_prev_task_scx() if task attribute changes occur while
* balance_scx() leaves @rq unlocked. However, they don't contain any * balance_one() leaves @rq unlocked. However, they don't contain any
* information meaningful to the BPF scheduler and can be suppressed by * information meaningful to the BPF scheduler and can be suppressed by
* skipping the callbacks if the task is !QUEUED. * skipping the callbacks if the task is !QUEUED.
*/ */
@ -2372,7 +2372,7 @@ static void switch_class(struct rq *rq, struct task_struct *next)
* preempted, and it regaining control of the CPU. * preempted, and it regaining control of the CPU.
* *
* ->cpu_release() complements ->cpu_acquire(), which is emitted the * ->cpu_release() complements ->cpu_acquire(), which is emitted the
* next time that balance_scx() is invoked. * next time that balance_one() is invoked.
*/ */
if (!rq->scx.cpu_released) { if (!rq->scx.cpu_released) {
if (SCX_HAS_OP(sch, cpu_release)) { if (SCX_HAS_OP(sch, cpu_release)) {
@ -2478,7 +2478,7 @@ do_pick_task_scx(struct rq *rq, struct rq_flags *rf, bool force_scx)
} }
/* /*
* If balance_scx() is telling us to keep running @prev, replenish slice * If balance_one() is telling us to keep running @prev, replenish slice
* if necessary and keep running @prev. Otherwise, pop the first one * if necessary and keep running @prev. Otherwise, pop the first one
* from the local DSQ. * from the local DSQ.
*/ */
@ -3956,13 +3956,8 @@ static void bypass_lb_node(struct scx_sched *sch, int node)
nr_donor_target, nr_target); nr_donor_target, nr_target);
} }
for_each_cpu(cpu, resched_mask) { for_each_cpu(cpu, resched_mask)
struct rq *rq = cpu_rq(cpu); resched_cpu(cpu);
raw_spin_rq_lock_irq(rq);
resched_curr(rq);
raw_spin_rq_unlock_irq(rq);
}
for_each_cpu_and(cpu, cpu_online_mask, node_mask) { for_each_cpu_and(cpu, cpu_online_mask, node_mask) {
u32 nr = READ_ONCE(cpu_rq(cpu)->scx.bypass_dsq.nr); u32 nr = READ_ONCE(cpu_rq(cpu)->scx.bypass_dsq.nr);
@ -4025,7 +4020,7 @@ static DEFINE_TIMER(scx_bypass_lb_timer, scx_bypass_lb_timerfn);
* *
* - ops.dispatch() is ignored. * - ops.dispatch() is ignored.
* *
* - balance_scx() does not set %SCX_RQ_BAL_KEEP on non-zero slice as slice * - balance_one() does not set %SCX_RQ_BAL_KEEP on non-zero slice as slice
* can't be trusted. Whenever a tick triggers, the running task is rotated to * can't be trusted. Whenever a tick triggers, the running task is rotated to
* the tail of the queue with core_sched_at touched. * the tail of the queue with core_sched_at touched.
* *
@ -4783,8 +4778,10 @@ static struct scx_sched *scx_alloc_and_add_sched(struct sched_ext_ops *ops)
} }
sch->pcpu = alloc_percpu(struct scx_sched_pcpu); sch->pcpu = alloc_percpu(struct scx_sched_pcpu);
if (!sch->pcpu) if (!sch->pcpu) {
ret = -ENOMEM;
goto err_free_gdsqs; goto err_free_gdsqs;
}
sch->helper = kthread_run_worker(0, "sched_ext_helper"); sch->helper = kthread_run_worker(0, "sched_ext_helper");
if (IS_ERR(sch->helper)) { if (IS_ERR(sch->helper)) {
@ -6067,7 +6064,7 @@ __bpf_kfunc bool scx_bpf_dsq_move_to_local(u64 dsq_id)
/* /*
* A successfully consumed task can be dequeued before it starts * A successfully consumed task can be dequeued before it starts
* running while the CPU is trying to migrate other dispatched * running while the CPU is trying to migrate other dispatched
* tasks. Bump nr_tasks to tell balance_scx() to retry on empty * tasks. Bump nr_tasks to tell balance_one() to retry on empty
* local DSQ. * local DSQ.
*/ */
dspc->nr_tasks++; dspc->nr_tasks++;

View File

@ -27,16 +27,18 @@ def read_static_key(name):
def state_str(state): def state_str(state):
return prog['scx_enable_state_str'][state].string_().decode() return prog['scx_enable_state_str'][state].string_().decode()
ops = prog['scx_ops'] root = prog['scx_root']
enable_state = read_atomic("scx_enable_state_var") enable_state = read_atomic("scx_enable_state_var")
print(f'ops : {ops.name.string_().decode()}') if root:
print(f'ops : {root.ops.name.string_().decode()}')
else:
print('ops : ')
print(f'enabled : {read_static_key("__scx_enabled")}') print(f'enabled : {read_static_key("__scx_enabled")}')
print(f'switching_all : {read_int("scx_switching_all")}') print(f'switching_all : {read_int("scx_switching_all")}')
print(f'switched_all : {read_static_key("__scx_switched_all")}') print(f'switched_all : {read_static_key("__scx_switched_all")}')
print(f'enable_state : {state_str(enable_state)} ({enable_state})') print(f'enable_state : {state_str(enable_state)} ({enable_state})')
print(f'in_softlockup : {prog["scx_in_softlockup"].value_()}') print(f'aborting : {prog["scx_aborting"].value_()}')
print(f'breather_depth: {read_atomic("scx_breather_depth")}')
print(f'bypass_depth : {prog["scx_bypass_depth"].value_()}') print(f'bypass_depth : {prog["scx_bypass_depth"].value_()}')
print(f'nr_rejected : {read_atomic("scx_nr_rejected")}') print(f'nr_rejected : {read_atomic("scx_nr_rejected")}')
print(f'enable_seq : {read_atomic("scx_enable_seq")}') print(f'enable_seq : {read_atomic("scx_enable_seq")}')