tracing: fixes
Subsystems (2)
Steven Rostedt
maintainerIngo,
I rebased my branch against yours and removed the module patch since it looks like it is no longer urgent. I moved it over to my core branch along with a fix to the compile error you saw with it. I'll be pushing that later this week.
These two patchs still should go into 34.
Please pull the latest tip/tracing/urgent tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/tracing/urgent
Julia Lawall (1):
ring-buffer: Add missing unlock
Li Zefan (1):
tracing: Fix lockdep warning in global_clock()
----
kernel/trace/ring_buffer.c | 8 +++++--- kernel/trace/trace_clock.c | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-)
Steven Rostedt
maintainerPATCH 1/2 tracing: Fix lockdep warning in global_clock()
From: Li Zefan <[email protected]>
# echo 1 > events/enable # echo global > trace_clock
------------[ cut here ]------------ WARNING: at kernel/lockdep.c:3162 check_flags+0xb2/0x190() ... ---[ end trace 3f86734a89416623 ]---
possible reason: unannotated irqs-on.
...
There's no reason to use the raw_local_irq_save() in trace_clock_global. The local_irq_save() version is fine, and does not cause the bug in lockdep.
LKML-Reference: <[email protected]>
--- kernel/trace/trace_clock.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace_clock.c +2 -2
@@ -84,7 +84,7 @@ u64 notrace trace_clock_global(void)int this_cpu;u64 now; -raw_local_irq_save (flags); +local_irq_save (flags); this_cpu =raw_smp_processor_id (); now =cpu_clock (this_cpu);
@@ -110,7 +110,7 @@ u64 notrace trace_clock_global(void)arch_spin_unlock (&trace_clock_struct.lock); out: -raw_local_irq_restore (flags); +local_irq_restore (flags);return now; }
Signature · 1 line
1.7.0
Steven Rostedt
maintainerPATCH 2/2 ring-buffer: Add missing unlock
In reply to Steven RostedtFrom: Julia Lawall <[email protected]>
In some error handling cases the lock is not unlocked. The return is converted to a goto, to share the unlock at the end of the function.
A simplified version of the semantic patch that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@r exists@
expression E1;
identifier f;
@@
f (...) { <+...
* spin_lock_irq (E1,...);
... when != E1
* return ...;
...+> }
// </smpl>
LKML-Reference: <[email protected]>
--- kernel/trace/ring_buffer.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
kernel/trace/ring_buffer.c +5 -3
@@ -1209,18 +1209,19 @@ rb_remove_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned nr_pages)for (i =0 ; i < nr_pages; i++) {if (RB_WARN_ON (cpu_buffer,list_empty (cpu_buffer->pages))) -return ; + goto out; p = cpu_buffer->pages->next; bpage = list_entry(p, struct buffer_page, list);list_del_init (&bpage->list);free_buffer_page (bpage); }if (RB_WARN_ON (cpu_buffer,list_empty (cpu_buffer->pages))) -return ; + goto out;rb_reset_cpu (cpu_buffer);rb_check_pages (cpu_buffer); +out:spin_unlock_irq (&cpu_buffer->reader_lock); }
@@ -1237,7 +1238,7 @@ rb_insert_pages(struct ring_buffer_per_cpu *cpu_buffer,for (i =0 ; i < nr_pages; i++) {if (RB_WARN_ON (cpu_buffer,list_empty (pages))) -return ; + goto out; p = pages->next; bpage = list_entry(p, struct buffer_page, list);list_del_init (&bpage->list);
@@ -1246,6 +1247,7 @@ rb_insert_pages(struct ring_buffer_per_cpu *cpu_buffer,rb_reset_cpu (cpu_buffer);rb_check_pages (cpu_buffer); +out:spin_unlock_irq (&cpu_buffer->reader_lock); }
Signature · 1 line
1.7.0
Quoted 18 lines · Steven Rostedt
Ingo,
I rebased my branch against yours and removed the module patch since it looks like it is no longer urgent. I moved it over to my core branch along with a fix to the compile error you saw with it. I'll be pushing that later this week.
These two patchs still should go into 34.
Please pull the latest tip/tracing/urgent tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/tracing/urgentJulia Lawall (1):
ring-buffer: Add missing unlock
Quoted 7 lines
Li Zefan (1):
tracing: Fix lockdep warning inglobal_clock()----
kernel/trace/ring_buffer.c | 8 +++++--- kernel/trace/trace_clock.c | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-)
Pulled, thanks Steve!
Ingo