From: "Paul E. McKenney" <paulmck@us.ibm.com>

Uses of RCU for dynamically changeable NMI handlers need to use the new
rcu_dereference() and rcu_assign_pointer() facilities.  This change makes
it clear that these uses are safe from a memory-barrier viewpoint, but the
main purpose is to document exactly what operations are being protected by
RCU.  This has been tested on x86 and x86-64, which are the only
architectures affected by this change.

Signed-off-by: <paulmck@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 arch/i386/kernel/traps.c |    4 ++--
 arch/x86_64/kernel/nmi.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff -puN arch/i386/kernel/traps.c~nmi-update-nmi-users-of-rcu-to-use-new-api arch/i386/kernel/traps.c
--- devel/arch/i386/kernel/traps.c~nmi-update-nmi-users-of-rcu-to-use-new-api	2005-08-06 15:34:45.000000000 -0700
+++ devel-akpm/arch/i386/kernel/traps.c	2005-08-06 15:34:45.000000000 -0700
@@ -657,7 +657,7 @@ fastcall void do_nmi(struct pt_regs * re
 
 	++nmi_count(cpu);
 
-	if (!nmi_callback(regs, cpu))
+	if (!rcu_dereference(nmi_callback)(regs, cpu))
 		default_do_nmi(regs);
 
 	nmi_exit();
@@ -665,7 +665,7 @@ fastcall void do_nmi(struct pt_regs * re
 
 void set_nmi_callback(nmi_callback_t callback)
 {
-	nmi_callback = callback;
+	rcu_assign_pointer(nmi_callback, callback);
 }
 EXPORT_SYMBOL_GPL(set_nmi_callback);
 
diff -puN arch/x86_64/kernel/nmi.c~nmi-update-nmi-users-of-rcu-to-use-new-api arch/x86_64/kernel/nmi.c
--- devel/arch/x86_64/kernel/nmi.c~nmi-update-nmi-users-of-rcu-to-use-new-api	2005-08-06 15:34:45.000000000 -0700
+++ devel-akpm/arch/x86_64/kernel/nmi.c	2005-08-06 15:34:45.000000000 -0700
@@ -524,14 +524,14 @@ asmlinkage void do_nmi(struct pt_regs * 
 
 	nmi_enter();
 	add_pda(__nmi_count,1);
-	if (!nmi_callback(regs, cpu))
+	if (!rcu_dereference(nmi_callback)(regs, cpu))
 		default_do_nmi(regs);
 	nmi_exit();
 }
 
 void set_nmi_callback(nmi_callback_t callback)
 {
-	nmi_callback = callback;
+	rcu_assign_pointer(nmi_callback, callback);
 }
 
 void unset_nmi_callback(void)
_