All of lore.kernel.org
 help / color / mirror / Atom feed
* How to define CLOCK_TICK_RATE in linux kernel 2.6.xx?
@ 2010-08-24  9:20 David Yang
  2010-08-24 10:08 ` Eric Miao
  0 siblings, 1 reply; 5+ messages in thread
From: David Yang @ 2010-08-24  9:20 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* How to define CLOCK_TICK_RATE in linux kernel 2.6.xx?
  2010-08-24  9:20 How to define CLOCK_TICK_RATE in linux kernel 2.6.xx? David Yang
@ 2010-08-24 10:08 ` Eric Miao
  2010-08-24 13:21   ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Miao @ 2010-08-24 10:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Aug 24, 2010 at 5:20 PM, David Yang <david.yangshuai@gmail.com> wrote:
> 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.

> 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.

>
> 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?

It's basically not related to SMP.

>
> BTW, In kernel 2.6.x, CLOCK_TICK_RATE means ?
> Thank for any help

It was historically related to many things, including HZ, yet obsoleted
along with the introduction of clockevent/clocksource framework.

>
> David
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* How to define CLOCK_TICK_RATE in linux kernel 2.6.xx?
  2010-08-24 10:08 ` Eric Miao
@ 2010-08-24 13:21   ` Arnd Bergmann
  2010-08-24 13:53       ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2010-08-24 13:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 24 August 2010, Eric Miao wrote:
> On Tue, Aug 24, 2010 at 5:20 PM, David Yang <david.yangshuai@gmail.com> wrote:
> > 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] input: use PIT_TICK_RATE in vt beep ioctl
  2010-08-24 13:21   ` Arnd Bergmann
@ 2010-08-24 13:53       ` Arnd Bergmann
  0 siblings, 0 replies; 5+ messages in thread
From: Arnd Bergmann @ 2010-08-24 13:53 UTC (permalink / raw)
  To: linux-kernel, Greg KH, linux-input, Alan Cox, Dmitry Torokhov
  Cc: linux-arm-kernel, David Yang, Eric Miao, Emmanuel Colbus, Andrew Morton

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>

diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index cb19dbc..592d8d1 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -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;
 	}

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2] input: use PIT_TICK_RATE in vt beep ioctl
@ 2010-08-24 13:53       ` Arnd Bergmann
  0 siblings, 0 replies; 5+ messages in thread
From: Arnd Bergmann @ 2010-08-24 13:53 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>

diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index cb19dbc..592d8d1 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -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;
 	}

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-08-24 13:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-24  9:20 How to define CLOCK_TICK_RATE in linux kernel 2.6.xx? David Yang
2010-08-24 10:08 ` Eric Miao
2010-08-24 13:21   ` Arnd Bergmann
2010-08-24 13:53     ` [PATCH v2] input: use PIT_TICK_RATE in vt beep ioctl Arnd Bergmann
2010-08-24 13:53       ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.