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: <46cef95e02d64b35a9d9d51d5debee22@honor.com>
Date: Fri, 18 Jul 2025 09:06:46 +0000
From: liuwenfang <liuwenfang@...or.com>
To: 'Tejun Heo' <tj@...nel.org>
CC: 'David Vernet' <void@...ifault.com>, 'Andrea Righi' <arighi@...dia.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>,
	"'linux-kernel@...r.kernel.org'" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2 2/2] sched_ext: Fix cpu_released while changing sched
 policy of the running task

> Hello,
> 
> On Sat, Jun 28, 2025 at 07:20:59AM +0000, liuwenfang wrote:
> >  static void switched_from_scx(struct rq *rq, struct task_struct *p)
> > {
> > +	switch_class(rq, p, true);
> > +
> >  	scx_ops_disable_task(p);
> >  }
> 
> Hmm... but this function can be called when @p is not currently running from
> setscheduler() path, and it wouldn't make sense to call switch_class() during
> that.
Yeah, task_current(rq, p) should be checked here.
> 
> >  static void wakeup_preempt_scx(struct rq *rq, struct task_struct
> > *p,int wake_flags) {} -static void switched_to_scx(struct rq *rq,
> > struct task_struct *p) {}
> > +static void switched_to_scx(struct rq *rq, struct task_struct *p) {
> > +	lockdep_assert_rq_held(rq);
> > +
> > +	if (static_branch_unlikely(&scx_ops_cpu_preempt) &&
> > +	    unlikely(rq->scx.cpu_released)) {
> > +		/*
> > +		 * If the previous sched_class for the current CPU was not SCX,
> > +		 * notify the BPF scheduler that it again has control of the
> > +		 * core. This callback complements ->cpu_release(), which is
> > +		 * emitted in switch_class().
> > +		 */
> > +		if (SCX_HAS_OP(cpu_acquire))
> > +			SCX_CALL_OP(SCX_KF_REST, cpu_acquire, rq, cpu_of(rq), NULL);
> > +		rq->scx.cpu_released = false;
> > +	}
> > +}
> 
> Ditto. This should only apply if @p is current, right?
task_current(rq, p) should be added.
> 
> Thanks.
> 
> --
> Tejun

Thanks.

--
Wenfang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ