diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-05-12 15:20:46 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2008-05-23 14:42:12 -0400 |
commit | d4c5a2f5870939d837293de87b41dda0012a4572 (patch) | |
tree | 46512c24ff245052e60b6d2156cd9992d272ff11 /kernel/trace | |
parent | b3806b4316306dc9c542eff6c23d7d42918f3504 (diff) |
ftrace: fix locking
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>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/trace.c | 8 | ||||
-rw-r--r-- | kernel/trace/trace.h | 1 |
2 files changed, 4 insertions, 5 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index a40687a4413a..b3811ca74071 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -1865,11 +1865,8 @@ tracing_read_pipe(struct file *filp, char __user *ubuf, | |||
1865 | 1865 | ||
1866 | } | 1866 | } |
1867 | 1867 | ||
1868 | for_each_possible_cpu(cpu) { | 1868 | for_each_cpu_mask(cpu, mask) { |
1869 | data = iter->tr->data[cpu]; | 1869 | data = iter->tr->data[cpu]; |
1870 | |||
1871 | if (!cpu_isset(cpu, mask)) | ||
1872 | continue; | ||
1873 | spin_unlock(&data->lock); | 1870 | spin_unlock(&data->lock); |
1874 | atomic_dec(&data->disabled); | 1871 | atomic_dec(&data->disabled); |
1875 | } | 1872 | } |
@@ -2076,6 +2073,7 @@ static int trace_alloc_page(void) | |||
2076 | for_each_possible_cpu(i) { | 2073 | for_each_possible_cpu(i) { |
2077 | data = global_trace.data[i]; | 2074 | data = global_trace.data[i]; |
2078 | spin_lock_init(&data->lock); | 2075 | spin_lock_init(&data->lock); |
2076 | lockdep_set_class(&data->lock, &data->lock_key); | ||
2079 | page = list_entry(pages.next, struct page, lru); | 2077 | page = list_entry(pages.next, struct page, lru); |
2080 | list_del_init(&page->lru); | 2078 | list_del_init(&page->lru); |
2081 | list_add_tail(&page->lru, &data->trace_pages); | 2079 | list_add_tail(&page->lru, &data->trace_pages); |
@@ -2084,6 +2082,7 @@ static int trace_alloc_page(void) | |||
2084 | #ifdef CONFIG_TRACER_MAX_TRACE | 2082 | #ifdef CONFIG_TRACER_MAX_TRACE |
2085 | data = max_tr.data[i]; | 2083 | data = max_tr.data[i]; |
2086 | spin_lock_init(&data->lock); | 2084 | spin_lock_init(&data->lock); |
2085 | lockdep_set_class(&data->lock, &data->lock_key); | ||
2087 | page = list_entry(pages.next, struct page, lru); | 2086 | page = list_entry(pages.next, struct page, lru); |
2088 | list_del_init(&page->lru); | 2087 | list_del_init(&page->lru); |
2089 | list_add_tail(&page->lru, &data->trace_pages); | 2088 | list_add_tail(&page->lru, &data->trace_pages); |
@@ -2203,5 +2202,4 @@ __init static int tracer_alloc_buffers(void) | |||
2203 | } | 2202 | } |
2204 | return ret; | 2203 | return ret; |
2205 | } | 2204 | } |
2206 | |||
2207 | fs_initcall(tracer_alloc_buffers); | 2205 | fs_initcall(tracer_alloc_buffers); |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 29a7ea59de50..b0408356f0e0 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -56,6 +56,7 @@ struct trace_array_cpu { | |||
56 | struct list_head trace_pages; | 56 | struct list_head trace_pages; |
57 | atomic_t disabled; | 57 | atomic_t disabled; |
58 | spinlock_t lock; | 58 | spinlock_t lock; |
59 | struct lock_class_key lock_key; | ||
59 | cycle_t time_offset; | 60 | cycle_t time_offset; |
60 | 61 | ||
61 | /* these fields get copied into max-trace: */ | 62 | /* these fields get copied into max-trace: */ |