Skip to contentSkip to conversation

[2.6.31] ring-buffer/tracing: various fixes

GIT PULL New Steven Rostedt 3 participants 8 messages Aug 6, 2009

Subsystems (2)
lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

Ingo,

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

Steven Rostedt (3):
ring-buffer: fix check of try_to_discard result
ring-buffer: do not disable ring buffer on oops_in_progress
tracing: do not use functions starting with .L in recordmcount.pl

----

 kernel/trace/ring_buffer.c |    4 ++--
 scripts/recordmcount.pl    |    5 ++++-
 2 files changed, 6 insertions(+), 3 deletions(-)
author maintainer
#1 lore raw

PATCH 1/3 ring-buffer: fix check of try_to_discard result

From: Steven Rostedt <[email protected]>

The function ring_buffer_discard_commit inversed the code path of the result of try_to_discard. It should skip incrementing the entry counter if try_to_discard succeeded. But instead, it increments the entry conder if it succeeded to discard, and does not increment it if it fails.

The result of this bug is that filtering will make the stat counters incorrect.

---
 kernel/trace/ring_buffer.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/trace/ring_buffer.c +1 -1
index bf27bb7..2fd1752 100644
@@ -1785,7 +1785,7 @@ void ring_buffer_discard_commit(struct ring_buffer *buffer,
 	 */
 	RB_WARN_ON(buffer, !local_read(&cpu_buffer->committing));
 
-	if (!rb_try_to_discard(cpu_buffer, event))
+	if (rb_try_to_discard(cpu_buffer, event))
 		goto out;
 
 	/*
Signature · 3 lines
1.6.3.3

-- 
author maintainer
#2 lore raw

PATCH 2/3 ring-buffer: do not disable ring buffer on oops_in_progress

In reply to Steven Rostedt

From: Steven Rostedt <[email protected]>

The commit:

commit e0fdace10e75dac67d906213b780ff1b1a4cc360
Author: David Miller <[email protected]>
Date: Fri Aug 1 01:11:22 2008 -0700

debug_locks: set oops_in_progress if we will log messages.

Otherwise lock debugging messages on runqueue locks can deadlock the system due to the wakeups performed by printk().

Will permanently set oops_in_progress on any lockdep failure. When this triggers it will cause any read from the ring buffer to permanently disable the ring buffer (not to mention no locking of printk).

This patch removes the check. It keeps the print in NMI which makes sense. This is probably OK, since the ring buffer should not cause something to set oops_in_progress anyway.

---
 kernel/trace/ring_buffer.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/trace/ring_buffer.c +1 -1
index 2fd1752..2606cee 100644
@@ -2486,7 +2486,7 @@ static inline int rb_ok_to_lock(void)
 	 * buffer too. A one time deal is all you get from reading
 	 * the ring buffer from an NMI.
 	 */
-	if (likely(!in_nmi() && !oops_in_progress))
+	if (likely(!in_nmi()))
 		return 1;
 
 	tracing_off_permanent();
Signature · 3 lines
1.6.3.3

-- 
author maintainer
#3 lore raw

PATCH 3/3 tracing: do not use functions starting with .L in recordmcount.pl

In reply to Steven Rostedt

From: Steven Rostedt <[email protected]>

Quoted 9 lines · Ingo Molnar
Quoted 5 lines · Dave Airlie

Hey,

So I spent 3-4 hrs today (I'm stupid yes) tracking down a .o breakage by blaming rawhide gcc/binutils as I was using make V=1and seeing only the compiler chain running,

Hm, is this that powerpc related build bug you just reported?

Well we tracked it down and it is powerpc64 specific.

Seems that in drivers/hwmon/lm93.c there's a function called:

LM93_IN_FROM_REG()

But PPC64 has function descriptors and the real function names (the ones you see in objdump) start with a '.'. Thus this in objdump you have:

Disassembly of section .text:

0000000000000000 <.LM93_IN_FROM_REG>:

       0:       7c 08 02 a6     mflr    r0
       4:       fb 81 ff e0     std     r28,-32(r1)

The function name used is .LM93_IN_FROM_REG. But gcc considers symbols that start with ".L" as a special symbol that is used inside the assembly stage.

The nm passed into recordmcount uses the --synthetic option which shows the ".L" symbols (my runs outside of the build did not include the --synthetic option, so my older patch worked). We see the function as a local.

Now to capture all the locations that use "mcount" we need to have a reference to link into the object file a list of mcount callers. We need a reference that will not disappear. We try to use a global function and if that does not work, we use a local function as a reference. But to relink the section back into the object, we need to make it global. In this case, we run objcopy using --globalize-symbol and --localize-symbol to convert the symbol into a global symbol, link the mcount list, then convert it back to a local symbol.

This works great except for this case. .L* symbols can not be converted into a global symbol, and the mcount section referencing it will remain unresolved.

LKML-Reference: <[email protected]>

---
 scripts/recordmcount.pl |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
scripts/recordmcount.pl +4 -1
index d29baa2..4889c44 100755
@@ -414,7 +414,10 @@ while (<IN>) {
 	    $offset = hex $1;
 	} else {
 	    # if we already have a function, and this is weak, skip it
-	    if (!defined($ref_func) && !defined($weak{$text})) {
+	    if (!defined($ref_func) && !defined($weak{$text}) &&
+		 # PPC64 can have symbols that start with .L and
+		 # gcc considers these special. Don't use them!
+		 $text !~ /^\.L/) {
 		$ref_func = $text;
 		$offset = hex $1;
 	    }
Signature · 3 lines
1.6.3.3

-- 
#4 lore raw
In reply to Steven Rostedt
Quoted 7 lines · Steven Rostedt

Ingo,

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

Steven,

if there is the chance I would like to see this fix in -rc6 too (I know you wanted to test it):

193df82 ring-buffer: Fix advance of reader in rb_buffer_peek()

You can cherry-pick from my oprofile/master tree or linux-next. The bug throws warnings with oprofile under high loads and I already got bug reports of this.

Thanks,

-Robert

Signature · 3 lines
Advanced Micro Devices, Inc.
Operating System Research Center
email: [email protected]
#5 lore raw
Quoted 11 lines · Robert Richter
Quoted 7 lines · Steven Rostedt

Ingo,

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

Steven,

Quoted 8 lines

if there is the chance I would like to see this fix in -rc6 too (I know you wanted to test it):

193df82 ring-buffer: Fix advance of reader in rb_buffer_peek()

You can cherry-pick from my oprofile/master tree or linux-next. The bug throws warnings with oprofile under high loads and I already got bug reports of this.

i remember having triggered something similar in tests too. I've cherry-picked it on top of Steve's fixes, for -rc6.

Thanks,

Ingo

author maintainer
#6 lore raw
Quoted 17 lines · Ingo Molnar
Quoted 14 lines · Robert Richter
Quoted 7 lines · Steven Rostedt

Ingo,

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

Steven,

if there is the chance I would like to see this fix in -rc6 too (I know you wanted to test it):

Quoted 8 lines
Quoted 5 lines

193df82 ring-buffer: Fix advance of reader in rb_buffer_peek()

You can cherry-pick from my oprofile/master tree or linux-next. The bug throws warnings with oprofile under high loads and I already got bug reports of this.

i remember having triggered something similar in tests too. I've cherry-picked it on top of Steve's fixes, for -rc6.

Thanks Ingo,

I thought I had this one go out too, but looking at my repo, it's in my 32 queue for some reason. :-/ I must have added it to the wrong queue.

-- Steve

#7 lore raw
In reply to Steven Rostedt
Quoted 14 lines · Steven Rostedt

Ingo,

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

Steven Rostedt (3):
ring-buffer: fix check of try_to_discard result
ring-buffer: do not disable ring buffer on oops_in_progress
tracing: do not use functions starting with .L in recordmcount.pl

Quoted 4 lines

----

 kernel/trace/ring_buffer.c |    4 ++--
 scripts/recordmcount.pl    |    5 ++++-
 2 files changed, 6 insertions(+), 3 deletions(-)

Pulled, thanks Steve!

Ingo