Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Aug 2001 23:04:06 +0200
From:      Tor.Egge@fast.no
To:        bde@zeta.org.au
Cc:        jhb@FreeBSD.ORG, freebsd-smp@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG, Patrick.Guelat@imp.ch, phk@FreeBSD.ORG, drussell@saturn-tech.com, roberto@eurocontrol.fr, atrn@zeta.org.au, sthaug@nethelp.no, kpielorz@tdx.co.uk, bkarp@icsi.berkeley.edu, mb@imp.ch
Subject:   Re: Clock speedup on 4.X FreeBSD SMP and serverworks chipset
Message-ID:  <200108312104.XAA38602@midten.fast.no>
In-Reply-To: Your message of "Sat, 1 Sep 2001 05:52:26 %2B1000 (EST)"
References:  <20010901053233.W5355-100000@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> I remember this a bit better after reading my log message for rev.1.134
> of clock.c :-).
> 
> At the time, the clock interrupt handler was not fast.  However, it
> could be delayed for a while by a fast interrupt handler (it still
> can).  Since it is delayed, it can't set clkintr_pending and we have
> to rely on the irr overflow test working for longer.  Rev.1.134 only
> claims to work for the non-SMP case.  The irr test apparently never
> worked for SMP.  Otherwise, it might be preferable to use the irr
> overflow check instead of or as a backup to clkintr_pending, but it
> can't be, since the irr bit is cleared when the irq is acked.  This
> behaviour also gives races for SMP: the irr bit may become invalid
> while you're looking it when another CPU acks the irq.

You need to check the irr and isr bit in the local apic on all CPUs
after checking the delivery status bit in the IOAPIC.

> Making the clock interrupt handler fast doesn't significantly change
> the problems as far as I can see.

Fast interrupts aren't blocked by Giant.

As long as you need to hold clock_lock in order to set clkintr_pending
without introducing time drift, you might as well step the clock while
holding clock_lock.  Deferring that work to clkintr() increases the
latency from about 11 to 20 instructions before trying to obtain
clock_lock.

One way to solve this might be to always use the 8259 for i8254
interrupt delivery whenever possible and use (inb(IO_ICU1) & 1) in
i8254_get_timecount when checking for a pending i8254 interrupt.  The
8259 should not be programmed for auto-EOI since the EOI should be
explicitly sent after setting clkintr_pending or stepping the clock.

- Tor Egge

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-smp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200108312104.XAA38602>