Skip to contentSkip to conversation

tracing: fixes

GIT PULL New Steven Rostedt 2 participants 4 messages Mar 30, 2010 – Apr 2, 2010

Subsystems (2)
lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

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/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(-)
author maintainer
#1 lore raw

PATCH 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
index 6fbfb8f..9d589d8 100644
@@ -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
author maintainer
#2 lore raw

PATCH 2/2 ring-buffer: Add missing unlock

In reply to Steven Rostedt

From: 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
index d1187ef..9a0f9bf 100644
@@ -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
#3 lore raw
In reply to Steven Rostedt
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/urgent

Julia Lawall (1):
ring-buffer: Add missing unlock

Quoted 7 lines

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(-)

Pulled, thanks Steve!

Ingo