From: "Paul E. McKenney" <paulmck@us.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@osdl.org, zwane@arm.linux.org.uk, ak@muc.de
Subject: [PATCH 1/2] NMI: Update NMI users of RCU to use new API
Date: Mon, 11 Jul 2005 08:30:53 -0700 [thread overview]
Message-ID: <20050711153052.GA1615@us.ibm.com> (raw)
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>
---
i386/kernel/traps.c | 4 ++--
x86_64/kernel/nmi.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff -urpN -X dontdiff linux-2.6.12-rc6/arch/i386/kernel/traps.c linux-2.6.12-rc6-NMIRCUfix/arch/i386/kernel/traps.c
--- linux-2.6.12-rc6/arch/i386/kernel/traps.c 2005-06-17 16:34:17.000000000 -0700
+++ linux-2.6.12-rc6-NMIRCUfix/arch/i386/kernel/traps.c 2005-07-01 15:16:24.000000000 -0700
@@ -626,7 +626,7 @@ fastcall void do_nmi(struct pt_regs * re
cpu = smp_processor_id();
++nmi_count(cpu);
- if (!nmi_callback(regs, cpu))
+ if (!rcu_dereference(nmi_callback)(regs, cpu))
default_do_nmi(regs);
nmi_exit();
@@ -634,7 +634,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);
}
void unset_nmi_callback(void)
diff -urpN -X dontdiff linux-2.6.12-rc6/arch/x86_64/kernel/nmi.c linux-2.6.12-rc6-NMIRCUfix/arch/x86_64/kernel/nmi.c
--- linux-2.6.12-rc6/arch/x86_64/kernel/nmi.c 2005-06-17 16:34:24.000000000 -0700
+++ linux-2.6.12-rc6-NMIRCUfix/arch/x86_64/kernel/nmi.c 2005-07-01 15:15:21.000000000 -0700
@@ -522,14 +522,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)
next reply other threads:[~2005-07-11 15:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-11 15:30 Paul E. McKenney [this message]
2005-07-11 15:43 ` [PATCH 1/2] NMI: Update NMI users of RCU to use new API Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050711153052.GA1615@us.ibm.com \
--to=paulmck@us.ibm.com \
--cc=ak@muc.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zwane@arm.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox