freebsd-dev/sys/sparc64/include/tick.h
Marius Strobl 7bed9b320b - Add a workaround for a bug in BlackBird CPUs (said to be part of the
SpitFire erratum #54) which can cause writes to the TICK_CMPR register
  to fail. This seems to fix the dying clocks problem reported by jhb@
  and kris@. [1]
- In tick_start() don't reset the tick counter of the boot processor to
  zero. It's initially reset in _start() and afterwards but _before_
  tick_start() is called on the BSP the APs synchronise with the tick
  counter of the BSP in mp_startup(). Resetting the tick counter of the
  BSP in tick_start() probably also was the cause of problems seen when
  using the CPU tick counter as timecounter on SMP machines.
  Not resetting the tick counter of the BSP in mp_startup() makes the
  tick counters and tick interrupts between the BSP and APs be pretty
  much in sync as it's supposed to be. This also means there's no longer
  a real reason to have separate tick_start() and tick_start_ap() so
  merge them and zap tick_start_ap(). This is also a first step in
  simplifying the interface to the tick counters in preparation to use
  alternate clock hardware where available.
- Switch to the algorithm used on FreeBSD/ia64 for updating the tick
  interrupt register and which compensates the clock drift caused by
  varying delays between when the tick interrupts actually trigger and
  when they are serviced. Not compensating the clock drift mainly hurts
  interactive performance especially when using WITNESS. [2]
  For further information about the algorithm also see the commit log
  of sys/ia64/ia64/interrupt.c rev. 1.38.
  On sparc64 the sysctls for monitoring the behaviour of the tick
  interrupts are machdep.tick.adjust_edges, machdep.tick.adjust_excess,
  machdep.tick.adjust_missed and machdep.tick.adjust_ticks.
- In tick_init() just use tick_stop() for stopping the tick interrupts
  until a proper handler is set up later. This also stops the system
  tick interrupt on USIII systems earlier.
- In tick_start() check for a rough upper limit of HZ.
- Some minor changes, e.g. use FBSDID, remove unused headers, etc.

Info obtained from:	Linux [1]
Ok'ed by:		marcel [2]
Additional testing by:	kris (earlier version of the workaround), jhb
X-MFC after:		3 days [1]
2005-04-16 14:57:38 +00:00

37 lines
1.5 KiB
C

/*-
* Copyright (c) 2001 Jake Burkholder.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_TICK_H_
#define _MACHINE_TICK_H_
void tick_init(u_long clock);
void tick_start(void);
void tick_stop(void);
#endif