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]
Date:	Mon, 06 Jun 2011 11:06:38 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
	Ingo Molnar <mingo@...e.hu>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] sched: RCU-protect __set_task_cpu() in set_task_cpu()

On Sun, 2011-06-05 at 21:12 +0200, Oleg Nesterov wrote:
> On 06/03, Peter Zijlstra wrote:
> >
> > @@ -2200,6 +2201,16 @@ void set_task_cpu(struct task_struct *p,
> >  			!(task_thread_info(p)->preempt_count & PREEMPT_ACTIVE));
> >
> >  #ifdef CONFIG_LOCKDEP
> > +	/*
> > +	 * The caller should hold either p->pi_lock or rq->lock, when changing
> > +	 * a task's CPU.
> 
> Is it literally true? IIRC, we need ->pi_lock if the task is not active,
> and rq->lock if p->on_rq = 1. And that is why we do not clear p->on_rq
> between deactivate_task() + activate_task(), correct?
> 
> > +	 *
> > +	 * sched_move_task() holds both and thus holding either pins the cgroup,
> > +	 * see set_task_rq().
> > +	 *
> > +	 * Furthermore, all task_rq users should acquire both locks, see
> > +	 * task_rq_lock().
> > +	 */
> >  	WARN_ON_ONCE(debug_locks && !(lockdep_is_held(&p->pi_lock) ||
> >  				      lockdep_is_held(&task_rq(p)->lock)));
> 
> IOW, perhaps this should be
> 
> 	WARN_ON_ONCE(debug_locks && !lockdep_is_held(p->on_rq ?
> 					&task_rq(p)->lock : &p->pi_lock))
> 
> ?
> 
> Not that I really suggest to change this WARN_ON(), I am just trying
> to recall the new rules.

You're right, p->pi_lock for wakeups, rq->lock for runnable tasks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ