]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/trace/ftrace.c
stop_machine: fix up ftrace.c
[linux-2.6-omap-h63xx.git] / kernel / trace / ftrace.c
index 85e84133541745770b9c506c6e1b16326b8cb370..f6e3af31b403d8eaa77128712fdb594ca48be0c0 100644 (file)
@@ -502,8 +502,12 @@ static void ftrace_replace_code(int enable)
                                continue;
 
                        /* ignore updates to this record's mcount site */
-                       if (get_kprobe((void *)rec->ip))
+                       if (get_kprobe((void *)rec->ip)) {
+                               freeze_record(rec);
                                continue;
+                       } else {
+                               unfreeze_record(rec);
+                       }
 
                        failed = __ftrace_replace_code(rec, old, new, enable);
                        if (failed && (rec->flags & FTRACE_FL_CONVERTED)) {
@@ -583,7 +587,7 @@ static int __ftrace_modify_code(void *data)
 
 static void ftrace_run_update_code(int command)
 {
-       stop_machine_run(__ftrace_modify_code, &command, NR_CPUS);
+       stop_machine(__ftrace_modify_code, &command, NULL);
 }
 
 void ftrace_disable_daemon(void)
@@ -740,7 +744,10 @@ static int __ftrace_update_code(void *ignore)
                                ftrace_del_hash(p);
                                INIT_HLIST_NODE(&p->node);
                                hlist_add_head(&p->node, &temp_list);
+                               freeze_record(p);
                                continue;
+                       } else {
+                               unfreeze_record(p);
                        }
 
                        /* convert record (i.e, patch mcount-call with NOP) */
@@ -780,7 +787,7 @@ static int ftrace_update_code(void)
            !ftrace_enabled || !ftraced_trigger)
                return 0;
 
-       stop_machine_run(__ftrace_update_code, NULL, NR_CPUS);
+       stop_machine(__ftrace_update_code, NULL, NULL);
 
        return 1;
 }
@@ -1557,7 +1564,7 @@ static int __init ftrace_dynamic_init(void)
 
        addr = (unsigned long)ftrace_record_ip;
 
-       stop_machine_run(ftrace_dyn_arch_init, &addr, NR_CPUS);
+       stop_machine(ftrace_dyn_arch_init, &addr, NULL);
 
        /* ftrace_dyn_arch_init places the return code in addr */
        if (addr) {
@@ -1594,6 +1601,23 @@ core_initcall(ftrace_dynamic_init);
 # define ftrace_force_shutdown()       do { } while (0)
 #endif /* CONFIG_DYNAMIC_FTRACE */
 
+/**
+ * ftrace_kill_atomic - kill ftrace from critical sections
+ *
+ * This function should be used by panic code. It stops ftrace
+ * but in a not so nice way. If you need to simply kill ftrace
+ * from a non-atomic section, use ftrace_kill.
+ */
+void ftrace_kill_atomic(void)
+{
+       ftrace_disabled = 1;
+       ftrace_enabled = 0;
+#ifdef CONFIG_DYNAMIC_FTRACE
+       ftraced_suspend = -1;
+#endif
+       clear_ftrace_function();
+}
+
 /**
  * ftrace_kill - totally shutdown ftrace
  *