* [PATCH 0/4] [GIT PULL][2.6.31] tracing: more fixes
@ 2009-07-23 21:00 Steven Rostedt
2009-07-23 21:00 ` [PATCH 1/4] tracing: show proper address for trace-printk format Steven Rostedt
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Steven Rostedt @ 2009-07-23 21:00 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Thomas Gleixner, Frederic Weisbecker
Ingo and Thomas,
Here are 4 more fixes that should be in 31. They are minor and small, but
still should be made.
Please pull the latest tip/tracing/urgent-1 tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/tracing/urgent-1
Matt Fleming (2):
ftrace: Fix the conditional that updates $ref_func
ftrace: Only update $offset when we update $ref_func
Steven Rostedt (2):
tracing: show proper address for trace-printk format
tracing: only truncate ftrace files when O_TRUNC is set
----
kernel/trace/ftrace.c | 4 ++--
kernel/trace/trace.c | 2 +-
kernel/trace/trace_events.c | 2 +-
kernel/trace/trace_printk.c | 2 +-
scripts/recordmcount.pl | 5 +++--
5 files changed, 8 insertions(+), 7 deletions(-)
--
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] tracing: show proper address for trace-printk format
2009-07-23 21:00 [PATCH 0/4] [GIT PULL][2.6.31] tracing: more fixes Steven Rostedt
@ 2009-07-23 21:00 ` Steven Rostedt
2009-07-23 21:00 ` [PATCH 2/4] tracing: only truncate ftrace files when O_TRUNC is set Steven Rostedt
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2009-07-23 21:00 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Thomas Gleixner, Frederic Weisbecker
[-- Attachment #1: 0001-tracing-show-proper-address-for-trace-printk-format.patch --]
[-- Type: text/plain, Size: 1202 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
Since the trace_printk may use pointers to the format fields
in the buffer, they are exported via debugfs/tracing/printk_formats.
This is used by utilities that read the ring buffer in binary format.
It helps the utilities map the address of the format in the binary
buffer to what the printf format looks like.
Unfortunately, the way the output code works, it exports the address
of the pointer to the format address, and not the format address
itself. This makes the file totally useless in trying to figure
out what format string a binary address belongs to.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_printk.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
index 7b62781..687699d 100644
--- a/kernel/trace/trace_printk.c
+++ b/kernel/trace/trace_printk.c
@@ -176,7 +176,7 @@ static int t_show(struct seq_file *m, void *v)
const char *str = *fmt;
int i;
- seq_printf(m, "0x%lx : \"", (unsigned long)fmt);
+ seq_printf(m, "0x%lx : \"", *(unsigned long *)fmt);
/*
* Tabs and new lines need to be converted.
--
1.6.3.3
--
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] tracing: only truncate ftrace files when O_TRUNC is set
2009-07-23 21:00 [PATCH 0/4] [GIT PULL][2.6.31] tracing: more fixes Steven Rostedt
2009-07-23 21:00 ` [PATCH 1/4] tracing: show proper address for trace-printk format Steven Rostedt
@ 2009-07-23 21:00 ` Steven Rostedt
2009-07-23 21:00 ` [PATCH 3/4] ftrace: Fix the conditional that updates $ref_func Steven Rostedt
2009-07-23 21:00 ` [PATCH 4/4] ftrace: Only update $offset when we update $ref_func Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2009-07-23 21:00 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Thomas Gleixner, Frederic Weisbecker
[-- Attachment #1: 0002-tracing-only-truncate-ftrace-files-when-O_TRUNC-is-s.patch --]
[-- Type: text/plain, Size: 2324 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
The current code will truncate the ftrace files contents if O_APPEND
is not set and the file is opened in write mode. This is incorrect.
It should only truncate the file if O_TRUNC is set. Otherwise
if one of these files is opened by a C program with fopen "r+",
it will incorrectly truncate the file.
Reported-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/ftrace.c | 4 ++--
kernel/trace/trace.c | 2 +-
kernel/trace/trace_events.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 1f3ec2a..1e1d23c 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1662,7 +1662,7 @@ ftrace_regex_open(struct inode *inode, struct file *file, int enable)
mutex_lock(&ftrace_regex_lock);
if ((file->f_mode & FMODE_WRITE) &&
- !(file->f_flags & O_APPEND))
+ (file->f_flags & O_TRUNC))
ftrace_filter_reset(enable);
if (file->f_mode & FMODE_READ) {
@@ -2577,7 +2577,7 @@ ftrace_graph_open(struct inode *inode, struct file *file)
mutex_lock(&graph_lock);
if ((file->f_mode & FMODE_WRITE) &&
- !(file->f_flags & O_APPEND)) {
+ (file->f_flags & O_TRUNC)) {
ftrace_graph_count = 0;
memset(ftrace_graph_funcs, 0, sizeof(ftrace_graph_funcs));
}
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 8bc8d8a..d8ef285 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2031,7 +2031,7 @@ static int tracing_open(struct inode *inode, struct file *file)
/* If this file was open for write, then erase contents */
if ((file->f_mode & FMODE_WRITE) &&
- !(file->f_flags & O_APPEND)) {
+ (file->f_flags & O_TRUNC)) {
long cpu = (long) inode->i_private;
if (cpu == TRACE_PIPE_ALL_CPU)
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 53c8fd3..23d2972 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -376,7 +376,7 @@ ftrace_event_seq_open(struct inode *inode, struct file *file)
const struct seq_operations *seq_ops;
if ((file->f_mode & FMODE_WRITE) &&
- !(file->f_flags & O_APPEND))
+ (file->f_flags & O_TRUNC))
ftrace_clear_events();
seq_ops = inode->i_private;
--
1.6.3.3
--
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] ftrace: Fix the conditional that updates $ref_func
2009-07-23 21:00 [PATCH 0/4] [GIT PULL][2.6.31] tracing: more fixes Steven Rostedt
2009-07-23 21:00 ` [PATCH 1/4] tracing: show proper address for trace-printk format Steven Rostedt
2009-07-23 21:00 ` [PATCH 2/4] tracing: only truncate ftrace files when O_TRUNC is set Steven Rostedt
@ 2009-07-23 21:00 ` Steven Rostedt
2009-07-23 21:00 ` [PATCH 4/4] ftrace: Only update $offset when we update $ref_func Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2009-07-23 21:00 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Thomas Gleixner, Frederic Weisbecker,
Matt Fleming
[-- Attachment #1: 0003-ftrace-Fix-the-conditional-that-updates-ref_func.patch --]
[-- Type: text/plain, Size: 1016 bytes --]
From: Matt Fleming <matt@console-pimps.org>
Fix the conditional that checks if we already have a $ref_func and that
the new function is weak. The code as previously checking whether either
condition was false, and we really need to only update $ref_func is both
cconditions are false.
Signed-off-by: Matt Fleming <matt@console-pimps.org>
LKML-Reference: <1248365775-25196-1-git-send-email-matt@console-pimps.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
scripts/recordmcount.pl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index 7109e2b..16c5563 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -414,7 +414,7 @@ while (<IN>) {
$read_function = 0;
} 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})) {
$ref_func = $text;
}
}
--
1.6.3.3
--
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] ftrace: Only update $offset when we update $ref_func
2009-07-23 21:00 [PATCH 0/4] [GIT PULL][2.6.31] tracing: more fixes Steven Rostedt
` (2 preceding siblings ...)
2009-07-23 21:00 ` [PATCH 3/4] ftrace: Fix the conditional that updates $ref_func Steven Rostedt
@ 2009-07-23 21:00 ` Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2009-07-23 21:00 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Thomas Gleixner, Frederic Weisbecker,
Matt Fleming
[-- Attachment #1: 0004-ftrace-Only-update-offset-when-we-update-ref_func.patch --]
[-- Type: text/plain, Size: 1659 bytes --]
From: Matt Fleming <matt@console-pimps.org>
The value of $offset should be the offset of $ref_func from the
beginning of the object file. Therefore, we should set both variables
together.
This fixes a bug I was hitting on sh where $offset (which is used to
calcualte the addends for the __mcount_loc entries) was being set
multiple times and didn't correspond to $ref_func's offset in the object
file. The addends in __mcount_loc were calculated incorrectly, resulting
in ftrace dynamically modifying addresses that weren't mcount call
sites.
Signed-off-by: Matt Fleming <matt@console-pimps.org>
LKML-Reference: <1248365775-25196-2-git-send-email-matt@console-pimps.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
scripts/recordmcount.pl | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index 16c5563..d29baa2 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -403,7 +403,6 @@ while (<IN>) {
# section found, now is this a start of a function?
} elsif ($read_function && /$function_regex/) {
$text_found = 1;
- $offset = hex $1;
$text = $2;
# if this is either a local function or a weak function
@@ -412,10 +411,12 @@ while (<IN>) {
if (!defined($locals{$text}) && !defined($weak{$text})) {
$ref_func = $text;
$read_function = 0;
+ $offset = hex $1;
} else {
# if we already have a function, and this is weak, skip it
if (!defined($ref_func) && !defined($weak{$text})) {
$ref_func = $text;
+ $offset = hex $1;
}
}
} elsif ($read_headers && /$mcount_section/) {
--
1.6.3.3
--
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-07-23 21:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-23 21:00 [PATCH 0/4] [GIT PULL][2.6.31] tracing: more fixes Steven Rostedt
2009-07-23 21:00 ` [PATCH 1/4] tracing: show proper address for trace-printk format Steven Rostedt
2009-07-23 21:00 ` [PATCH 2/4] tracing: only truncate ftrace files when O_TRUNC is set Steven Rostedt
2009-07-23 21:00 ` [PATCH 3/4] ftrace: Fix the conditional that updates $ref_func Steven Rostedt
2009-07-23 21:00 ` [PATCH 4/4] ftrace: Only update $offset when we update $ref_func Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox