clocksource_register_hz/khz cleanups
Subsystems (4)
PATCH 1/6 clocksource: Convert tcb_clksrc to use clocksource_register_hz/khz
In reply to John StultzConvert tcb_clksrc to use clocksource_register_hz.
Untested. Help from maintainers would be appreciated.
--- drivers/clocksource/tcb_clksrc.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/clocksource/tcb_clksrc.c +1 -3
@@ -59,7 +59,6 @@ static struct clocksource clksrc = { .rating = 200, .read = tc_get_cycles, .mask = CLOCKSOURCE_MASK(32), - .shift = 18, .flags = CLOCK_SOURCE_IS_CONTINUOUS, };
@@ -256,7 +255,6 @@ static int __init tcb_clksrc_init(void) best_divisor_idx = i; } - clksrc.mult =clocksource_hz2mult (divided_rate, clksrc.shift); printk(bootinfo, clksrc.name, CONFIG_ATMEL_TCB_CLKSRC_BLOCK, divided_rate / 1000000,
@@ -292,7 +290,7 @@ static int __init tcb_clksrc_init(void)__raw_writel (ATMEL_TC_SYNC , tcaddr +ATMEL_TC_BCR );/* and away we go! */ -clocksource_register (&clksrc); +clocksource_register_hz (&clksrc, divided_rate);/* channel 2: periodic and oneshot timer support */ setup_clkevents (tc, clk32k_divisor_idx);
Signature · 1 line
1.7.3.2.146.gca209
PATCH 3/6 clocksource: um: convert to clocksource_register_hz/khz
In reply to John StultzFrom: John Stultz <[email protected]>
This converts the um clocksource to use clocksource_register_hz/khz
This is untested, so any assistance in testing would be appreciated!
--- arch/um/kernel/time.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
arch/um/kernel/time.c +2 -4
@@ -75,8 +75,6 @@ static struct clocksource itimer_clocksource = { .rating = 300, .read = itimer_read, .mask = CLOCKSOURCE_MASK(64), - .mult = 1000, - .shift = 0, .flags = CLOCK_SOURCE_IS_CONTINUOUS, };
@@ -94,9 +92,9 @@ static void __init setup_itimer(void)clockevent_delta2ns (60 *HZ , &itimer_clockevent); itimer_clockevent.min_delta_ns =clockevent_delta2ns (1 , &itimer_clockevent); - err =clocksource_register (&itimer_clocksource); + err =clocksource_register_hz (&itimer_clocksource,USEC_PER_SEC );if (err) { -printk (KERN_ERR "clocksource_register returned %d\n" , err); +printk (KERN_ERR "clocksource_register_hz returned %d\n" , err);return ; }clockevents_register_device (&itimer_clockevent);
Signature · 1 line
1.7.3.2.146.gca209
cover clocksource_register_hz/khz cleanups
Here's the next batch of clocksource_register_hz/khz cleanups.
It would be really great if maintainers could pick these up, otherwise I'll likely push these through Thomas for 3.1.
thanks
-john
John Stultz (6):
clocksource: Convert tcb_clksrc to use clocksource_register_hz/khz
clocksource: parisc: convert to clocksource_register_hz/khz
clocksource: um: convert to clocksource_register_hz/khz
clocksource: xtensa: convert to clocksource_register_hz/khz
clocksource: cris: convert to clocksource_register_khz
clocksource: tile: convert to use clocksource_register_hz
arch/cris/arch-v32/kernel/time.c | 4 +--- arch/parisc/kernel/time.c | 6 +----- arch/tile/kernel/time.c | 5 +---- arch/um/kernel/time.c | 6 ++---- arch/xtensa/kernel/time.c | 13 +------------ drivers/clocksource/tcb_clksrc.c | 4 +--- 6 files changed, 7 insertions(+), 31 deletions(-)
Signature · 1 line
1.7.3.2.146.gca209
PATCH 5/6 clocksource: cris: convert to clocksource_register_khz
From: John Stultz <[email protected]>
This converts the cris architecture to use clocksource_register_khz
This is untested, so any help from maintainers would be appreciated.
--- arch/cris/arch-v32/kernel/time.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
arch/cris/arch-v32/kernel/time.c +1 -3
@@ -47,14 +47,12 @@ static struct clocksource cont_rotime = { .rating = 300, .read = read_cont_rotime, .mask = CLOCKSOURCE_MASK(32), - .shift = 10, .flags = CLOCK_SOURCE_IS_CONTINUOUS, };static int __init etrax_init_cont_rotime (void ) { - cont_rotime.mult =clocksource_khz2mult (100000 , cont_rotime.shift); -clocksource_register (&cont_rotime); +clocksource_register_khz (&cont_rotime,100000 );return 0 ; }arch_initcall (etrax_init_cont_rotime);
Signature · 1 line
1.7.3.2.146.gca209
PATCH 6/6 clocksource: tile: convert to use clocksource_register_hz
In reply to John StultzFrom: John Stultz <[email protected]>
Convert tile to use clocksource_register_hz.
Untested. Help from maintainers would be appreciated.
--- arch/tile/kernel/time.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
arch/tile/kernel/time.c +1 -4
@@ -78,7 +78,6 @@ static struct clocksource cycle_counter_cs = { .rating = 300, .read = clocksource_get_cycles, .mask = CLOCKSOURCE_MASK(64), - .shift = 22, /* typical value, e.g. x86 tsc uses this */ .flags = CLOCK_SOURCE_IS_CONTINUOUS, };
@@ -91,8 +90,6 @@ void __init setup_clock(void) cycles_per_sec =hv_sysconf (HV_SYSCONF_CPU_SPEED ); sched_clock_mult =clocksource_hz2mult (cycles_per_sec,SCHED_CLOCK_SHIFT ); - cycle_counter_cs.mult = -clocksource_hz2mult (cycles_per_sec, cycle_counter_cs.shift); }void __init calibrate_delay (void )
@@ -107,7 +104,7 @@ void __init calibrate_delay(void)void __init time_init (void ) {/* Initialize and register the clock source. */ -clocksource_register (&cycle_counter_cs); +clocksource_register_hz (&cycle_counter_cs, cycles_per_sec);/* Start up the tile-timer interrupt source on the boot cpu. */ setup_tile_timer ();
Signature · 1 line
1.7.3.2.146.gca209
PATCH 4/6 clocksource: xtensa: convert to clocksource_register_hz/khz
In reply to John StultzFrom: John Stultz <[email protected]>
This converts the xtensa clocksource to use clocksource_register_hz/khz
This is untested, so any assistance in testing would be appreciated!
--- arch/xtensa/kernel/time.c | 13 +------------ 1 files changed, 1 insertions(+), 12 deletions(-)
arch/xtensa/kernel/time.c +1 -12
@@ -41,14 +41,6 @@ static struct clocksource ccount_clocksource = { .rating = 200, .read = ccount_read, .mask = CLOCKSOURCE_MASK(32), -/* -* With a shift of 22 the lower limit of the cpu clock is -* 1MHz, where NSEC_PER_CCOUNT is 1000 or a bit less than -* 2^10: Since we have 32 bits and the multiplicator can -* already take up as much as 10 bits, this leaves us with -* remaining upper 22 bits. -*/ - .shift = 22, };static irqreturn_t timer_interrupt (int irq,void *dev_id);
@@ -66,10 +58,7 @@ void __init time_init(void)printk ("%d.%02d MHz\n" , (int )ccount_per_jiffy/(1000000 /HZ ), (int )(ccount_per_jiffy/(10000 /HZ ))%100 );#endif - ccount_clocksource.mult = -clocksource_hz2mult (CCOUNT_PER_JIFFY *HZ , - ccount_clocksource.shift); -clocksource_register (&ccount_clocksource); +clocksource_register_hz (&ccount_clocksource,CCOUNT_PER_JIFFY *HZ );/* Initialize the linux timer interrupt. */
Signature · 1 line
1.7.3.2.146.gca209
PATCH 2/6 clocksource: parisc: convert to clocksource_register_hz/khz
In reply to John StultzFrom: John Stultz <[email protected]>
This converts the parisc clocksources to use clocksource_register_hz/khz
This is untested, so any assistance in testing would be appreciated!
--- arch/parisc/kernel/time.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-)
arch/parisc/kernel/time.c +1 -5
@@ -198,8 +198,6 @@ static struct clocksource clocksource_cr16 = { .rating = 300, .read = read_cr16, .mask = CLOCKSOURCE_MASK(BITS_PER_LONG), - .mult = 0, /* to be set */ - .shift = 22, .flags = CLOCK_SOURCE_IS_CONTINUOUS, };
@@ -270,7 +268,5 @@ void __init time_init(void)/* register at clocksource framework */ current_cr16_khz =PAGE0 ->mem_10msec/10 ;/* kHz */ - clocksource_cr16.mult =clocksource_khz2mult (current_cr16_khz, - clocksource_cr16.shift); -clocksource_register (&clocksource_cr16); +clocksource_register_khz (&clocksource_cr16, current_cr16_khz); }
Signature · 1 line
1.7.3.2.146.gca209
Re: [PATCH 6/6] clocksource: tile: convert to use clocksource_register_hz
In reply to John StultzQuoted 7 lines · John Stultz
From: John Stultz <[email protected]>
Convert tile to use
clocksource_register_hz.Untested. Help from maintainers would be appreciated.
CC Chris Metcalf <[email protected]>
This patch boots up fine on tile. It provides a shift count of 31, with a mult value in the billions. This does mean that clocksource_cyc2ns() will only be able to give correct timer conversions for up to about 9 seconds. Is this believed to be adequate for all the uses the cycle counter is put to? I can run our normal regression tests, but I'd like to get a high-level sanity check from the clocksource folks.
The original shift of 22 was put in by commit 749dc6f252b57d5cb9c1f4c1c4aafe4c92a28207 back in August.
Quoted 36 lines
CC Thomas Gleixner <[email protected]>Signed-off-by John Stultz <[email protected]>--- arch/tile/kernel/time.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)arch/tile/kernel/time.c +1
-4@@ -78,7 +78,6 @@ static struct clocksource cycle_counter_cs = { .rating = 300, .read = clocksource_get_cycles, .mask = CLOCKSOURCE_MASK(64), - .shift = 22, /* typical value, e.g. x86 tsc uses this */ .flags = CLOCK_SOURCE_IS_CONTINUOUS, };@@ -91,8 +90,6 @@ void __init setup_clock(void) cycles_per_sec =hv_sysconf (HV_SYSCONF_CPU_SPEED ); sched_clock_mult =clocksource_hz2mult (cycles_per_sec,SCHED_CLOCK_SHIFT ); - cycle_counter_cs.mult = -clocksource_hz2mult (cycles_per_sec, cycle_counter_cs.shift); }void __init calibrate_delay (void )@@ -107,7 +104,7 @@ void __init calibrate_delay(void)void __init time_init (void ) {/* Initialize and register the clock source. */ -clocksource_register (&cycle_counter_cs); +clocksource_register_hz (&cycle_counter_cs, cycles_per_sec);/* Start up the tile-timer interrupt source on the boot cpu. */ setup_tile_timer ();
Signature · 2 lines
Chris Metcalf, Tilera Corp. http://www.tilera.com
Re: [PATCH 6/6] clocksource: tile: convert to use clocksource_register_hz
Quoted 7 lines · Chris Metcalf
Quoted 6 lines · John Stultz
From: John Stultz <[email protected]>
Convert tile to use
clocksource_register_hz.Untested. Help from maintainers would be appreciated.
Quoted 8 lines
Quoted 1 line
CC Chris Metcalf <[email protected]>This patch boots up fine on tile. It provides a shift count of 31, with a mult value in the billions. This does mean that
clocksource_cyc2ns()will only be able to give correct timer conversions for up to about 9 seconds. Is this believed to be adequate for all the uses the cycle counter is put to? I can run our normal regression tests, but I'd like to get a high-level sanity check from the clocksource folks.
I believe 9 seconds should be plenty for timekeeping, so I suspect it should be fine. Although I've not closely checked in this case if the tile clocksource is used for other purposes, so do let me know if you see any issues in your testing.
Additionally Thomas has a patch (which I thought already landed in 3.0-rc, but maybe not) which should pick a shift value that gets us close to 600 second intervals (hardware allowing), allowing for much longer NOHZ periods.
The important part is that we're centralizing this logic so it can be properly adjusted without having to tune 30-some clocksources individually.
Thanks for the testing and review!
-john
Chris Metcalf
AppliedRe: [PATCH 6/6] clocksource: tile: convert to use clocksource_register_hz
In reply to John StultzQuoted 4 lines · John Stultz
From: John Stultz <[email protected]>
Convert tile to use
clocksource_register_hz.
Quoted 8 lines
Untested. Help from maintainers would be appreciated.
CC Chris Metcalf <[email protected]>CC Thomas Gleixner <[email protected]>Signed-off-by John Stultz <[email protected]>--- arch/tile/kernel/time.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
Applied, thanks!
Signature · 2 lines
Chris Metcalf, Tilera Corp. http://www.tilera.com