remove bogus CLOCK_TICK_RATE definitions
Subsystems (7)
Arnd Bergmann
maintainerRFC 1/1 remove bogus CLOCK_TICK_RATE definitions
After my previous patches to convert users of CLOCK_TICK_RATE to ARM_TICK_RATE or PIT_TICK_RATE, the only remaining user is ACT_HZ in linux/jiffies.h.
This makes the definition of CLOCK_TICK_RATE optional and removes it from all architectures that were using an incorrect definition.
avr32 and ia64 have values that are entirely fabricated in order to avoid having to define a correct rate.
frv, m68k, mips, mn10300, parisc, s390, sparc, sparc64 and xtensa were all using the PIT tick rate of 1193182 HZ despite normally not basing their timer tick off an i8253 timer. This was correct for most other uses in the kernel, but caused a slightly incorrect ACTHZ value, possibly leading to clock drift.
The remaining users seem to be correct in the sense that the CLOCK_TICK_RATE they define is in some way related to the actual interval timer they use for clock ticks:
alpha:#define CLOCK_TICK_RATE 32768
arm:#define CLOCK_TICK_RATE ARM_TICK_RATE
blackfin:#define CLOCK_TICK_RATE 1000000
cris/arch-v10:#define CLOCK_TICK_RATE 25000 cris/arch-v32:#define CLOCK_TICK_RATE 100000000 h8300:#define CLOCK_TICK_RATE (CONFIG_CPU_CLOCK*1000/8192) m32r:#define CLOCK_TICK_RATE (CONFIG_BUS_CLOCK / CONFIG_TIMER_DIVIDE)
powerpc:#define CLOCK_TICK_RATE 1024000
sh:#define CLOCK_TICK_RATE (CONFIG_SH_PCLK_FREQ / 4) um:#define CLOCK_TICK_RATE (HZ)
x86:#define CLOCK_TICK_RATE PIT_TICK_RATE
PowerPC actually has a number of different time base values per architecture, but maybe 1024000 is a common divisor for all of them. Blackfin looks fabricated, but could be correct.
On x86, there is a choice between various time sources, so using PIT_TICK_RATE may no longer be the best option.
--- include/linux/jiffies.h | 4 ++++ arch/avr32/include/asm/timex.h | 19 ------------------- arch/frv/include/asm/timex.h | 3 --- arch/ia64/include/asm/timex.h | 18 ------------------ arch/m32r/include/asm/timex.h | 1 - arch/m68k/include/asm/timex.h | 2 -- arch/mips/include/asm/timex.h | 8 -------- arch/mn10300/include/asm/timex.h | 3 --- arch/parisc/include/asm/timex.h | 2 -- arch/s390/include/asm/timex.h | 2 -- arch/sparc/include/asm/timex_32.h | 2 -- arch/sparc/include/asm/timex_64.h | 2 -- arch/xtensa/include/asm/timex.h | 3 --- 14 files changed, 6 insertions(+), 74 deletions(-)
include/linux/jiffies.h +4 -0
@@ -55,7 +55,11 @@ + ((((NOM) % (DEN)) << (LSH)) + (DEN) / 2) / (DEN))/* HZ is the requested value. ACTHZ is actual HZ ("<< 8" is for accuracy) */ +#ifdef CLOCK_TICK_RATE #define ACTHZ (SH_DIV (CLOCK_TICK_RATE, LATCH, 8)) +#else +#define ACTHZ (HZ << 8) +#endif /* TICK_NSEC is the time between ticks in nsec assuming real ACTHZ */ #define TICK_NSEC (SH_DIV (1000000UL * 1000, ACTHZ, 8))
arch/avr32/include/asm/timex.h +0 -19
@@ -8,25 +8,6 @@#ifndef __ASM_AVR32_TIMEX_H#define __ASM_AVR32_TIMEX_H -/* -* This is the frequency of the timer used for Linux's timer interrupt. -* The value should be defined as accurate as possible or under certain -* circumstances Linux timekeeping might become inaccurate or fail. -* -* For many system the exact clockrate of the timer isn't known but due to -* the way this value is used we can get away with a wrong value as long -* as this value is: -* -* - a multiple of HZ -* - a divisor of the actual rate -* -* 500000 is a good such cheat value. -* -* The obscure number 1193182 is the same as used by the original i8254 -* time in legacy PC hardware; the chip is never found in AVR32 systems. -*/ -#define CLOCK_TICK_RATE 500000/* Underlying HZ */ -typedef unsigned long cycles_t ;static inline cycles_t get_cycles (void )
arch/frv/include/asm/timex.h +0 -3
@@ -3,9 +3,6 @@#ifndef _ASM_TIMEX_H#define _ASM_TIMEX_H -#define CLOCK_TICK_RATE 1193180/* Underlying HZ */ -#define CLOCK_TICK_FACTOR 20/* Factor of both 1000000 and CLOCK_TICK_RATE */ -typedef unsigned long cycles_t ;static inline cycles_t get_cycles (void )
arch/ia64/include/asm/timex.h +0 -18
@@ -5,11 +5,6 @@* Copyright (C) 1998-2001, 2003 Hewlett-Packard Co * David Mosberger-Tang <[email protected]> */ -/* -* 2001/01/18 davidm Removed CLOCK_TICK_RATE. It makes no sense on IA-64. -* Also removed cacheflush_time as it's entirely unused. -*/ -#include <asm/intrinsics.h> #include <asm/processor.h>
@@ -17,19 +12,6 @@ typedef unsigned long cycles_t;extern void (*ia64_udelay)(unsigned long usecs); -/* -* For performance reasons, we don't want to define CLOCK_TICK_TRATE as -* local_cpu_data->itc_rate. Fortunately, we don't have to, either: according to George -* Anzinger, 1/CLOCK_TICK_RATE is taken as the resolution of the timer clock. The time -* calculation assumes that you will use enough of these so that your tick size <= 1/HZ. -* If the calculation shows that your CLOCK_TICK_RATE can not supply exactly 1/HZ ticks, -* the actual value is calculated and used to update the wall clock each jiffie. Setting -* the CLOCK_TICK_RATE to x*HZ insures that the calculation will find no errors. Hence we -* pick a multiple of HZ which gives us a (totally virtual) CLOCK_TICK_RATE of about -* 100MHz. -*/ -#define CLOCK_TICK_RATE (HZ * 100000UL) -static inline cycles_t get_cycles (void ) {
arch/m32r/include/asm/timex.h +0 -1
@@ -8,7 +8,6 @@*/ #define CLOCK_TICK_RATE (CONFIG_BUS_CLOCK / CONFIG_TIMER_DIVIDE) -#define CLOCK_TICK_FACTOR 20/* Factor of both 1000000 and CLOCK_TICK_RATE */ #ifdef __KERNEL__/*
arch/m68k/include/asm/timex.h +0 -2
@@ -6,8 +6,6 @@#ifndef _ASMm68k_TIMEX_H#define _ASMm68k_TIMEX_H -#define CLOCK_TICK_RATE 1193180/* Underlying HZ */ -typedef unsigned long cycles_t ;static inline cycles_t get_cycles (void )
arch/mips/include/asm/timex.h +0 -8
@@ -13,14 +13,6 @@#include <asm/mipsregs.h> /* -* This is the clock rate of the i8253 PIT. A MIPS system may not have -* a PIT by the symbol is used all over the kernel including some APIs. -* So keeping it defined to the number for the PIT is the only sane thing -* for now. -*/ -#define CLOCK_TICK_RATE 1193182 - -/* * Standard way to access the cycle counter. * Currently only used on SMP for scheduling. *
arch/mn10300/include/asm/timex.h +0 -3
@@ -16,9 +16,6 @@#define TICK_SIZE (tick_nsec / 1000) -#define CLOCK_TICK_RATE 1193180/* Underlying HZ - this should probably be set -* to something appropriate, but what? */ -extern cycles_t cacheflush_time;#ifdef __KERNEL__
arch/parisc/include/asm/timex.h +0 -2
@@ -8,8 +8,6 @@#include <asm/system.h> -#define CLOCK_TICK_RATE 1193180/* Underlying HZ */ -typedef unsigned long cycles_t ;static inline cycles_t get_cycles (void )
arch/s390/include/asm/timex.h +0 -2
@@ -49,8 +49,6 @@ static inline void store_clock_comparator(__u64 *time) asmvolatile ("stckc 0(%1)" :"=m" (*time) :"a" (time)); } -#define CLOCK_TICK_RATE 1193180/* Underlying HZ */ -typedef unsigned long long cycles_t ;static inline unsigned long long get_clock (void )
arch/sparc/include/asm/timex_32.h +0 -2
@@ -6,8 +6,6 @@#ifndef _ASMsparc_TIMEX_H#define _ASMsparc_TIMEX_H -#define CLOCK_TICK_RATE 1193180/* Underlying HZ */ -/* XXX Maybe do something better at some point... -DaveM */ typedef unsigned long cycles_t ;#define get_cycles () (0)
arch/sparc/include/asm/timex_64.h +0 -2
@@ -8,8 +8,6 @@#include <asm/timer.h> -#define CLOCK_TICK_RATE 1193180/* Underlying HZ */ -/* Getting on the cycle counter on sparc64. */ typedef unsigned long cycles_t ;#define get_cycles () tick_ops->get_tick()
arch/xtensa/include/asm/timex.h +0 -3
@@ -34,9 +34,6 @@#define LINUX_TIMER_MASK (1L << LINUX_TIMER_INT) -#define CLOCK_TICK_RATE 1193180/* (everyone is using this value) */ -#define CLOCK_TICK_FACTOR 20/* Factor of both 10^6 and CLOCK_TICK_RATE */ -#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT extern unsigned long ccount_per_jiffy;extern unsigned long ccount_nsec;
Signature · 1 line
1.5.6.3
Quoted 3 lines · Arnd Bergmann
PowerPC actually has a number of different time base values per architecture, but maybe 1024000 is a common divisor for all of them.
It was more that 1024000 is a multiple of all the common HZ values.
Paul.
Arnd Bergmann
maintainerQuoted 7 lines · Paul Mackerras
Quoted 3 lines · Arnd Bergmann
PowerPC actually has a number of different time base values per architecture, but maybe 1024000 is a common divisor for all of them.
It was more that 1024000 is a multiple of all the common HZ values.
I guess in that case powerpc falls into the same category as ia64, i.e. it makes up a value to keep ACT_HZ from being harmful, rather than using ACT_HZ for something helpful.
We should consequently drop the powerpc definition along with the other bogus ones. This will also help the theoretical CONFIG_HZ=300 case.
Arnd <><