From owner-freebsd-hardware Tue May 20 21:35:14 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id VAA17380 for hardware-outgoing; Tue, 20 May 1997 21:35:14 -0700 (PDT) Received: from genesis.atrad.adelaide.edu.au (genesis.atrad.adelaide.edu.au [129.127.96.120]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id VAA17371 for ; Tue, 20 May 1997 21:35:04 -0700 (PDT) Received: (from msmith@localhost) by genesis.atrad.adelaide.edu.au (8.8.5/8.7.3) id OAA08916; Wed, 21 May 1997 14:03:39 +0930 (CST) From: Michael Smith Message-Id: <199705210433.OAA08916@genesis.atrad.adelaide.edu.au> Subject: Re: isa bus and boca multiport boards In-Reply-To: <3.0.1.32.19970520181142.00734e08@lariat.org> from Brett Glass at "May 20, 97 06:11:42 pm" To: brett@lariat.org (Brett Glass) Date: Wed, 21 May 1997 14:03:39 +0930 (CST) Cc: gurney_j@resnet.uoregon.edu, rberndt@nething.com, WELCHDW@wofford.edu, HARDWARE@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hardware@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Brett Glass stands accused of saying: > At 07:44 PM 5/20/97 -0700, you wrote: > >change (input, signal change)... probably what should go in before this > >is splitting the intrrupt routine to only scan the ports that are on a > >certain board... this shouldn't be THAT hard to do... and I've thought > >about doing it... > > I was under the impression that this is what was already done, but now that > I look at it, I see that you're right! The code loops on a variable called > "unit", incrementing it from 0 to the precompiled constant NSIO. This can > waste a great deal of time, especially since the interrupts are > edge-triggered and the list is scanned at least twice per interrupt. You would still have to scan all possible ports and consult their softc 'master' port value. Just scanning the port directly is not much more inefficient, and may save you interrupt overhead soon therafter. > Here are some other improvements that could be made to the code, based on a > quick analysis: > > 1) The code looks at a flag called "gone" on each and every port (present > or not) during each and every interrupt service. Since the presence or > absence of a port is determined at boot time This is not true. Please note where the "gone" flag is manipulated, and post a correction to your statement when you understand. >, it'd be MUCH more efficient > if the code worked down a linear list of only the ports that were present > and on the relevant IRQ. This might well be achievable, but is unlikely to be significantly more efficient. > list instead of stopping at the point of the last interrupt service. In > fact, it may scan as many as NSIO-1 extra ports on each interrupt. On a > system with a many serial ports, this is a LOT of extra time. It's not, actually, all that much. Scanning a port is a single I/O operation, taking around 1us. At 115200bps, it takes 86us for a single character to arrive. > Also, rather than dereferencing the pointer "com" again and again, the ISR > could selectively enregister parts of the record that contain the comm > port's statistics. This is an operation possibly best left to the compiler. Have you checked the generated machine instructions? > I don't know what the policy on ASM code is in FreeBSD, but this seems like > an opportunity to do some VERY serious optimization where it's much needed! Processor-specific code in device drivers is not a viable proposition, given that portability is a significant issue. > --Brett -- ]] Mike Smith, Software Engineer msmith@gsoft.com.au [[ ]] Genesis Software genesis@gsoft.com.au [[ ]] High-speed data acquisition and (GSM mobile) 0411-222-496 [[ ]] realtime instrument control. (ph) +61-8-8267-3493 [[ ]] Unix hardware collector. "Where are your PEZ?" The Tick [[