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:	Thu, 20 Aug 2009 11:30:45 +0800
From:	Lai Jiangshan <laijs@...fujitsu.com>
To:	paulmck@...ux.vnet.ibm.com
CC:	linux-kernel@...r.kernel.org, mathieu.desnoyers@...ymtl.ca,
	mingo@...e.hu, josht@...ux.vnet.ibm.com, dipankar@...ibm.com,
	akpm@...ux-foundation.org, dvhltc@...ibm.com, niv@...ibm.com,
	tglx@...utronix.de, peterz@...radead.org, rostedt@...dmis.org,
	hugh.dickins@...cali.co.uk, benh@...nel.crashing.org
Subject: Re: [PATCH -tip/core/rcu] Fix rcu_migrate_callback() to allow for
 multiple waiters

Paul E. McKenney wrote:
> The current interaction between rcu_barrier() and CPU hotplug can result
> in multiple tasks waiting on rcu_migrate_wq: there can be one CPU-hotplug
> notifier, and, because rcu_barrier() invokes wait_migrated_callbacks()
> outside of rcu_barrier_mutex, an arbitrarily large number of tasks
> executing in _rcu_barrier().  This situation could result in hangs,
> because rcu_migrate_callback() would wake up but one task.
> 
> This patch addresses this problem by awakening all sleepers.
> 
> Located-by: Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>
> Signed-off-by: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
> ---
> 
>  rcupdate.c |    9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
> index bd5d5c8..6c59e1b 100644
> --- a/kernel/rcupdate.c
> +++ b/kernel/rcupdate.c
> @@ -211,10 +211,17 @@ void rcu_barrier_sched(void)
>  }
>  EXPORT_SYMBOL_GPL(rcu_barrier_sched);
>  
> +/*
> + * Wake up anyone waiting on migration of RCU callbacks from a CPU
> + * going offline.  There can be only one CPU-hotplug notifier waiting,
> + * but there can be any number of rcu_barrier() invocations waiting,
> + * due to the fact that rcu_barrier() does its wait outside of the
> + * rcu_barrier_mutex.
> + */
>  static void rcu_migrate_callback(struct rcu_head *notused)
>  {
>  	if (atomic_dec_and_test(&rcu_migrate_type_count))
> -		wake_up(&rcu_migrate_wq);
> +		wake_up_all(&rcu_migrate_wq);
>  }
>  
>  extern int rcu_cpu_notify(struct notifier_block *self,
> 

Maybe wake_up_all() is good for readability. But wake_up()
is enough for the logic.

In wait_migrated_callbacks(), we use wait_event(), The current
thread is queued as a non-exclusive waiter. And wake_up()
wakes up all non-exclusive waiter. (We only have
non-exclusive waiters in the rcu_migrate_wq)


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