Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Re: Alpha Timekeeping - Hardware Questions
@ 1999-05-14  9:48 Bruce Elliott
  1999-05-14 10:56 ` Matti Aarnio
  1999-05-14 18:41 ` Richard Henderson
  0 siblings, 2 replies; 15+ messages in thread
From: Bruce Elliott @ 1999-05-14  9:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-alpha, axp-list, Jay.Estabrook, davem, rth, tomh

On May 14, 12:15am, Jay.Estabrook@digital.com wrote:
> 
> >>> "David S. Miller" said:
> >    Date: 	Thu, 13 May 1999 09:16:56 -0700
> >    From: Richard Henderson <rth@cygnus.com>
> > 
> >    I have no definitive answer, but I would strongly suspect we cannot
> >    rely on tick mechanisms with SMP.
> > 
> > Unless Alpha's support different clock rate cpus mixed into a single
> > machine, you can use something like Ingo's tick calibration code at
> > boot time to make sure all cpu's have synchronized tick values.
> 
> I don't believe that any of our boxes support CPUs at different clocks
> at the same time... ;-}
> 
> But that's a good idea, WRT those patches, as I have been seeing one
> effect of routing all interrupts to CPU #0: its tick-count (IRQ #8)
> lags behind the counts in the other CPUs... :-\

[ ... ]

I'm sorry to keep harping on this, but I still don't know the answer to
the original main question.

In late November I submitted a patch to arch/alpha/kernel/time.c to fix
some obvious problems and to try to stabilize timekeeping.  A non-obvious
consequence of this patch was that timekeeping was now based on the
cycle counter, instead of the RTC or PIT.  The RTC/PIT was still used as
a "wakeup", but not as the actual basis for kernel jiffies.

This patch was added to the kernel, but I missed it when scanning the
patch files, so I assumed it had been rejected.  In the meantime I found
some cases I had overlooked (mostly in settimeofday()) and updated my
local patches to fix these.

At the end of December I rechecked and discovered that the original patch
had been accepted, so I submitted the second fix with a note that perhaps
it should wait until 2.3, as I thought 2.3 was imminent.

The second patch was rejected, leaving timekeeping still broken, although
perhaps not quite as badly as it had been.

Around the beginning of March I had correspondence with another Alpha user
who was quite dissatisfied with the timekeeping.  The main symptom was
that time-of-day sometimes jumped backward.  After much email I found
most of the remaining problems.  I submitted another patch but included
the suggestion/request that the original patch be backed-out, as by then
I had read the claim that SMP Alpha CPUs have unsynchronized clocks.

This patch was also rejected or perhaps missed, as I sent it only to the
list in hope of clarification from someone.

Around the end of April someone else (Thorsten Kranzkowski) submitted a
patch fixing part of the lost-tick accounting, which was in patch three.
Someone else referred Thorsten to my earlier message, and he resubmitted
that patch with some changes.

The point of this long harangue is that Alpha kernels currently use the
cycle counter for timekeeping.  If SMP Alpha clocks are unsynchronized,
this is a Bad Thing.  Please note that "unsynchronized" refers to the
frequencies, and not phase differences.  To restate this, as there may be
some confusion, a frequency difference implies that the offsets between
different CPU cycle counters *change* over time.  For example, a frequency
difference of one part-per-million would cause a drift of one jiffy in
about fifteen minutes.

The only way frequency differences can be avoided is to use a common
clock source across CPUs.  This could either be the actual clock used as
input to the CPU, or it could be a slower clock that is phase-locked to
the CPU input clock.

So the question remains: Do SMP Alpha CPUs have synchronized input clocks?

If they are not sychronized, this code must be replaced with something
else.

If they are synchronized, SMP timekeeping can be fixed by either resetting
the cycle counters via PalCode at boot time, or by measuring the offsets
at boot time.

Assuming synchronized clocks, the pros and cons for using the cycle counter
appear (to me) to be:

Con:

The underlying clock may be less stable than the RTC or PIT.  Assuming
synchronized CPU clocks, I would expect the PIT to be derived from the
same source.

Pro:

The cycle counter provides two orders-of-magnitude better resolution than
the PIT.  The PIT counter can be accessed, giving about one microsecond
resolution.

The cycle counter provides five orders-of-magnitude better resolution than
the RTC.  The RTC offers no resolution beyond the fact that an interrupt
occurred.

-- 
B. D. Elliott   bde@nwlink.com   (Seattle)


^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: Alpha Timekeeping - Hardware Questions
@ 1999-05-17  6:28 Bruce Elliott
  0 siblings, 0 replies; 15+ messages in thread
From: Bruce Elliott @ 1999-05-17  6:28 UTC (permalink / raw)
  To: linux-kernel, linux-alpha, axp-list
  Cc: davem, rth, Jay.Estabrook, tomh, jwl, colin

I received a reply from Colin Plumb <colin@alumni.cs.colorado.edu>, that
included the following:

> ...  *many* alpha SMP systems have independent oscillators for each
> CPU.  Dave "Mr. NTP" Mills has some example Digital Unix kernel patches
> that synchronize each CPU independently.
>
> ...
> 
> They may have changed on recent Alphas, but in the old ones, each
> processor has its own ... clock oscillator.  ...

Since Mr. Plumb has been active in the NTP community, I accept his word
on this.

If anyone knows for certain that recent systems do synchronize the CPU
clocks, it would be useful to note that in these mailing lists, so that
future development might take advantage of it.

Since I don't have access to an MP Alpha, I can't contribute further in
this area.  I would like to thank everyone who has taken time to try to
resolve this.

-- 
B. D. Elliott   bde@nwlink.com   (Seattle)


^ permalink raw reply	[flat|nested] 15+ messages in thread
* RE: Alpha Timekeeping - Hardware Questions
@ 1999-05-15  1:14 James Livingston
  1999-05-15  2:45 ` Jay.Estabrook
  0 siblings, 1 reply; 15+ messages in thread
From: James Livingston @ 1999-05-15  1:14 UTC (permalink / raw)
  To: 'axp-list@redhat.com'

Bruce,

See my comment below.  There have been a number of different SMP
implementations, starting with the AlphaServer 2100 4/200, but I don't
believe there have been any that didn't use a common system clock
signal.


Cheers,
jwl

-----Original Message-----
From: Bruce Elliott [mailto:bde@nwlink.com]
Sent: Friday, May 14, 1999 2:49 AM
To: linux-kernel@vger.rutgers.edu
Cc: recipient list not shown
Subject: Re: Alpha Timekeeping - Hardware Questions


On May 14, 12:15am, Jay.Estabrook@digital.com wrote:
> 
> >>> "David S. Miller" said:
> >    Date: 	Thu, 13 May 1999 09:16:56 -0700
> >    From: Richard Henderson <rth@cygnus.com>
> > 
> >    I have no definitive answer, but I would strongly suspect we
cannot
> >    rely on tick mechanisms with SMP.
> > 
> > Unless Alpha's support different clock rate cpus mixed into a single
> > machine, you can use something like Ingo's tick calibration code at
> > boot time to make sure all cpu's have synchronized tick values.
> 
> I don't believe that any of our boxes support CPUs at different clocks
> at the same time... ;-}
> 
> But that's a good idea, WRT those patches, as I have been seeing one
> effect of routing all interrupts to CPU #0: its tick-count (IRQ #8)
> lags behind the counts in the other CPUs... :-\

[ ... ]

[ ... ]

The only way frequency differences can be avoided is to use a common
clock source across CPUs.  This could either be the actual clock used as
input to the CPU, or it could be a slower clock that is phase-locked to
the CPU input clock.

So the question remains: Do SMP Alpha CPUs have synchronized input
clocks?

	[jwl] Yes, they do.  The general pattern is to propagate a
single 	system clock frequency onto the CPU modules, where it's
recreated via 	PLL to drive the Alpha CPU on the module.  I hope this
is specific 	enough for your purposes.

[ ... ]

-- 
B. D. Elliott   bde@nwlink.com   (Seattle)

-- 
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com


^ permalink raw reply	[flat|nested] 15+ messages in thread
* RE: Alpha Timekeeping - Hardware Questions
@ 1999-05-13 18:03 James Livingston
  0 siblings, 0 replies; 15+ messages in thread
From: James Livingston @ 1999-05-13 18:03 UTC (permalink / raw)
  To: 'axp-list@redhat.com'

Most Alpha platforms, including SMP systems, have both CPU cycle
counters and free-running clocks, including TOY clocks and the
8254-compatible timers found in most (E)ISA bridges.  Which clock is
used for what purpose is the choice of the kernel implementers, I
expect.

Cheers,
jwl

James W. Livingston, Jr.  - Alpha NT Servers Group
COMPAQ Computer Corporation, DEQwest Engineering  
14475 NE 24th Street,  Bellevue, Washington  98007-3740
Email: jwl@zso.dec.com  *  Tel: (425) 865-8792  
Fax: (425) 865-8890  *  DTN: 548-8792

-----Original Message-----
From: Bruce Elliott [mailto:bde@nwlink.com]
Sent: Thursday, May 13, 1999 3:07 AM
To: linux-kernel@vger.rutgers.edu
Cc: recipient list not shown
Subject: Alpha Timekeeping - Hardware Questions


On May 12,  2:01pm, Tom Holroyd wrote:
} Subject: 2.2.8 gettimeofday() still doesn't work on Alpha
} Just booted 2.2.8 on my PC164 and the timetest program (included
below)
} produces negative deltas with high frequency.

[ ... ]

I believe that I have read that (some) SMP Alphas have independent CPU
clocks (i.e. the oscillators that drive the "cycle counters").  Is this
true?  If so, any cycle-counter-based timekeeping will be difficult, as
it requires drift-correction (something like ntp) at timer interrupt
level.

If only some Alphas have separate CPU clocks, are these older models?

For recent and current Alphas, is it true that the various clocks (PIT,
RT, CYCLES) are separate, or are they (or a subset) derived (pll?) from
a common source?

I am sending this to several lists and individuals.  I would appreciate
that any definitive answers or references either be sent to the linux-
kernel list, or to me for forwarding to the list.

-- 
B. D. Elliott   bde@nwlink.com   (Seattle)

-- 
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com


^ permalink raw reply	[flat|nested] 15+ messages in thread
* Alpha Timekeeping - Hardware Questions
@ 1999-05-13 10:07 Bruce Elliott
  1999-05-13 22:23 ` Richard Henderson
       [not found] ` <19990513091656.A28220@cygnus.com>
  0 siblings, 2 replies; 15+ messages in thread
From: Bruce Elliott @ 1999-05-13 10:07 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-alpha, axp-list, tomh, rth, Jay.Estabrook

On May 12,  2:01pm, Tom Holroyd wrote:
} Subject: 2.2.8 gettimeofday() still doesn't work on Alpha
} Just booted 2.2.8 on my PC164 and the timetest program (included below)
} produces negative deltas with high frequency.

[ ... ]

I believe that I have read that (some) SMP Alphas have independent CPU
clocks (i.e. the oscillators that drive the "cycle counters").  Is this
true?  If so, any cycle-counter-based timekeeping will be difficult, as
it requires drift-correction (something like ntp) at timer interrupt
level.

If only some Alphas have separate CPU clocks, are these older models?

For recent and current Alphas, is it true that the various clocks (PIT,
RT, CYCLES) are separate, or are they (or a subset) derived (pll?) from
a common source?

I am sending this to several lists and individuals.  I would appreciate
that any definitive answers or references either be sent to the linux-
kernel list, or to me for forwarding to the list.

-- 
B. D. Elliott   bde@nwlink.com   (Seattle)


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

end of thread, other threads:[~1999-05-17 11:33 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-05-14  9:48 Alpha Timekeeping - Hardware Questions Bruce Elliott
1999-05-14 10:56 ` Matti Aarnio
1999-05-14 12:48   ` Uncle George
1999-05-16 19:23   ` Chris Wedgwood
1999-05-16 20:05     ` Jeff DeMaagd
1999-05-14 18:41 ` Richard Henderson
1999-05-14 20:05   ` Where to find libraries Peter Howell Jr
1999-05-17 10:55     ` Albrecht Jacobs
  -- strict thread matches above, loose matches on Subject: below --
1999-05-17  6:28 Alpha Timekeeping - Hardware Questions Bruce Elliott
1999-05-15  1:14 James Livingston
1999-05-15  2:45 ` Jay.Estabrook
1999-05-13 18:03 James Livingston
1999-05-13 10:07 Bruce Elliott
1999-05-13 22:23 ` Richard Henderson
     [not found] ` <19990513091656.A28220@cygnus.com>
1999-05-14  9:50   ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox