From owner-freebsd-alpha Tue Jan 15 6:30:57 2002 Delivered-To: freebsd-alpha@freebsd.org Received: from mail6.speakeasy.net (mail6.speakeasy.net [216.254.0.206]) by hub.freebsd.org (Postfix) with ESMTP id 7CE3037B41D for ; Tue, 15 Jan 2002 06:30:50 -0800 (PST) Received: (qmail 9763 invoked from network); 15 Jan 2002 14:30:49 -0000 Received: from unknown (HELO laptop.baldwin.cx) ([64.81.54.73]) (envelope-sender ) by mail6.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 15 Jan 2002 14:30:49 -0000 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 Date: Tue, 15 Jan 2002 06:30:09 -0800 (PST) From: John Baldwin To: alpha@FreeBSD.org, dfr@FreeBSD.org Subject: pmap fixes for SMP Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hey gang, I've got some fixes for pmap on SMP machines. With these fixes the DS20 I have here succesfully completed several buildworlds in a row with preemption turned on whereas before it couldn't make it through a single buildworld w/ preemption on without dying. The main points of this patch are as follows: - Create a private list of active pmaps rather than abusing the list of all processes when we need to look up pmaps. The process list needs a sx lock and we can't be getting sx locks in the middle of cpu_switch() (pmap_activate() can call pmap_get_asn() from cpu_switch()). Instead, we protect the list with a spinlock. This also means the list is shorter since a pmap can be used by more than one process and we could (at least in thoery) dink with pmap's more than once, but now we only touch each pmap once when we have to update all of them. - Wrap pmap_activate()'s code to get a new ASN in an explicit critical section so that when it is called while doing an exec() we can't get preempted. - Replace splhigh() in pmap_growkernel() with a critical section to prevent preemption while we are adjusting the kernel page tables. - Fixes abuse of PCPU_GET(), which doesn't return an L-value. - Also adds some slight cleanups to the ASN handling by adding some macros instead of magic numbers in relation to the ASN and ASN generations. Note that we have a bug if we ever run on an Alpha processor that supports more than 256 ASN's we will corrupt our ASN generation. We could make the generation field smaller or truncate maxasn in that case to 255. We could also make the ASN and ASN generatino var a long with a 16-bit ASN (max ASN on alpha is 65535) and a 48-bit generation count if we wanted I suppose. I'd like to commit this unless there are objections. The patch is at http://www.freebsd.org/~jhb/patches/alpha.pmap.patch -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message