Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fc9069fe56d9594b7a6da0b9f9ca0eafd756260f
Commit:     fc9069fe56d9594b7a6da0b9f9ca0eafd756260f
Parent:     4bb092811c72685f5ba26340d393c0717f5a43b1
Author:     Tony Breeds <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 4 14:04:31 2007 +1000
Committer:  Paul Mackerras <[EMAIL PROTECTED]>
CommitDate: Tue Jul 10 22:00:54 2007 +1000

    [POWERPC] Modify sched_clock() to make CONFIG_PRINTK_TIME more sane
    
    When booting a current kernel with CONFIG_PRINTK_TIME enabled you'll
    see messages like:
    
    [    0.000000] time_init: decrementer frequency = 188.044000 MHz
    [    0.000000] time_init: processor frequency   = 1504.352000 MHz
    [3712914.436297] Console: colour dummy device 80x25
    
    This cause by the initialisation of tb_to_ns_scale in time_init(), suddenly 
the
    multiplication in sched_clock() now does something :).  This patch modifies
    sched_clock() to report the offset since the machine booted so the same
    printk's now look like:
    
    [    0.000000] time_init: decrementer frequency = 188.044000 MHz
    [    0.000000] time_init: processor frequency   = 1504.352000 MHz
    [    0.000135] Console: colour dummy device 80x25
    
    Effectivly including the uptime in printk()s.
    
    This patch makes tb_to_ns_scale and tb_to_ns_shift static and
    read_mostly for good measure.
    
    Signed-off-by: Tony Breeds <[EMAIL PROTECTED]>
    Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/time.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 66d2db7..e5df167 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -112,8 +112,9 @@ u64 ticklen_to_xs;  /* 0.64 fraction */
 DEFINE_SPINLOCK(rtc_lock);
 EXPORT_SYMBOL_GPL(rtc_lock);
 
-u64 tb_to_ns_scale;
-unsigned tb_to_ns_shift;
+static u64 tb_to_ns_scale __read_mostly;
+static unsigned tb_to_ns_shift __read_mostly;
+static unsigned long boot_tb __read_mostly;
 
 struct gettimeofday_struct do_gtod;
 
@@ -755,7 +756,7 @@ unsigned long long sched_clock(void)
 {
        if (__USE_RTC())
                return get_rtc();
-       return mulhdu(get_tb(), tb_to_ns_scale) << tb_to_ns_shift;
+       return mulhdu(get_tb() - boot_tb, tb_to_ns_scale) << tb_to_ns_shift;
 }
 
 int do_settimeofday(struct timespec *tv)
@@ -974,6 +975,8 @@ void __init time_init(void)
        }
        tb_to_ns_scale = scale;
        tb_to_ns_shift = shift;
+       /* Save the current timebase to pretty up CONFIG_PRINTK_TIME */
+       boot_tb = get_tb();
 
        tm = get_boot_time();
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to