From owner-freebsd-arch Thu Mar 22 22:37:49 2001 Delivered-To: freebsd-arch@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id BA45237B71B; Thu, 22 Mar 2001 22:37:38 -0800 (PST) (envelope-from bde@zeta.org.au) 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 RAA08481; Fri, 23 Mar 2001 17:37:36 +1100 Date: Fri, 23 Mar 2001 17:36:48 +1100 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org 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 On Thu, 22 Mar 2001, John Baldwin wrote: > Hopefully this will make everyone happy. You are an optimist :-). > 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' SMPog actually made these do things like 'cli(); s_lock(&clock_lock)' in many cases (most of the non-broken cases). > With the initial SMPng commit this was added to to allow nested disabling > of interrupts: I originally tried hard to avoid nested disabling of interrupts. The x86 functions to support it were intentionally left out of early versions of the x86 cpufunc.h. The principle is that nested disabling of interrupts is as evil as recursive locking. However, it is very convenient. It was necessary to support profiling of code that is running with interrupts disabled (even though that code disabled interrupts to prevent potentially lengthy interference by things like profilers), so support for it was added in rev.1.21 of the x86 cpufunc.h. It is necessary to support debugging of code that os running with interrupts disabled (even though interference by debuggers screws up the timing much worse than interference by profilers). > save_intr() - return current interrupt state > restore_intr() - revert to previously read interrupt state This was really a renaming of the x86-specific interfaces read_eflags() and write_eflags(). I object to the x86 code being changed to use the new names. The x86 code that disables interrupts mostly wants precisely the MD interfaces, not the MI abstraction of them. It just happens that the MI versions are binary-identical with the MD versions. > 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 I want these to be named cli() and sti() for x86 only (maybe clpsri() and stpsri() for ia64 :-). MD functions should have MD names. > save_intr() - gone > restore_intr() - gone The MD versions of these may still be needed to implement critical_*(). > 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(). OK, but see other replies. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message