How to define CLOCK_TICK_RATE in linux kernel 2.6.xx?
Subsystems (2)
Hello all,
We have recently started to port linux 2.6.33 to a arm machine which be cortex-a9 mpcore, and we found that need define CLOCK_TICK_RATE (arch/arm/mach_xxx/include/mach/timex.h) to a value.
Now our arm machine have two timer, first is external general timer which clock is 66.666666MHz, second is cortex-a9's private timer which clock is 400MHz or 800Hz.
If our linux system support smp, we should how define CLOCK_TICK_RATE? If our linux system don't support smp, we should how define CLOCK_TICK_RATE?
BTW, In kernel 2.6.x, CLOCK_TICK_RATE means ?
Thank for any help
David
Quoted 6 lines · David Yang
Hello all,
We have recently started to port linux 2.6.33 to a arm machine which be cortex-a9 mpcore, and we found that need define
CLOCK_TICK_RATE(arch/arm/mach_xxx/include/mach/timex.h) to a value.
It's obsoleted. Give it a fake value and go.
Quoted 3 lines
Now our arm machine have two timer, first is external general timer which clock is 66.666666MHz, second is cortex-a9's private timer which clock is 400MHz or 800Hz.
The tick rate used by your OS timer is probably a good fake value.
Quoted 4 lines
If our linux system support smp, we should how define
CLOCK_TICK_RATE? If our linux system don't support smp, we should how defineCLOCK_TICK_RATE?
It's basically not related to SMP.
Quoted 3 lines
BTW, In kernel 2.6.x,
CLOCK_TICK_RATEmeans ?
Thank for any help
It was historically related to many things, including HZ, yet obsoleted along with the introduction of clockevent/clocksource framework.
Quoted 8 lines
David
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Arnd Bergmann
maintainerQuoted 9 lines · Eric Miao
Quoted 6 lines · David Yang
Hello all,
We have recently started to port linux 2.6.33 to a arm machine which be cortex-a9 mpcore, and we found that need define
CLOCK_TICK_RATE(arch/arm/mach_xxx/include/mach/timex.h) to a value.It's obsoleted. Give it a fake value and go.
I would call it *almost* obsolete. Platforms that don't have their own clocksource implementation still use it for calculating the exact value of their time slices, and the console beep in the TTY layer defines its pitch through this frequency.
The latter is of course a bug, it should use 1193182 Hz, independent of CLOCK_TICK_RATE, since the frequency is now unfortunately part of the ABI.
Arnd
Arnd Bergmann
maintainerPATCH v2 1/1 input: use PIT_TICK_RATE in vt beep ioctl
The KIOCSOUND and KDMKTONE ioctls are based on the CLOCK_TICK_RATE, which is architecture and sometimes configuration specific.
In practice, most user applications assume that it is actually defined as the i8253 PIT base clock of 1193182 Hz, which is true on some architectures but not on others.
This patch makes the vt code use the PIT frequency on all architectures, which is much more well-defined. It will change the behavior of user applications sending the beep ioctl on all architectures that define CLOCK_TICK_RATE different from PIT_TICK_RATE.
The original breakage was introduced in commit bcc8ca099 "Adapt drivers/char/vt_ioctl.c to non-x86". Hopefully, reverting this change will make the frequency correct in more cases than it will make it incorrect.
drivers/char/vt_ioctl.c +8 -8
@@ -533,11 +533,14 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,case KIOCSOUND :if (!perm) goto eperm; -/* FIXME: This is an old broken API but we need to keep it -supported and somehow separate the historic advertised -tick rate from any real one */ +/* +* The use of PIT_TICK_RATE is historic, it used to be +* the platform-dependent CLOCK_TICK_RATE between 2.6.12 +* and 2.6.36, which was a minor but unfortunate ABI +* change. +*/ if (arg) - arg =CLOCK_TICK_RATE / arg; + arg =PIT_TICK_RATE / arg;kd_mksound (arg,0 );break ;
@@ -553,11 +556,8 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,*/ ticks =HZ * ((arg >>16 ) &0xffff ) /1000 ; count = ticks ? (arg &0xffff ) :0 ; -/* FIXME: This is an old broken API but we need to keep it -supported and somehow separate the historic advertised -tick rate from any real one */ if (count) - count =CLOCK_TICK_RATE / count; + count =PIT_TICK_RATE / count;kd_mksound (count, ticks);break ; }