lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z6hMTDhikIpxTSzY@slm.duckdns.org>
Date: Sat, 8 Feb 2025 20:33:48 -1000
From: Tejun Heo <tj@...nel.org>
To: David Vernet <void@...ifault.com>, Andrea Righi <arighi@...dia.com>,
	Changwoo Min <changwoo@...lia.com>
Cc: linux-kernel@...r.kernel.org, sched-ext@...a.com
Subject: Re: [PATCH sched_ext/for-6.14-fixes 2/2] sched_ext: Fix migration
 disabled handling in targeted dispatches

On Fri, Feb 07, 2025 at 10:59:06AM -1000, Tejun Heo wrote:
> A dispatch operation that can target a specific local DSQ -
> scx_bpf_dsq_move_to_local() or scx_bpf_dsq_move() - checks whether the task
> can be migrated to the target CPU using task_can_run_on_remote_rq(). If the
> task can't be migrated to the targeted CPU, it is bounced through a global
> DSQ.
> 
> task_can_run_on_remote_rq() assumes that the task is on a CPU that's
> different from the targeted CPU but the callers doesn't uphold the
> assumption and may call the function when the task is already on the target
> CPU. When such task has migration disabled, task_can_run_on_remote_rq() ends
> up returning %false incorrectly unnecessarily bouncing the task to a global
> DSQ.
> 
> Fix it by updating the callers to only call task_can_run_on_remote_rq() when
> the task is on a different CPU than the target CPU. As this is a bit subtle,
> for clarity and documentation:
> 
> - Make task_can_run_on_remote_rq() trigger SCHED_WARN_ON() if the task is on
>   the same CPU as the target CPU.
> 
> - is_migration_disabled() test in task_can_run_on_remote_rq() cannot trigger
>   if the task is on a different CPU than the target CPU as the preceding
>   task_allowed_on_cpu() test should fail beforehand. Convert the test into
>   SCHED_WARN_ON().
> 
> Signed-off-by: Tejun Heo <tj@...nel.org>
> Fixes: 4c30f5ce4f7a ("sched_ext: Implement scx_bpf_dispatch[_vtime]_from_dsq()")
> Fixes: 0366017e0973 ("sched_ext: Use task_can_run_on_remote_rq() test in dispatch_to_local_dsq()")
> Cc: stable@...r.kernel.org # v6.12+

Applied 1-2 to sched_ext/for-6.14-fixes.

Thanks.

-- 
tejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ