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:	Tue, 8 Oct 2013 09:32:58 -0700
From:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	Oleg Nesterov <oleg@...hat.com>, Mel Gorman <mgorman@...e.de>,
	Rik van Riel <riel@...hat.com>,
	Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
	Ingo Molnar <mingo@...nel.org>,
	Andrea Arcangeli <aarcange@...hat.com>,
	Johannes Weiner <hannes@...xchg.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Steven Rostedt <rostedt@...dmis.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/6] rcusync: Introduce rcu_sync_dtor()

On Tue, Oct 08, 2013 at 12:25:11PM +0200, Peter Zijlstra wrote:
> From: Oleg Nesterov <oleg@...hat.com>
> 
> Add the new rcu_sync_ops->wait() method and the new helper,
> rcu_sync_dtor().
> 
> It is needed if you are going to, say, kfree(rcu_sync_object).
> It simply calls ops->wait() to "flush" the potentially pending
> rcu callback.
> 
> Signed-off-by: Oleg Nesterov <oleg@...hat.com>
> Signed-off-by: Peter Zijlstra <peterz@...radead.org>

Reviewed-by: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>

> Link: http://lkml.kernel.org/r/20131004184636.GA17560@redhat.com
> ---
>  include/linux/rcusync.h |    1 +
>  kernel/rcusync.c        |   22 ++++++++++++++++++++++
>  2 files changed, 23 insertions(+)
> 
> --- a/include/linux/rcusync.h
> +++ b/include/linux/rcusync.h
> @@ -31,6 +31,7 @@ static inline bool rcu_sync_is_idle(stru
>  extern void rcu_sync_init(struct rcu_sync_struct *, enum rcu_sync_type);
>  extern void rcu_sync_enter(struct rcu_sync_struct *);
>  extern void rcu_sync_exit(struct rcu_sync_struct *);
> +extern void rcu_sync_dtor(struct rcu_sync_struct *);
> 
>  #define __RCU_SYNC_INITIALIZER(name, type) {				\
>  		.gp_state = 0,						\
> --- a/kernel/rcusync.c
> +++ b/kernel/rcusync.c
> @@ -10,6 +10,7 @@
>  static const struct {
>  	void (*sync)(void);
>  	void (*call)(struct rcu_head *, void (*)(struct rcu_head *));
> +	void (*wait)(void);
>  #ifdef CONFIG_PROVE_RCU
>  	int  (*held)(void);
>  #endif
> @@ -17,16 +18,19 @@ static const struct {
>  	[RCU_SYNC] = {
>  		.sync = synchronize_rcu,
>  		.call = call_rcu,
> +		.wait = rcu_barrier,
>  		__INIT_HELD(rcu_read_lock_held)
>  	},
>  	[RCU_SCHED_SYNC] = {
>  		.sync = synchronize_sched,
>  		.call = call_rcu_sched,
> +		.wait = rcu_barrier_sched,
>  		__INIT_HELD(rcu_read_lock_sched_held)
>  	},
>  	[RCU_BH_SYNC] = {
>  		.sync = synchronize_rcu_bh,
>  		.call = call_rcu_bh,
> +		.wait = rcu_barrier_bh,
>  		__INIT_HELD(rcu_read_lock_bh_held)
>  	},
>  };
> @@ -128,3 +132,21 @@ void rcu_sync_exit(struct rcu_sync_struc
>  	}
>  	spin_unlock_irq(&rss->rss_lock);
>  }
> +
> +void rcu_sync_dtor(struct rcu_sync_struct *rss)
> +{
> +	int cb_state;
> +
> +	BUG_ON(rss->gp_count);
> +
> +	spin_lock_irq(&rss->rss_lock);
> +	if (rss->cb_state == CB_REPLAY)
> +		rss->cb_state = CB_PENDING;
> +	cb_state = rss->cb_state;
> +	spin_unlock_irq(&rss->rss_lock);
> +
> +	if (cb_state != CB_IDLE) {
> +		gp_ops[rss->gp_type].wait();
> +		BUG_ON(rss->cb_state != CB_IDLE);
> +	}
> +}
> 
> 

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