From owner-freebsd-arch Sat Mar 24 1:38:19 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 A901437B718; Sat, 24 Mar 2001 01:38:13 -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 UAA27046; Sat, 24 Mar 2001 20:38:11 +1100 Date: Sat, 24 Mar 2001 20:37:35 +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 Fri, 23 Mar 2001, John Baldwin wrote: > On 24-Mar-01 John Baldwin wrote: > >> 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. > > > > Ok, I could go with that. (/me deletes half of his patch.) > > Actually, I thought about this some more. Most of the places that do this (for > example, before setting cr0 or something else critical) don't really care about > any of the flags values, they are just keeping from being preempted, so I think > that using critical_* in those places is more appropriate. If something needs > to read eflags and act on it, then one would use read_eflags(). MD code still > calls MI functions in other places. But these places mostly need to know precisely what critical_* prevents. I'm not sure that the semantics of critical_* can or should be defined precisely enough for MD code to rely on. Here is one way that critical_enter() might be different from `read_eflags(); disable_intr()' on i386's: that latter certainly disables interrupts, but the former might only disable them virtually (let them occur, but don't let them proceed far, except possibly if they are fastintrs). Only very critical, very MD code should care about the difference between interrupts being disabled and interrupts apparently being disabled. The cr0-setting code is barely critical enough to care (but disabling interrupts early in the boot should be moot; it's simplest to disable interrupts globally and depend on this). BTW, the cr0-setting code seems to be entirely SMP-unaware; it seems to be only called for 1 CPUs (but this is OK since it is only used for old CPUs that don't support SMP). Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message