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: <Z7M8h8jGEPoPmmiT@gpd3>
Date: Mon, 17 Feb 2025 14:41:27 +0100
From: Andrea Righi <arighi@...dia.com>
To: Yury Norov <yury.norov@...il.com>
Cc: Tejun Heo <tj@...nel.org>, David Vernet <void@...ifault.com>,
	Changwoo Min <changwoo@...lia.com>, Ingo Molnar <mingo@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Juri Lelli <juri.lelli@...hat.com>,
	Vincent Guittot <vincent.guittot@...aro.org>,
	Dietmar Eggemann <dietmar.eggemann@....com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
	Valentin Schneider <vschneid@...hat.com>,
	Joel Fernandes <joel@...lfernandes.org>, Ian May <ianm@...dia.com>,
	bpf@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 8/8] sched_ext: idle: Introduce node-aware idle cpu kfunc
 helpers

On Fri, Feb 14, 2025 at 04:28:57PM -0500, Yury Norov wrote:
> On Fri, Feb 14, 2025 at 08:40:07PM +0100, Andrea Righi wrote:
...
> > +/**
> > + * scx_bpf_get_idle_cpumask_node - Get a referenced kptr to the
> > + * idle-tracking per-CPU cpumask of a target NUMA node.
> > + *
> > + * Returns an empty cpumask if idle tracking is not enabled, if @node is
> > + * not valid, or running on a UP kernel. In this case the actual error will
> > + * be reported to the BPF scheduler via scx_ops_error().
> > + */
> > +__bpf_kfunc const struct cpumask *scx_bpf_get_idle_cpumask_node(int node)
> > +{
> > +	node = validate_node(node);
> > +	if (node < 0)
> > +		return cpu_none_mask;
> > +
> > +#ifdef CONFIG_SMP
> > +	return idle_cpumask(node)->cpu;
> > +#else
> > +	return cpu_none_mask;
> > +#endif
> 
> Here you need to check for SMP at the beginning. That way you can
> avoid calling validate_node() if SMP is disabled.

As mentioned in the other email, I'm not sure if we want to skip
validate_node() in the UP case.

I guess the question is: should we completely ignore the node argument,
since it doesn't make sense in the UP case, or should we still validate it,
given that node == 0 is still valid in this scenario?

-Andrea

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ