From owner-p4-projects@FreeBSD.ORG Thu Feb 14 15:49:19 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id F27E016A5A6; Thu, 14 Feb 2008 15:49:18 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6FC1B16A503 for ; Thu, 14 Feb 2008 15:49:18 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 2B3C913C448 for ; Thu, 14 Feb 2008 15:49:09 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from zion.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by elvis.mu.org (Postfix) with ESMTP id 9CF381A4D9F; Thu, 14 Feb 2008 07:49:08 -0800 (PST) From: John Baldwin To: Warner Losh Date: Thu, 14 Feb 2008 10:38:20 -0500 User-Agent: KMail/1.9.7 References: <200802080917.m189HF0o016528@repoman.freebsd.org> In-Reply-To: <200802080917.m189HF0o016528@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200802141038.20967.jhb@freebsd.org> Cc: Perforce Change Reviews Subject: Re: PERFORCE change 135027 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Feb 2008 15:49:19 -0000 On Friday 08 February 2008 04:17:15 am Warner Losh wrote: > http://perforce.freebsd.org/chv.cgi?CH=135027 > > Change 135027 by imp@imp_lighthouse on 2008/02/08 09:16:43 > > First cut at implementing gonzo's suggestions for AST handling. > > Affected files ... > > .. //depot/projects/mips2-jnpr/src/sys/mips/include/asm.h#10 edit > .. //depot/projects/mips2-jnpr/src/sys/mips/mips/exception.S#12 edit > .. //depot/projects/mips2-jnpr/src/sys/mips/mips/genassym.c#6 edit > .. //depot/projects/mips2-jnpr/src/sys/mips/mips/swtch.S#13 edit > .. //depot/projects/mips2-jnpr/src/sys/mips/mips/trap.c#10 edit > > Differences ... > > ==== //depot/projects/mips2-jnpr/src/sys/mips/include/asm.h#10 (text+ko) ==== > > @@ -304,6 +304,26 @@ > .align 3 > > /* > + * Call ast if required > + */ > +#define DO_AST \ > + GET_CPU_PCPU(k1) \ > + lw k1, PC_CURTHREAD(k1); \ > + lw t0, TD_FLAGS(k1); \ > + and t0, t0, (TDF_ASTPENDING|TDF_NEEDRESCHED); \ > + beq t0, zero, 27f; \ > + nop; \ > + lw k1, TD_FRAME(k1); \ > + lw t0, TF_REG_SR(k1); \ > + and t0, t0, SR_KSU_USER; \ > + beq t0, zero, 27f; \ > + nop; \ > + move a0, k1; \ > + jal ast; \ > + nop; \ > +27: > + > +/* > * XXX retain dialects XXX I'm not a MIPS asm expert, but I don't think you are disabling interrupts here like you need to do. Specifically, an interrupt might set an AST (e.g. hardclock() can set one for a pending SIGPROF or SIGALRM, or you can get an IPI to forward a signal sent from another CPU in SMP) so you have to do the check like this (psuedo-code): intr_disable(); while (td->td_flags & (TDF_ASTPENDING|TDF_NEEDRESCHED)) { intr_enable(); ast(); intr_disable(); } eret/reti/iret, etc. It also seems you are missing the loop above as well so that after ast returns you branch back up and check the flags again in case you got an interrupt that set an AST while you were in ast() with interrupts enabled. -- John Baldwin