From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Lai Jiangshan <laijs@cn.fujitsu.com>,
Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH 03/10] tracing: fix incorrect return type of ns2usecs() V2
Date: Fri, 03 Apr 2009 20:27:06 -0400 [thread overview]
Message-ID: <20090404002808.471342596@goodmis.org> (raw)
In-Reply-To: 20090404002703.627460459@goodmis.org
[-- Attachment #1: 0003-tracing-fix-incorrect-return-type-of-ns2usecs-V2.patch --]
[-- Type: text/plain, Size: 2907 bytes --]
From: Lai Jiangshan <laijs@cn.fujitsu.com>
Impact: fix time output bug in 32bits system
ns2usecs() returns 'long', it's incorrect.
(In i386)
# cat trace
...
<idle>-0 [000] 521.442100: _spin_lock <-tick_do_update_jiffies64
<idle>-0 [000] 521.442101: do_timer <-tick_do_update_jiffies64
<idle>-0 [000] 521.442102: update_wall_time <-do_timer
<idle>-0 [000] 521.442102: update_xtime_cache <-update_wall_time
....
(It always print the time less than 2200 seconds besides ...)
Because 'long' is 32bits in i386. ( (1<<31) useconds is about 2200 seconds)
# cat trace
...
<idle>-0 [001] 4154502640.134759: rcu_bh_qsctr_inc <-__do_softirq
<idle>-0 [001] 4154502640.134760: _local_bh_enable <-__do_softirq
<idle>-0 [001] 4154502640.134761: idle_cpu <-irq_exit
...
(very large value)
Because 'long' is a signed type and it is 32bits in i386.
Changed from V1:
return 'unsigned long long' instead of 'cycle_t'
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
LKML-Reference: <49D05D10.4030009@cn.fujitsu.com>
Reported-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
kernel/trace/trace.c | 3 +--
kernel/trace/trace.h | 2 +-
kernel/trace/trace_output.c | 2 +-
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 67c6a21..222bbba 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -147,8 +147,7 @@ static int __init set_ftrace_dump_on_oops(char *str)
}
__setup("ftrace_dump_on_oops", set_ftrace_dump_on_oops);
-long
-ns2usecs(cycle_t nsec)
+unsigned long long ns2usecs(cycle_t nsec)
{
nsec += 500;
do_div(nsec, 1000);
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index d7410bb..93991e6 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -594,7 +594,7 @@ extern int trace_selftest_startup_branch(struct tracer *trace,
#endif /* CONFIG_FTRACE_STARTUP_TEST */
extern void *head_page(struct trace_array_cpu *data);
-extern long ns2usecs(cycle_t nsec);
+extern unsigned long long ns2usecs(cycle_t nsec);
extern int
trace_vbprintk(unsigned long ip, const char *fmt, va_list args);
extern int
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index d72b9a6..64b54a5 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -423,7 +423,7 @@ int trace_print_lat_context(struct trace_iterator *iter)
trace_find_cmdline(entry->pid, comm);
- ret = trace_seq_printf(s, "%16s %5d %3d %d %08x %08lx [%08lx]"
+ ret = trace_seq_printf(s, "%16s %5d %3d %d %08x %08lx [%08llx]"
" %ld.%03ldms (+%ld.%03ldms): ", comm,
entry->pid, iter->cpu, entry->flags,
entry->preempt_count, iter->idx,
--
1.6.2.1
--
next prev parent reply other threads:[~2009-04-04 0:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-04 0:27 [PATCH 00/10] [GIT PULL] updates for tip/tracing/ftrace Steven Rostedt
2009-04-04 0:27 ` [PATCH 01/10] tracing: remove CALLER_ADDR2 from wakeup tracer Steven Rostedt
2009-04-04 0:27 ` [PATCH 02/10] tracing: use macros to denote usec and nsec per second Steven Rostedt
2009-04-04 0:27 ` Steven Rostedt [this message]
2009-04-04 0:27 ` [PATCH 04/10] tracing/ftrace: fix missing include string.h Steven Rostedt
2009-04-04 0:27 ` [PATCH 05/10] tracing/ftrace: factorize the tracing files creation Steven Rostedt
2009-04-04 0:27 ` [PATCH 06/10] function-graph: add proper initialization for init task Steven Rostedt
2009-04-04 0:27 ` [PATCH 07/10] function-graph: use int instead of atomic for ftrace_graph_active Steven Rostedt
2009-04-04 0:27 ` [PATCH 08/10] ftrace: Add check of sched_stopped for probe_sched_wakeup Steven Rostedt
2009-04-04 0:27 ` [PATCH 09/10] ftrace: Clean up enable logic for sched_switch Steven Rostedt
2009-04-04 0:27 ` [PATCH 10/10] tracing, x86: remove duplicated #include Steven Rostedt
-- strict thread matches above, loose matches on Subject: below --
2009-04-06 16:37 [PATCH 00/10] [GIT PULL] for tip/tracing/core Steven Rostedt
2009-04-06 16:37 ` [PATCH 03/10] tracing: fix incorrect return type of ns2usecs() V2 Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090404002808.471342596@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=srostedt@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.