From owner-freebsd-arch Thu Jan 3 12:25:14 2002 Delivered-To: freebsd-arch@freebsd.org Received: from netau1.alcanet.com.au (ntp.alcanet.com.au [203.62.196.27]) by hub.freebsd.org (Postfix) with ESMTP id 673BC37B41B; Thu, 3 Jan 2002 12:25:05 -0800 (PST) Received: from mfg1.cim.alcatel.com.au (mfg1.cim.alcatel.com.au [139.188.23.1]) by netau1.alcanet.com.au (8.9.3 (PHNE_22672)/8.9.3) with ESMTP id HAA05408; Fri, 4 Jan 2002 07:24:51 +1100 (EDT) Received: from gsmx07.alcatel.com.au by cim.alcatel.com.au (PMDF V5.2-32 #37641) with ESMTP id <01KCNYAYNN4WVFLXOA@cim.alcatel.com.au>; Fri, 4 Jan 2002 07:23:57 +1100 Received: (from jeremyp@localhost) by gsmx07.alcatel.com.au (8.11.6/8.11.6) id g03KOnn80856; Fri, 04 Jan 2002 07:24:49 +1100 Content-return: prohibited Date: Fri, 04 Jan 2002 07:24:48 +1100 From: Peter Jeremy Subject: Re: SMPng: Interrupt Latency Issues In-reply-to: <683.1010049413@critter.freebsd.dk>; from phk@critter.freebsd.dk on Thu, Jan 03, 2002 at 10:16:53AM +0100 To: Poul-Henning Kamp Cc: freebsd-arch@FreeBSD.ORG, freebsd-smp@FreeBSD.ORG Mail-Followup-To: Poul-Henning Kamp , freebsd-arch@FreeBSD.ORG, freebsd-smp@FreeBSD.ORG Message-id: <20020104072448.I561@gsmx07.alcatel.com.au> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 2002-Jan-03 10:16:53 +0100, Poul-Henning Kamp wrote: >There are basically two things to getting good interrupt latency: > > 1. An architecture making it possible. ... >I think we are on track to #1. Does this mean FreeBSD is dropping support for PC-compatible hardware? :-) (For that matter, PALcode also worsens interrupt latency on the Alpha). >My main contribution will probably be in trying to establish a >metrology to document the result, but to the extent time allows I >will participate and help where I can. This needs to be cross-platform. We also need a way for developers to measure (at least approximately) interrupt latency without needing USD1K timer boards - otherwise they can't assess the impact of any changes they make without involving you. For example, if you're using an i8254 as the master clock, you can get a reasonable estimate of interrupt latency by reading the i8254 counter at the start of hardclock(). This has a (fixed) overhead of a couple of usec, a resolution of ~840nsec and can only measure clock interrupt latency in specific (though common) configurations. A more general approach approach is to read the TSC as early as possible in the interrupt process and then again at the beginning of the device-level interrupt handler. This suffers from the vagaries of TSC frequency and can't measure the delay from interrupt assertion to the beginning of the software vector, but has reasonable resolution and will work on any interrupt and most CPUs. Both these approaches are probably "Good Enuf" for our purposes. I don't believe the object is a hard real-time kernel so a few usec slop in the interrupt latency probably doesn't matter. We just need to avoid latency spikes in the msec region. As for hardware approaches: A dedicated timer card like the PCI Pamette is obviously the best, but most pricey, solution. Maybe one of the hardware gurus would like to design and manufacture a simple PCI card that is capable of generating an interrupt and lets you read a 32-bit time-since-interrupt counter. (Or something a bit fancier that generates an interrupt, accepts an acknowledge signal and keeps track of the minimum/maximum/mean/median/variance internally). Both these approaches can also be done more cheaply and less accurately via the parallel port. The oscilloscope approach will let you measure average latencies but, unless you have a fancy digital CRO or logic analyser, isn't going to measure outliers - which are at least as important. Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message