From owner-freebsd-current Sat Feb 9 6: 3:33 2002 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 3DE9237B416; Sat, 9 Feb 2002 06:03:28 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id BAA17217; Sun, 10 Feb 2002 01:03:17 +1100 Date: Sun, 10 Feb 2002 01:05:58 +1100 (EST) From: Bruce Evans X-X-Sender: To: Julian Elischer Cc: , FreeBSD current users Subject: Re: "fast" interrupt handler threads. In-Reply-To: Message-ID: <20020210001539.Q3155-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, 8 Feb 2002, Julian Elischer wrote: > Bruce, for the low-level impared such as myself, can you give a quick > precis on teh difference between "fast" interrupt handlers in -current > and 'normal' interrupt handlers. "Fast" interrupt handlers are harder to program and should rarely be used. There are no correctly programmed ones in -current. A correctly programmed one would do not much more than something like: some_sort_of_lock_not_using_mtx(); buf[writeindex++ & mask] = bus_space_read_1(...); some_sort_of_unlock_not_using_mtx(); > Do fast interrupt handlers enter through "trap()" ? No. They are called directly from XfastintrN. A really fast one would be inside XfastintrN. > if they interrupt a user process, do they take on the cred of the running > thread? No. Accessing almost anothing except correctly locked local (static) storage in a fast interrupt handler is a bug. > do they return via doreti() They always do in -current. This is a pessimization (never merged into my version). In -stable, they can only return via doreti if they metamorphose into a normal interrupt handler, which they do in most the few cases where doreti would do something other than just return. Note that it would only do somthing for return to _user_ mode if the fast interrupt handler scheduled a software interrupt (no other interrupts or ASTs can be pending since there must have been none when the fast interrupt occurred, and fast interrupts disable other interrupts). > on returning do they check for ASTs and run userret()? Yes, anything that reaches doreti checks for ASTs and runs userret() if necessary and possible (only for returns to user mode). Hmm, this check seems to be inadequate for fast interrupts. There is no check for rescheduling if the return is to kernel mode. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message