* [PATCH] tracing: fix incorrect return type of ns2usecs()
@ 2009-03-30 3:52 Lai Jiangshan
2009-03-30 5:48 ` [PATCH] tracing: fix incorrect return type of ns2usecs() V2 Lai Jiangshan
2009-03-30 9:55 ` [PATCH] " Frederic Weisbecker
0 siblings, 2 replies; 5+ messages in thread
From: Lai Jiangshan @ 2009-03-30 3:52 UTC (permalink / raw)
To: Ingo Molnar, Steven Rostedt, Frederic Weisbecker, Li Zefan, LKML
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 is 32bits in i386.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Reported-by: Li Zefan <lizf@cn.fujitsu.com>
Tested-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 2a81dec..c048243 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)
+cycle_t ns2usecs(cycle_t nsec)
{
nsec += 500;
do_div(nsec, 1000);
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index fec6521..ed78278 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -602,7 +602,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 cycle_t 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 aeac358..0e70fb0 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -433,7 +433,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,
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] tracing: fix incorrect return type of ns2usecs() V2
2009-03-30 3:52 [PATCH] tracing: fix incorrect return type of ns2usecs() Lai Jiangshan
@ 2009-03-30 5:48 ` Lai Jiangshan
2009-04-03 16:13 ` Steven Rostedt
2009-04-07 13:12 ` [tip:tracing/urgent] tracing: fix incorrect return type of ns2usecs() Lai Jiangshan
2009-03-30 9:55 ` [PATCH] " Frederic Weisbecker
1 sibling, 2 replies; 5+ messages in thread
From: Lai Jiangshan @ 2009-03-30 5:48 UTC (permalink / raw)
To: Ingo Molnar, Steven Rostedt, Frederic Weisbecker, Li Zefan, LKML
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>
Reported-by: Li Zefan <lizf@cn.fujitsu.com>
---
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 2a81dec..5232201 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 fec6521..47aa6d0 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -602,7 +602,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 aeac358..0e70fb0 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -433,7 +433,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,
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] tracing: fix incorrect return type of ns2usecs()
2009-03-30 3:52 [PATCH] tracing: fix incorrect return type of ns2usecs() Lai Jiangshan
2009-03-30 5:48 ` [PATCH] tracing: fix incorrect return type of ns2usecs() V2 Lai Jiangshan
@ 2009-03-30 9:55 ` Frederic Weisbecker
1 sibling, 0 replies; 5+ messages in thread
From: Frederic Weisbecker @ 2009-03-30 9:55 UTC (permalink / raw)
To: Lai Jiangshan; +Cc: Ingo Molnar, Steven Rostedt, Li Zefan, LKML
On Mon, Mar 30, 2009 at 11:52:13AM +0800, Lai Jiangshan wrote:
>
> 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 is 32bits in i386.
>
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> Reported-by: Li Zefan <lizf@cn.fujitsu.com>
> Tested-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tracing: fix incorrect return type of ns2usecs() V2
2009-03-30 5:48 ` [PATCH] tracing: fix incorrect return type of ns2usecs() V2 Lai Jiangshan
@ 2009-04-03 16:13 ` Steven Rostedt
2009-04-07 13:12 ` [tip:tracing/urgent] tracing: fix incorrect return type of ns2usecs() Lai Jiangshan
1 sibling, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2009-04-03 16:13 UTC (permalink / raw)
To: Lai Jiangshan; +Cc: Ingo Molnar, Frederic Weisbecker, Li Zefan, LKML
On Mon, 2009-03-30 at 13:48 +0800, Lai Jiangshan wrote:
> 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>
> Reported-by: Li Zefan <lizf@cn.fujitsu.com>
Thanks, applied.
-- Steve
^ permalink raw reply [flat|nested] 5+ messages in thread
* [tip:tracing/urgent] tracing: fix incorrect return type of ns2usecs()
2009-03-30 5:48 ` [PATCH] tracing: fix incorrect return type of ns2usecs() V2 Lai Jiangshan
2009-04-03 16:13 ` Steven Rostedt
@ 2009-04-07 13:12 ` Lai Jiangshan
1 sibling, 0 replies; 5+ messages in thread
From: Lai Jiangshan @ 2009-04-07 13:12 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, lizf, fweisbec, rostedt, tglx, laijs,
mingo
Commit-ID: cf8e3474654f20433aab9aa35826d43b5f245008
Gitweb: http://git.kernel.org/tip/cf8e3474654f20433aab9aa35826d43b5f245008
Author: Lai Jiangshan <laijs@cn.fujitsu.com>
AuthorDate: Mon, 30 Mar 2009 13:48:00 +0800
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 7 Apr 2009 13:59:23 +0200
tracing: fix incorrect return type of ns2usecs()
Impact: fix time output bug in 32bits system
ns2usecs() returns 'long', it's incorrect.
(In i386)
..
<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)
..
<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.
Changes in v2:
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 <rostedt@goodmis.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
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 a0174a4..457dd8c 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 cb0ce3f..0d81a4a 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -596,7 +596,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,
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-04-07 13:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-30 3:52 [PATCH] tracing: fix incorrect return type of ns2usecs() Lai Jiangshan
2009-03-30 5:48 ` [PATCH] tracing: fix incorrect return type of ns2usecs() V2 Lai Jiangshan
2009-04-03 16:13 ` Steven Rostedt
2009-04-07 13:12 ` [tip:tracing/urgent] tracing: fix incorrect return type of ns2usecs() Lai Jiangshan
2009-03-30 9:55 ` [PATCH] " Frederic Weisbecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox