]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ftrace: fix locking
authorIngo Molnar <mingo@elte.hu>
Mon, 12 May 2008 19:20:46 +0000 (21:20 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 23 May 2008 18:42:12 +0000 (20:42 +0200)
we can hold all cpu trace buffer locks at once - put each into a
separate lock class.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
kernel/trace/trace.c
kernel/trace/trace.h

index a40687a4413afd3729488d342bdcb0c627cf3ec5..b3811ca74071b5f080818ab904e41dd5bbd0a963 100644 (file)
@@ -1865,11 +1865,8 @@ tracing_read_pipe(struct file *filp, char __user *ubuf,
 
        }
 
-       for_each_possible_cpu(cpu) {
+       for_each_cpu_mask(cpu, mask) {
                data = iter->tr->data[cpu];
-
-               if (!cpu_isset(cpu, mask))
-                       continue;
                spin_unlock(&data->lock);
                atomic_dec(&data->disabled);
        }
@@ -2076,6 +2073,7 @@ static int trace_alloc_page(void)
        for_each_possible_cpu(i) {
                data = global_trace.data[i];
                spin_lock_init(&data->lock);
+               lockdep_set_class(&data->lock, &data->lock_key);
                page = list_entry(pages.next, struct page, lru);
                list_del_init(&page->lru);
                list_add_tail(&page->lru, &data->trace_pages);
@@ -2084,6 +2082,7 @@ static int trace_alloc_page(void)
 #ifdef CONFIG_TRACER_MAX_TRACE
                data = max_tr.data[i];
                spin_lock_init(&data->lock);
+               lockdep_set_class(&data->lock, &data->lock_key);
                page = list_entry(pages.next, struct page, lru);
                list_del_init(&page->lru);
                list_add_tail(&page->lru, &data->trace_pages);
@@ -2203,5 +2202,4 @@ __init static int tracer_alloc_buffers(void)
        }
        return ret;
 }
-
 fs_initcall(tracer_alloc_buffers);
index 29a7ea59de50086f7b72cfb059a27687927811f0..b0408356f0e07e2e8e609f8802e7defb85a32995 100644 (file)
@@ -56,6 +56,7 @@ struct trace_array_cpu {
        struct list_head        trace_pages;
        atomic_t                disabled;
        spinlock_t              lock;
+       struct lock_class_key   lock_key;
        cycle_t                 time_offset;
 
        /* these fields get copied into max-trace: */