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:	Fri, 05 Mar 2010 20:29:05 -0500
From:	Steven Rostedt <rostedt@...dmis.org>
To:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc:	linux-kernel@...r.kernel.org, mingo@...e.hu, laijs@...fujitsu.com,
	dipankar@...ibm.com, akpm@...ux-foundation.org,
	mathieu.desnoyers@...ymtl.ca, josh@...htriplett.org,
	dvhltc@...ibm.com, niv@...ibm.com, tglx@...utronix.de,
	peterz@...radead.org, Valdis.Kletnieks@...edu, dhowells@...hat.com,
	Frederic Weisbecker <fweisbec@...il.com>,
	Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH tip/core/rcu 1/3] ftrace: replace
 read_barrier_depends() with rcu_dereference_raw()

On Fri, 2010-03-05 at 15:03 -0800, Paul E. McKenney wrote:
> Replace the calls to read_barrier_depends() in ftrace_list_func() with
> rcu_dereference_raw() to improve readability.  The reason that we use
> rcu_dereference_raw() here is that removed entries are never freed,
> instead they are simply leaked.  This is one of a very few cases where
> use of rcu_dereference_raw() is the long-term right answer.  And I don't
> yet know of any others.  ;-)
> 
> Cc: Steven Rostedt <rostedt@...dmis.org>

Acked-by: Steven Rostedt <rostedt@...dmis.org>

Thanks Paul!

> Cc: Frederic Weisbecker <fweisbec@...il.com>
> Cc: Ingo Molnar <mingo@...hat.com>
> Signed-off-by: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
> ---

>  
> @@ -154,8 +159,7 @@ static int __register_ftrace_function(struct ftrace_ops *ops)
>  	 * the ops->next pointer is valid before another CPU sees
>  	 * the ops pointer included into the ftrace_list.
>  	 */
> -	smp_wmb();
> -	ftrace_list = ops;
> +	rcu_assign_pointer(ftrace_list, ops);

[ Off topic ]

I looked at rcu_assign_pointer() and it is:

#define rcu_assign_pointer(p, v) \
	({ \
		if (!__builtin_constant_p(v) || \
		    ((v) != NULL)) \
			smp_wmb(); \
		(p) = (v); \
	})

My question is, why that crazy if? The only time that will fail is if we
are assigning the constant NULL to p. What makes NULL so important here?
Can't there be a case when assigning NULL to p will require that wmb()?

-- Steve


>  
>  	if (ftrace_enabled) {
>  		ftrace_func_t func;


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