* [PATCH] init/main.c: Use ktime accessor function in initcall_debug code.
@ 2008-11-20 14:47 Will Newton
2008-11-20 17:39 ` Tim Bird
0 siblings, 1 reply; 4+ messages in thread
From: Will Newton @ 2008-11-20 14:47 UTC (permalink / raw)
To: linux-kernel; +Cc: Tim Bird, Andrew Morton
[-- Attachment #1: Type: text/plain, Size: 796 bytes --]
The initcall_debug code access the tv64 member of ktime. This won't work
correctly for large deltas on platforms that don't use the scalar ktime
implementation.
Signed-off-by: Will Newton <will.newton@gmail.com>
---
init/main.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/init/main.c b/init/main.c
index 7e117a2..0eff42a 100644
--- a/init/main.c
+++ b/init/main.c
@@ -718,7 +718,7 @@ int do_one_initcall(initcall_t fn)
if (initcall_debug) {
it.rettime = ktime_get();
delta = ktime_sub(it.rettime, it.calltime);
- it.duration = (unsigned long long) delta.tv64 >> 10;
+ it.duration = (unsigned long long) ktime_to_ns(delta) >> 10;
printk("initcall %pF returned %d after %Ld usecs\n", fn,
it.result, it.duration);
trace_boot(&it, fn);
--
1.5.5.2
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-init-main.c-Use-ktime-accessor-function-in-initcall.patch --]
[-- Type: text/x-patch; name=0001-init-main.c-Use-ktime-accessor-function-in-initcall.patch, Size: 1014 bytes --]
From e9697ec9db4d04b9c615d34b76571afabaa8dfb1 Mon Sep 17 00:00:00 2001
From: Will Newton <will.newton@gmail.com>
Date: Thu, 20 Nov 2008 14:11:54 +0000
Subject: [PATCH] init/main.c: Use ktime accessor function in initcall_debug code.
The initcall_debug code access the tv64 member of ktime. This won't work
correctly on platforms that don't use the scalar ktime implementation.
Signed-off-by: Will Newton <will.newton@gmail.com>
---
init/main.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/init/main.c b/init/main.c
index 7e117a2..0eff42a 100644
--- a/init/main.c
+++ b/init/main.c
@@ -718,7 +718,7 @@ int do_one_initcall(initcall_t fn)
if (initcall_debug) {
it.rettime = ktime_get();
delta = ktime_sub(it.rettime, it.calltime);
- it.duration = (unsigned long long) delta.tv64 >> 10;
+ it.duration = (unsigned long long) ktime_to_ns(delta) >> 10;
printk("initcall %pF returned %d after %Ld usecs\n", fn,
it.result, it.duration);
trace_boot(&it, fn);
--
1.5.5.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] init/main.c: Use ktime accessor function in initcall_debug code.
2008-11-20 14:47 [PATCH] init/main.c: Use ktime accessor function in initcall_debug code Will Newton
@ 2008-11-20 17:39 ` Tim Bird
2008-11-20 17:46 ` Will Newton
0 siblings, 1 reply; 4+ messages in thread
From: Tim Bird @ 2008-11-20 17:39 UTC (permalink / raw)
To: Will Newton; +Cc: linux-kernel, Andrew Morton
Will Newton wrote:
> The initcall_debug code access the tv64 member of ktime. This won't work
> correctly for large deltas on platforms that don't use the scalar ktime
> implementation.
In principle I see no problem with this. But as a matter of
practice it may be overkill.
How big does the delta have to be for this to be a problem?
And how much overhead does ktime_to_ns() add?
-- Tim
=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Corporation of America
=============================
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] init/main.c: Use ktime accessor function in initcall_debug code.
2008-11-20 17:39 ` Tim Bird
@ 2008-11-20 17:46 ` Will Newton
2008-11-20 18:28 ` Tim Bird
0 siblings, 1 reply; 4+ messages in thread
From: Will Newton @ 2008-11-20 17:46 UTC (permalink / raw)
To: Tim Bird; +Cc: linux-kernel, Andrew Morton
On Thu, Nov 20, 2008 at 5:39 PM, Tim Bird <tim.bird@am.sony.com> wrote:
> Will Newton wrote:
>> The initcall_debug code access the tv64 member of ktime. This won't work
>> correctly for large deltas on platforms that don't use the scalar ktime
>> implementation.
>
> In principle I see no problem with this. But as a matter of
> practice it may be overkill.
Possibly, but it makes the code clearer I think.
> How big does the delta have to be for this to be a problem?
> And how much overhead does ktime_to_ns() add?
Deltas over a second will be incorrect. I have serial8250_init taking
8 seconds at the moment, so that isn't unheard of.
On scalar ktime architectures it should be zero, on others a multiply
and an add (it's an inline). I wouldn't call it a fast path though.
> -- Tim
>
> =============================
> Tim Bird
> Architecture Group Chair, CE Linux Forum
> Senior Staff Engineer, Sony Corporation of America
> =============================
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] init/main.c: Use ktime accessor function in initcall_debug code.
2008-11-20 17:46 ` Will Newton
@ 2008-11-20 18:28 ` Tim Bird
0 siblings, 0 replies; 4+ messages in thread
From: Tim Bird @ 2008-11-20 18:28 UTC (permalink / raw)
To: Will Newton; +Cc: linux-kernel, Andrew Morton
Will Newton wrote:
> On Thu, Nov 20, 2008 at 5:39 PM, Tim Bird <tim.bird@am.sony.com> wrote:
>> Will Newton wrote:
>>> The initcall_debug code access the tv64 member of ktime. This won't work
>>> correctly for large deltas on platforms that don't use the scalar ktime
>>> implementation.
>> In principle I see no problem with this. But as a matter of
>> practice it may be overkill.
>
> Possibly, but it makes the code clearer I think.
>
>> How big does the delta have to be for this to be a problem?
>> And how much overhead does ktime_to_ns() add?
>
> Deltas over a second will be incorrect.
OK. Good fix, then.
> I have serial8250_init taking
> 8 seconds at the moment, so that isn't unheard of.
This is likely the result of the emission of all
previously queued printks which occurs during serial8250_init()
(as a side effect of finally initializing the console).
I see this kind of long delay all the time.
If the 8 seconds is a bother, you might want
to use 'quiet' on the kernel command line.
I suspect you've already seen this page, but for future
readers of this thread, there's info on this at:
http://elinux.org/Disable_Console
> On scalar ktime architectures it should be zero, on others a multiply
> and an add (it's an inline). I wouldn't call it a fast path though.
OK. You have my ACK.
-- Tim
=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Corporation of America
=============================
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-11-20 18:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-20 14:47 [PATCH] init/main.c: Use ktime accessor function in initcall_debug code Will Newton
2008-11-20 17:39 ` Tim Bird
2008-11-20 17:46 ` Will Newton
2008-11-20 18:28 ` Tim Bird
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox