diff options
author | Christian Borntraeger <borntraeger@de.ibm.com> | 2008-11-27 05:05:56 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2008-11-27 05:06:57 -0500 |
commit | 8107d8296baff899db89c1716fe8af69a5b19d18 (patch) | |
tree | 0babc3276a83c75d3f51f868149c468b34331cc4 /arch/s390 | |
parent | 59da21398e680e8100625d689c8bebee6a139e93 (diff) |
[S390] fix/cleanup sched_clock
CONFIG_PRINTK_TIME reveals that sched_clock has a wrong offset during boot:
..
[ 0.000000] Movable zone: 0 pages used for memmap
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 775679
[ 0.000000] Kernel command line: dasd=4b6c root=/dev/dasda1 ro noinitrd
[ 0.000000] PID hash table entries: 4096 (order: 12, 32768 bytes)
[6920575.975232] console [ttyS0] enabled
[6920575.987586] Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes)
[6920575.991404] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes)
..
The s390 implementation of sched_clock uses the store clock instruction and
subtracts jiffies_timer_cc.
jiffies_timer_cc is a local variable in arch/s390/kernel/time.c and only used
for sched_clock and monotonic clock. For historical reasons there is an offset
on that value. With todays code this offset is unnecessary. By removing that
offset we can get a sched_clock which returns the nanoseconds after time_init.
This improves CONFIG_PRINTK_TIME.
Since sched_clock is the only user, I have also renamed jiffies_timer_cc to
sched_clock_base_cc. In addition, the local variable init_timer_cc is redundant
and can be romved as well.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/kernel/time.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c index b94e9e3b694a..eccefbbff887 100644 --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c | |||
@@ -59,7 +59,7 @@ | |||
59 | 59 | ||
60 | static ext_int_info_t ext_int_info_cc; | 60 | static ext_int_info_t ext_int_info_cc; |
61 | static ext_int_info_t ext_int_etr_cc; | 61 | static ext_int_info_t ext_int_etr_cc; |
62 | static u64 jiffies_timer_cc; | 62 | static u64 sched_clock_base_cc; |
63 | 63 | ||
64 | static DEFINE_PER_CPU(struct clock_event_device, comparators); | 64 | static DEFINE_PER_CPU(struct clock_event_device, comparators); |
65 | 65 | ||
@@ -68,7 +68,7 @@ static DEFINE_PER_CPU(struct clock_event_device, comparators); | |||
68 | */ | 68 | */ |
69 | unsigned long long sched_clock(void) | 69 | unsigned long long sched_clock(void) |
70 | { | 70 | { |
71 | return ((get_clock_xt() - jiffies_timer_cc) * 125) >> 9; | 71 | return ((get_clock_xt() - sched_clock_base_cc) * 125) >> 9; |
72 | } | 72 | } |
73 | 73 | ||
74 | /* | 74 | /* |
@@ -229,13 +229,10 @@ static struct clocksource clocksource_tod = { | |||
229 | */ | 229 | */ |
230 | void __init time_init(void) | 230 | void __init time_init(void) |
231 | { | 231 | { |
232 | u64 init_timer_cc; | 232 | sched_clock_base_cc = reset_tod_clock(); |
233 | |||
234 | init_timer_cc = reset_tod_clock(); | ||
235 | jiffies_timer_cc = init_timer_cc - jiffies_64 * CLK_TICKS_PER_JIFFY; | ||
236 | 233 | ||
237 | /* set xtime */ | 234 | /* set xtime */ |
238 | tod_to_timeval(init_timer_cc - TOD_UNIX_EPOCH, &xtime); | 235 | tod_to_timeval(sched_clock_base_cc - TOD_UNIX_EPOCH, &xtime); |
239 | set_normalized_timespec(&wall_to_monotonic, | 236 | set_normalized_timespec(&wall_to_monotonic, |
240 | -xtime.tv_sec, -xtime.tv_nsec); | 237 | -xtime.tv_sec, -xtime.tv_nsec); |
241 | 238 | ||
@@ -289,7 +286,7 @@ static unsigned long long adjust_time(unsigned long long old, | |||
289 | delta = -delta; | 286 | delta = -delta; |
290 | adjust.offset = -ticks * (1000000 / HZ); | 287 | adjust.offset = -ticks * (1000000 / HZ); |
291 | } | 288 | } |
292 | jiffies_timer_cc += delta; | 289 | sched_clock_base_cc += delta; |
293 | if (adjust.offset != 0) { | 290 | if (adjust.offset != 0) { |
294 | printk(KERN_NOTICE "etr: time adjusted by %li micro-seconds\n", | 291 | printk(KERN_NOTICE "etr: time adjusted by %li micro-seconds\n", |
295 | adjust.offset); | 292 | adjust.offset); |