From owner-freebsd-arch Fri Mar 16 11:38:39 2001 Delivered-To: freebsd-arch@freebsd.org Received: from meow.osd.bsdi.com (meow.osd.bsdi.com [204.216.28.88]) by hub.freebsd.org (Postfix) with ESMTP id 0911C37B718 for ; Fri, 16 Mar 2001 11:38:35 -0800 (PST) (envelope-from jhb@FreeBSD.org) Received: from laptop.baldwin.cx (john@jhb-laptop.osd.bsdi.com [204.216.28.241]) by meow.osd.bsdi.com (8.11.2/8.11.2) with ESMTP id f2GJbpG60199; Fri, 16 Mar 2001 11:37:52 -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: Fri, 16 Mar 2001 11:38:01 -0800 (PST) From: John Baldwin To: Bruce Evans Subject: Re: Proposal for the CPU interrupt API Cc: arch@FreeBSD.org Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 16-Mar-01 Bruce Evans wrote: > On Thu, 15 Mar 2001, John Baldwin wrote: > >> ... >> Typically, interrupts are disabled in the following fashion: >> >> u_int foo = save_intr(); >> disable_intr(); >> ... >> restore_intr(foo); >> >> Unfortunately, this can be somewhat expensive on the Alpha, as both >> save_intr() and disable_intr() involve a PAL call. However, the Alpha >> returns the previous state whenever you set the interrupt state, which >> allows you to only make 1 PAL call. Thus, I'm proposing to change >> disable/enable_intr to return the previous state in addition to setting >> the state. > > This would be a minor pessimization on i386's. WHether it is an optimization > or a pessimization is very MD. It would be a major pessimization on i386's > with ICUs if we put the entire interrupt state including the ICU masks in > the interrrupt state. I don't think this needs to go near the ICU state, but yes, it is a minor pessimization on i386. >> This then removes the need for save_intr(), and >> restore_intr() can stay the same. > > This doesn't remove the need for save_intr(). I use it in at least one > place (perhaps only one :-) where I don't want to disable interrupts any > more than they already are. If it is just the CPU status, then just intr_disable() (or disable_intr()) will accomplish this. >> Finally, another suggestion has been to fudge the names some to stick >> all of these functions in one intr_* namespace. >> >> The end result of these changes would be this: >> >> intrmask_t intr_disable(void); >> intrmask_t intr_enable(void); >> void intr_restore(intrmask_t); > > I don't like names like this much. I don't care too strongly about the names either way. But it seems to me that foo_* namespaces are easier to enforce than *_foo namespaces. > It's really a mistake to let this stuff escape from MD code. Frotunately, > it hasn't escaped far yet. The only somewhat MI place it is used is in the bowels of the mutex code. Any MI code that wishes to prevent preemption should use a spinlock instead of disabling interrupts manually now. > 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