From owner-freebsd-arch Thu Mar 22 15:13:50 2001 Delivered-To: freebsd-arch@freebsd.org Received: from feral.com (feral.com [192.67.166.1]) by hub.freebsd.org (Postfix) with ESMTP id C1A3237B719; Thu, 22 Mar 2001 15:13:45 -0800 (PST) (envelope-from mjacob@feral.com) Received: from zeppo.feral.com (IDENT:mjacob@zeppo [192.67.166.71]) by feral.com (8.9.3/8.9.3) with ESMTP id PAA16990; Thu, 22 Mar 2001 15:13:50 -0800 Date: Thu, 22 Mar 2001 15:13:45 -0800 (PST) From: Matthew Jacob Reply-To: mjacob@feral.com To: John Baldwin Cc: arch@FreeBSD.ORG Subject: Re: Critical Regions Round II In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG critical_enter/critical_exit seem fine, but you can save yourself some compiler space by just having it return a void *. What's wrong with alpha having disable_intr() calls MD/platform function that disables mainbridge ints enable_intr() calls MD/platform function that enables mainbridge ints I believe that this actually is possible. > Hopefully this will make everyone happy. > > Prior to SMPng we had the following functions related to interrupts: > > disable_intr() - x86 only and just did a 'cli' > enable_intr() - x86 only and just did a 'sti' > > With the initial SMPng commit this was added to to allow nested disabling > of interrupts: > > save_intr() - return current interrupt state > restore_intr() - revert to previously read interrupt state > > Thus one would do: > > u_int foo; > > foo = save_intr(); > disable_intr(); > .... > restore_intr(foo); > > Also, this entire API was forced out into MI code. After the discussion on > the mailing list I propose the following that will hopefully make everyone > happy: > > disable_intr() - x86 / ia64 only, just clears the IF or psr.i bit, and is > a MD function > enable_intr() - x86 / ia64 only, just sets the IF or psr.i bit, and is a > MD function > > save_intr() - gone > restore_intr() - gone > > critical_enter() - enters a critical region of code that must not be > preempted > critical_exit() - leaves a critical region of code > > The critical_enter/exit functions use an opaque type 'critical_t' for the > value that critical_enter() returns that must be passed to critical_exit(). > Thus, the above code now becomes: > > critical_t foo; > > foo = critical_enter(); > ... > critical_exit(foo); > > This API includes the same optimizations mentioned for the Alpha as the > last proposal. A manpage for critical_enter/exit is attached. > > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message