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] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z-uJK3LiiG2l5wZP@gpd3>
Date: Tue, 1 Apr 2025 08:35:23 +0200
From: Andrea Righi <arighi@...dia.com>
To: Tejun Heo <tj@...nel.org>
Cc: David Vernet <void@...ifault.com>, Changwoo Min <changwoo@...lia.com>,
	Joel Fernandes <joelagnelf@...dia.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/6] sched_ext: idle: Introduce scx_bpf_select_cpu_and()

On Mon, Mar 31, 2025 at 11:59:42AM -1000, Tejun Heo wrote:
> Hello,
> 
> On Fri, Mar 21, 2025 at 11:10:50PM +0100, Andrea Righi wrote:
> ...
> > +__bpf_kfunc s32 scx_bpf_select_cpu_and(struct task_struct *p, s32 prev_cpu, u64 wake_flags,
> > +				       const struct cpumask *cpus_allowed, u64 flags)
> > +{
> > +	s32 cpu;
> > +
> > +	if (!ops_cpu_valid(prev_cpu, NULL))
> > +		return -EINVAL;
> > +
> > +	if (!check_builtin_idle_enabled())
> > +		return -EBUSY;
> > +
> > +	if (!scx_kf_allowed(SCX_KF_SELECT_CPU | SCX_KF_ENQUEUE))
> > +		return -EPERM;
> > +
> > +#ifdef CONFIG_SMP
> > +	cpu = scx_select_cpu_dfl(p, prev_cpu, wake_flags, cpus_allowed, flags);
> > +#else
> > +	cpu = -EBUSY;
> > +#endif
> > +
> > +	return cpu;
> > +}
> 
> Later in the series, I find scx_bpf_select_cpu_and() being called with
> p->cpus_ptr really confusing. scx_bpf_select_cpu_and() is always constrained
> by p->cpus_ptr (except for the currently buggy case where p->nr_cpus_allowed
> is used while p->cpus_ptr is overridden), so what does it mean to call
> scx_bpf_select_cpu_and() with p->cpus_ptr as @cpus_allowed? I'd much prefer
> if the convention in such cases is calling with NULL @cpus_allowed.
> @cpus_allowed is the extra mask to and to p->cpus_ptr when searching for an
> idle CPU. If we're going to use p->cpus_ptr, we just don't have the extra
> cpumask to and.

Exactly, as mentioned in a previous email I also agree that using NULL as
@cpus_allowed would be much more clear and less bug prone. Will change
that.

-Andrea

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ