From owner-freebsd-current Mon Feb 17 13:54:44 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8825237B401 for ; Mon, 17 Feb 2003 13:54:42 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1D3E043F93 for ; Mon, 17 Feb 2003 13:54:41 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id IAA09926; Tue, 18 Feb 2003 08:54:14 +1100 Date: Tue, 18 Feb 2003 08:54:59 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Jake Burkholder Cc: Julian Elischer , FreeBSD current users Subject: Re: question on profiling code In-Reply-To: <20030217021512.O63597@locore.ca> Message-ID: <20030218075519.Y7132-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, 17 Feb 2003, Jake Burkholder wrote: > Apparently, On Mon, Feb 17, 2003 at 05:35:09PM +1100, > Bruce Evans said words to the effect of; > > ... Also, ast() doesn't > > have access to the frame, and there is no macro like CLKF_PC() for > > general frames. This probably doesn't matter much, since signals are > > rare and the hitting on the signal handler's pc would be perfectly > > correct if the profiling interrupt occurred an instant later. > > There are macros for accessing trapframes, like the ones for clockframe, > TRAPF_PC etc. Oops. ast() always had a frame, and it needed and got some frame access macros when it was MI'ized. > > Now there is a stronger reason: clock interrupt handling is "fast", > > so it normally returns to user mode without going near ast(), and the > > counter is not updated until the next non-fast interrupt or syscall. > > In freebsd "fast" interrupts do handle asts, on i386 they return through > doreti Oops. > (you may consider this a bug and have removed it in your version). Indeed I have (my version never had it). This doesn't result cause the problem that I thought we had (of not updating the user profiling counter as soon as possible) since my hardclock() and statclock() aren't fast interrupt handlers. However, using ithreads causes similar problems stashing the pc. My sched_ithd() saves the pc and other relevant state for the the ithreads to look at later, much like addupc_intr() saves things. > I see no reason not to just use the pc in the trapframe passed to ast, > even in the case of signals they won't be posted until after addupc_task > is called. I think this would work even in my version. The pc for a clock interrupt in kernel mode is more interesting in my version, but the pc for a clock interrupt from user mode must be the same one as in the user's trapframe except for the special case of signal handling. Can you explain how fuswintr() and suswintr() work on sparc64's? They seem to cause traps if the user counter is not mapped, and I can't see where the traps are handled. ia64/trap.c has a comment about where these traps are handled, but has dummies for fuswintr() and suswintr() so the traps never occur. Depending on traps in fast interrupt handlers is a bug IMO. It extends the scope of the fast interrupt handler to the trap handler, and it is difficult to limit this scope and verify the locking for it. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message