From owner-freebsd-arch Sun Jan 13 21: 7:17 2002 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 B1A5B37B402 for ; Sun, 13 Jan 2002 21:07:14 -0800 (PST) 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 QAA22610; Mon, 14 Jan 2002 16:06:34 +1100 Date: Mon, 14 Jan 2002 16:07:37 +1100 (EST) From: Bruce Evans X-X-Sender: To: Peter Wemm Cc: Terry Lambert , Alfred Perlstein , Kelly Yancey , Nate Williams , Daniel Eischen , Dan Eischen , Archie Cobbs , Subject: Re: Request for review: getcontext, setcontext, etc In-Reply-To: <20020112203429.EE98738CC@overcee.netplex.com.au> Message-ID: <20020114151640.F4268-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, 12 Jan 2002, Peter Wemm wrote: > Bruce Evans wrote: > > I agree that fnsave/frstor are still incredibly expensive if the > > above times are correct. fxsave/fxrstor is only credibly expensive. > > However, the overheads for fnsave/frstor are small compared with > > the overheads for the !*#*$% segment registers. We switch 3 segment > > registers explicitly and 2 implicitly on every switch to the kernel. > > According to the above, this has the same overhead as 1 fxsave/frstor. > > It gets done much more often than context switches. I hoped to get > > rid of the 2 expicit segment register switches, but couldn't keep > > up with the forces of bloat that added a 3rd. Now I don't notice > > this bloat unless I count cycles and forget that a billion of them > > is a lot :-). > > Heh. That reminds me, I need to talk over some IPI vector tweaks > with you. I had forgotten that segment register operations were so bad. I barely understand IPI. > Hmm. What are they again? I see %ds, %es and %fs. I assume the two > implicit ones were %cs and %ss. Which had you hoped to remove? What *is* > %es used for anyway? I hoped to remove switches of %ds and %es. My idea for removing the switches is: use the same %ds and %es in userland as in the kernel, unless the process has an extended LDT with problematic descriptors in it. This works for the usual descriptors because they can all cover all of memory, and the kernel part is protected from user access at the page level. Userland can still load the unusual value 0, which will cause traps in the kernel; these traps can be caught and the segment registers fixed up. Segment registers with an unusual limit (which need only occur in an extended LDT) can be switched lazily too, but segment registers with an unusual base would cause invalid references without a trap if they were used in the kernel. %es is used mainly for string operations. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message