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]
Date:	Wed, 8 Oct 2014 05:19:38 -0700
From:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To:	Jiri Pirko <jiri@...nulli.us>
Cc:	Joe Lawrence <joe.lawrence@...atus.com>, Tejun Heo <tj@...nel.org>,
	linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH v2 1/2] workqueue: add quiescent state between work items

On Wed, Oct 08, 2014 at 01:54:28PM +0200, Jiri Pirko wrote:
> Wed, Oct 08, 2014 at 05:24:11AM CEST, paulmck@...ux.vnet.ibm.com wrote:
> >On Tue, Oct 07, 2014 at 01:45:28PM -0400, Joe Lawrence wrote:
> >> On Tue, 7 Oct 2014 06:43:29 -0700
> >> "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com> wrote:
> >> 
> >> > On Tue, Oct 07, 2014 at 09:29:42AM +0200, Jiri Pirko wrote:
> >> [ ... snip ... ]
> >> > > 
> >> > > Paul, Tehun, how do you propose to fix this on older kernels which do
> >> > > not have rcu_note_voluntary_context_switch? I'm particullary interested
> >> > > in 3.10.
> >> > 
> >> > Hello, Jiri,
> >> > 
> >> > Older kernels can instead use rcu_note_context_switch().
> >> 
> >> Hi Paul,
> >> 
> >> Does 4a81e8328d37 ("rcu: Reduce overhead of cond_resched() checks for
> >> RCU") affect a backport to 3.10?
> >> 
> >> I noticed that rcu_note_context_switch added a call to
> >> rcu_momentary_dyntick_idle in that change, which is only present in
> >> v3.16+.
> >> 
> >> Would rcu_note_context_switch be effective by itself on a 3.10 kernel?
> >
> >Should be fine.  There is more overhead than current mainline, but that
> >should not be in the noise compared to executing a work-queue item.
> >
> >							Thanx, Paul
> >
> 
> I cooked up following patch. Please tell me if it is fine or not. I can
> also send it oficially so it can be included into stable trees:

Looks good!

							Thanx, Paul

> Subject: workqueue: Add quiescent state between work items
> 
> Similar to the stop_machine deadlock scenario on !PREEMPT kernels
> addressed in b22ce2785d97 "workqueue: cond_resched() after processing
> each work item", kworker threads requeueing back-to-back with zero jiffy
> delay can stall RCU. The cond_resched call introduced in that fix will
> yield only iff there are other higher priority tasks to run, so force a
> quiescent RCU state between work items.
> 
> Signed-off-by: Jiri Pirko <jiri@...nulli.us>
> ---
>  kernel/workqueue.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index e9719c7..14a7163 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -2196,8 +2196,10 @@ __acquires(&pool->lock)
>  	 * kernels, where a requeueing work item waiting for something to
>  	 * happen could deadlock with stop_machine as such work item could
>  	 * indefinitely requeue itself while all other CPUs are trapped in
> -	 * stop_machine.
> +	 * stop_machine. At the same time, report a quiescent RCU state so
> +	 * the same condition doesn't freeze RCU.
>  	 */
> +	rcu_note_context_switch(raw_smp_processor_id());
>  	cond_resched();
> 
>  	spin_lock_irq(&pool->lock);
> -- 
> 1.9.3
> 
> 

--
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