From owner-freebsd-arch Sun Mar 18 0:12:38 2001 Delivered-To: freebsd-arch@freebsd.org Received: from moby.geekhouse.net (moby.geekhouse.net [64.81.6.36]) by hub.freebsd.org (Postfix) with ESMTP id AE44037B736 for ; Sun, 18 Mar 2001 00:12:32 -0800 (PST) (envelope-from jhb@FreeBSD.org) Received: from laptop.baldwin.cx (john@dhcp152.geekhouse.net [192.168.1.152]) by moby.geekhouse.net (8.11.0/8.9.3) with ESMTP id f2I8Eg192210; Sun, 18 Mar 2001 00:14:42 -0800 (PST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: Date: Sun, 18 Mar 2001 00:12:05 -0800 (PST) From: John Baldwin To: Matthew Jacob Subject: Re: 'final' man pages Cc: arch@FreeBSD.org, Bruce Evans Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 18-Mar-01 Matthew Jacob wrote: >> > .Sh SYNOPSIS >> > .Fd #include >> > .Ft void >> > .Fn restore_intr "intrmask_t" >> >> Should be: >> >> .Fd #include >> .Fd #include >> ... >> >> ( is an implementation detail. It should never be >> included directly.) > > Urmm.. Huh. John told me to do it! It's his fault! I'll defer to Bruce on this one, he is more of an expert in header foo. >> It's not even clear that interrupt states can be restored in a nested >> way. > > Yes. > > Bruce- the following paragrahph is really hard to parse. I *think* you're > saying that we cannot guarantee nesting. That's a fair addition. Anything > else? Hmm, as long as you pair state changes with restores you can handle nesting in the same way that spl's did, i.e.: x = intr_disable() ... y = intr_disable() .... restore_intr(y) .... restore_intr(x) will DTRT and not enable interrupts until after the second restore_intr(). You do have to pair them up much like lock acquire/releases. >> Some cases need to be handled like ithread priorities: a handler >> for a high priority interrupt may have to yield to the handler for a >> lower priority interrupt to contest a lock. This requires some non-nested >> handling of interrupt states. I discussed this with John (jhb). He was >> more pessimistic about it than me. If a machine supports an external mechanism for disabling interrupts such as a PIC mask, then we can simply disable individual interrupts that way until the ithread associated with an interrupt source completes. Note that we only really need to do this for level-triggered interrupts. If we don't have this available and are forced to (ab)use the CPU interrupt level to mask interrupts, then we instead disable all other device interrupts on this CPU when an interrupt comes in until the associated ithread finishes. >> I think things currently work on >> i386's because the interrupt state isn't all actually returned by >> save_intr() or restored by restore_intr(). Most of the state is in the >> ICU or APIC, and we depend on this because the state is a mask and not >> a level. Priority propagation is more complicated because low priority >> interrupts aren't masked while high priority ones are being handled; we >> let them occur and then mask them. If we didn't have the global state >> in the ICU/APIC, then we would have to adjust the saved state in various >> stack frames, but this is too hard. OTOH, on alphas the interrupt state >> is controlled by a level and not a mask, so lower priority interrupts >> can't occur and I think nested handling of interrupt states works right >> provided ithread priorities work right. Only the case where the interrupt >> state is a mask and is all returned by save_intr() is broken, and we don't >> support any machines that require that. Actually, all device I/O interrupts on the alpha are at the same level, so they aren't split across multiple levels. Also, we lower the IPL back to 0 before running an ithread, so that only the actual interrupt stack that schedules an ithread to run runs at a raised IPL. As they are currently implemented, *_intr() only allow one to guarantee that the current thread on the current CPU will not be preempted. It doesn't set a level of interrupts that are allowed like spl's. That is managed separately by the interrupt code. >> Bruce -- John Baldwin -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message