[PATCH 2/5] ftrace: do not trace nmi callers in drivers

From: Steven Rostedt
Date: Tue Jul 29 2008 - 21:44:40 EST


The dynamic ftrace code performs run time modification of the code text
section. This is not safe to do unless all other CPUS are halted. Because
there is no good way to halt NMIs while doing the modification, we must
make sure that the NMIs will not execute code that will be modified.

This patch adds notrace annotation to functions called by NMIs in the
drivers section.

Signed-off-by: Steven Rostedt <srostedt@xxxxxxxxxx>
CC: Corey Minyard <minyard@xxxxxxx>
CC: Thomas Mingarelli <thomas.mingarelli@xxxxxx>
---
drivers/char/ipmi/ipmi_watchdog.c | 2 +-
drivers/misc/sgi-xp/xpc_main.c | 4 ++--
drivers/watchdog/hpwdt.c | 5 +++--
3 files changed, 6 insertions(+), 5 deletions(-)

Index: linux-tip.git/drivers/char/ipmi/ipmi_watchdog.c
===================================================================
--- linux-tip.git.orig/drivers/char/ipmi/ipmi_watchdog.c 2008-07-29 20:03:09.000000000 -0400
+++ linux-tip.git/drivers/char/ipmi/ipmi_watchdog.c 2008-07-29 20:03:20.000000000 -0400
@@ -1051,7 +1051,7 @@ static void ipmi_unregister_watchdog(int
}

#ifdef HAVE_DIE_NMI
-static int
+static notrace int
ipmi_nmi(struct notifier_block *self, unsigned long val, void *data)
{
struct die_args *args = data;
Index: linux-tip.git/drivers/misc/sgi-xp/xpc_main.c
===================================================================
--- linux-tip.git.orig/drivers/misc/sgi-xp/xpc_main.c 2008-07-29 20:03:09.000000000 -0400
+++ linux-tip.git/drivers/misc/sgi-xp/xpc_main.c 2008-07-29 20:03:20.000000000 -0400
@@ -1004,7 +1004,7 @@ xpc_system_reboot(struct notifier_block
/*
* Notify other partitions to disengage from all references to our memory.
*/
-static void
+static notrace void
xpc_die_disengage(void)
{
struct xpc_partition *part;
@@ -1083,7 +1083,7 @@ xpc_die_disengage(void)
* for a time. In this case we need to notify other partitions to not worry
* about the lack of a heartbeat.
*/
-static int
+static notrace int
xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused)
{
switch (event) {
Index: linux-tip.git/drivers/watchdog/hpwdt.c
===================================================================
--- linux-tip.git.orig/drivers/watchdog/hpwdt.c 2008-07-29 20:03:09.000000000 -0400
+++ linux-tip.git/drivers/watchdog/hpwdt.c 2008-07-29 20:03:20.000000000 -0400
@@ -417,8 +417,9 @@ static int __devinit detect_cru_service(
/*
* NMI Handler
*/
-static int hpwdt_pretimeout(struct notifier_block *nb, unsigned long ulReason,
- void *data)
+static notrace int
+hpwdt_pretimeout(struct notifier_block *nb,
+ unsigned long ulReason, void *data)
{
static unsigned long rom_pl;
static int die_nmi_called;

--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/