From owner-p4-projects@FreeBSD.ORG Thu May 8 07:39:53 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2F02537B401; Thu, 8 May 2003 07:39:52 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A9DE537B404 for ; Thu, 8 May 2003 07:39:51 -0700 (PDT) Received: from mail.speakeasy.net (mail16.speakeasy.net [216.254.0.216]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1D74843F85 for ; Thu, 8 May 2003 07:39:46 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 27758 invoked from network); 8 May 2003 14:39:48 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender )encrypted SMTP for ; 8 May 2003 14:39:48 -0000 Received: from laptop.baldwin.cx ([216.133.140.1]) by server.baldwin.cx (8.12.8/8.12.8) with ESMTP id h48Edhp0008627; Thu, 8 May 2003 10:39:43 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.4 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <200305080822.h488MEIg021724@repoman.freebsd.org> Date: Thu, 08 May 2003 10:39:50 -0400 (EDT) From: John Baldwin To: Peter Wemm cc: Perforce Change Reviews Subject: RE: PERFORCE change 30777 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 May 2003 14:39:53 -0000 On 08-May-2003 Peter Wemm wrote: > http://perforce.freebsd.org/chv.cgi?CH=30777 > > Change 30777 by peter@peter_overcee on 2003/05/08 01:21:28 > > Change the page IDTVEC back to an interrupt gate instead of a trap > gate. Otherwise we could preempt and %cr2 could be reused on another > process when it faults. > > Affected files ... > > .. //depot/projects/hammer/sys/amd64/amd64/machdep.c#12 edit > .. //depot/projects/hammer/sys/amd64/amd64/trap.c#6 edit > > Differences ... > > ==== //depot/projects/hammer/sys/amd64/amd64/machdep.c#12 (text+ko) ==== > > @@ -1219,7 +1219,7 @@ > setidt(11, &IDTVEC(missing), SDT_SYSTGT, SEL_KPL, 0); > setidt(12, &IDTVEC(stk), SDT_SYSTGT, SEL_KPL, 0); > setidt(13, &IDTVEC(prot), SDT_SYSTGT, SEL_KPL, 0); > - setidt(14, &IDTVEC(page), SDT_SYSTGT, SEL_KPL, 0); > + setidt(14, &IDTVEC(page), SDT_SYSIGT, SEL_KPL, 0); > setidt(15, &IDTVEC(rsvd), SDT_SYSTGT, SEL_KPL, 0); > setidt(16, &IDTVEC(fpu), SDT_SYSTGT, SEL_KPL, 0); > setidt(17, &IDTVEC(align), SDT_SYSTGT, SEL_KPL, 0); > > ==== //depot/projects/hammer/sys/amd64/amd64/trap.c#6 (text+ko) ==== > > @@ -213,9 +213,17 @@ > * do the VM lookup, so just consider it a fatal trap so the > * kernel can print out a useful trap message and even get > * to the debugger. > + * > + * Note that T_PAGEFLT is registered as an interrupt gate. This > + * is just like a trap gate, except interrupts are disabled. This > + * happens to be critically important, because we could otherwise > + * preempt and run another process that may cause %cr2 to be > + * clobbered for something else. > */ > eva = rcr2(); > - if (PCPU_GET(spinlocks) != NULL) > + if (PCPU_GET(spinlocks) == NULL) > + enable_intr(); > + else > trap_fatal(&frame, eva); > } The spinlocks check only works if witness is on. What you want to do is check td_critnest > 0 instead. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/