aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2008-10-23 09:33:03 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-23 10:00:20 -0400
commit6912896e994ddaf06cc0f6d3f2098bc4b59bdd84 (patch)
tree5f60e432eb5ec6cf0268ddc4d96f901578886c29 /kernel
parent81adbdc029ecc416d56563e7f159100181dd711d (diff)
ftrace: add ftrace warn on to disable ftrace
Add ftrace warn on to disable ftrace as well as report a warning. [ Thanks to Andrew Morton for suggesting using the WARN_ON return value ] Signed-off-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/ftrace.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 93245ae046e1..b08996ca561d 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -32,6 +32,18 @@
32 32
33#include "trace.h" 33#include "trace.h"
34 34
35#define FTRACE_WARN_ON(cond) \
36 do { \
37 if (WARN_ON(cond)) \
38 ftrace_kill(); \
39 } while (0)
40
41#define FTRACE_WARN_ON_ONCE(cond) \
42 do { \
43 if (WARN_ON_ONCE(cond)) \
44 ftrace_kill(); \
45 } while (0)
46
35/* ftrace_enabled is a method to turn ftrace on or off */ 47/* ftrace_enabled is a method to turn ftrace on or off */
36int ftrace_enabled __read_mostly; 48int ftrace_enabled __read_mostly;
37static int last_ftrace_enabled; 49static int last_ftrace_enabled;
@@ -363,10 +375,8 @@ static struct dyn_ftrace *ftrace_alloc_dyn_node(unsigned long ip)
363 rec = ftrace_free_records; 375 rec = ftrace_free_records;
364 376
365 if (unlikely(!(rec->flags & FTRACE_FL_FREE))) { 377 if (unlikely(!(rec->flags & FTRACE_FL_FREE))) {
366 WARN_ON_ONCE(1); 378 FTRACE_WARN_ON_ONCE(1);
367 ftrace_free_records = NULL; 379 ftrace_free_records = NULL;
368 ftrace_disabled = 1;
369 ftrace_enabled = 0;
370 return NULL; 380 return NULL;
371 } 381 }
372 382
@@ -415,7 +425,7 @@ ftrace_record_ip(unsigned long ip)
415 425
416 key = hash_long(ip, FTRACE_HASHBITS); 426 key = hash_long(ip, FTRACE_HASHBITS);
417 427
418 WARN_ON_ONCE(key >= FTRACE_HASHSIZE); 428 FTRACE_WARN_ON_ONCE(key >= FTRACE_HASHSIZE);
419 429
420 if (ftrace_ip_in_hash(ip, key)) 430 if (ftrace_ip_in_hash(ip, key))
421 goto out; 431 goto out;
@@ -607,12 +617,12 @@ ftrace_code_disable(struct dyn_ftrace *rec)
607 if (ret) { 617 if (ret) {
608 switch (ret) { 618 switch (ret) {
609 case -EFAULT: 619 case -EFAULT:
610 WARN_ON_ONCE(1); 620 FTRACE_WARN_ON_ONCE(1);
611 pr_info("ftrace faulted on modifying "); 621 pr_info("ftrace faulted on modifying ");
612 print_ip_sym(ip); 622 print_ip_sym(ip);
613 break; 623 break;
614 case -EINVAL: 624 case -EINVAL:
615 WARN_ON_ONCE(1); 625 FTRACE_WARN_ON_ONCE(1);
616 pr_info("ftrace failed to modify "); 626 pr_info("ftrace failed to modify ");
617 print_ip_sym(ip); 627 print_ip_sym(ip);
618 print_ip_ins(" expected: ", call); 628 print_ip_ins(" expected: ", call);
@@ -621,12 +631,12 @@ ftrace_code_disable(struct dyn_ftrace *rec)
621 printk(KERN_CONT "\n"); 631 printk(KERN_CONT "\n");
622 break; 632 break;
623 case -EPERM: 633 case -EPERM:
624 WARN_ON_ONCE(1); 634 FTRACE_WARN_ON_ONCE(1);
625 pr_info("ftrace faulted on writing "); 635 pr_info("ftrace faulted on writing ");
626 print_ip_sym(ip); 636 print_ip_sym(ip);
627 break; 637 break;
628 default: 638 default:
629 WARN_ON_ONCE(1); 639 FTRACE_WARN_ON_ONCE(1);
630 pr_info("ftrace faulted on unknown error "); 640 pr_info("ftrace faulted on unknown error ");
631 print_ip_sym(ip); 641 print_ip_sym(ip);
632 } 642 }
@@ -1722,8 +1732,7 @@ static int ftraced(void *ignore)
1722 ftrace_update_cnt != 1 ? "s" : "", 1732 ftrace_update_cnt != 1 ? "s" : "",
1723 ftrace_update_tot_cnt, 1733 ftrace_update_tot_cnt,
1724 usecs, usecs != 1 ? "s" : ""); 1734 usecs, usecs != 1 ? "s" : "");
1725 ftrace_disabled = 1; 1735 FTRACE_WARN_ON_ONCE(1);
1726 WARN_ON_ONCE(1);
1727 } 1736 }
1728 } 1737 }
1729 mutex_unlock(&ftraced_lock); 1738 mutex_unlock(&ftraced_lock);