]> Git Repo - linux.git/blobdiff - kernel/lockdep.c
ftrace: trace irq disabled critical timings
[linux.git] / kernel / lockdep.c
index 3574379f4d62d2d04c9431c0c2172dc044d0ca66..e21924365ea364e8c0c90686caa5978f463752f5 100644 (file)
@@ -39,6 +39,7 @@
 #include <linux/irqflags.h>
 #include <linux/utsname.h>
 #include <linux/hash.h>
+#include <linux/ftrace.h>
 
 #include <asm/sections.h>
 
@@ -779,6 +780,10 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force)
         * parallel walking of the hash-list safe:
         */
        list_add_tail_rcu(&class->hash_entry, hash_head);
+       /*
+        * Add it to the global list of classes:
+        */
+       list_add_tail_rcu(&class->lock_entry, &all_lock_classes);
 
        if (verbose(class)) {
                graph_unlock();
@@ -978,7 +983,7 @@ check_noncircular(struct lock_class *source, unsigned int depth)
        return 1;
 }
 
-#ifdef CONFIG_TRACE_IRQFLAGS
+#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_PROVE_LOCKING)
 /*
  * Forwards and backwards subgraph searching, for the purposes of
  * proving that two subgraphs can be connected by a new dependency
@@ -1676,7 +1681,7 @@ valid_state(struct task_struct *curr, struct held_lock *this,
 static int mark_lock(struct task_struct *curr, struct held_lock *this,
                     enum lock_usage_bit new_bit);
 
-#ifdef CONFIG_TRACE_IRQFLAGS
+#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_PROVE_LOCKING)
 
 /*
  * print irq inversion bug:
@@ -2009,11 +2014,13 @@ void early_boot_irqs_on(void)
 /*
  * Hardirqs will be enabled:
  */
-void trace_hardirqs_on(void)
+void notrace trace_hardirqs_on_caller(unsigned long a0)
 {
        struct task_struct *curr = current;
        unsigned long ip;
 
+       time_hardirqs_on(CALLER_ADDR0, a0);
+
        if (unlikely(!debug_locks || current->lockdep_recursion))
                return;
 
@@ -2051,16 +2058,23 @@ void trace_hardirqs_on(void)
        curr->hardirq_enable_event = ++curr->irq_events;
        debug_atomic_inc(&hardirqs_on_events);
 }
+EXPORT_SYMBOL(trace_hardirqs_on_caller);
 
+void notrace trace_hardirqs_on(void)
+{
+       trace_hardirqs_on_caller(CALLER_ADDR0);
+}
 EXPORT_SYMBOL(trace_hardirqs_on);
 
 /*
  * Hardirqs were disabled:
  */
-void trace_hardirqs_off(void)
+void notrace trace_hardirqs_off_caller(unsigned long a0)
 {
        struct task_struct *curr = current;
 
+       time_hardirqs_off(CALLER_ADDR0, a0);
+
        if (unlikely(!debug_locks || current->lockdep_recursion))
                return;
 
@@ -2078,7 +2092,12 @@ void trace_hardirqs_off(void)
        } else
                debug_atomic_inc(&redundant_hardirqs_off);
 }
+EXPORT_SYMBOL(trace_hardirqs_off_caller);
 
+void notrace trace_hardirqs_off(void)
+{
+       trace_hardirqs_off_caller(CALLER_ADDR0);
+}
 EXPORT_SYMBOL(trace_hardirqs_off);
 
 /*
@@ -2282,10 +2301,6 @@ static int mark_lock(struct task_struct *curr, struct held_lock *this,
                        return 0;
                break;
        case LOCK_USED:
-               /*
-                * Add it to the global list of classes:
-                */
-               list_add_tail_rcu(&this->class->lock_entry, &all_lock_classes);
                debug_atomic_dec(&nr_unused_locks);
                break;
        default:
This page took 0.034283 seconds and 4 git commands to generate.