Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Jan 2002 20:11:25 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        Peter Wemm <peter@wemm.org>, Nate Williams <nate@yogotech.com>, Dan Eischen <eischen@vigrid.com>, Archie Cobbs <archie@dellroad.org>, Alfred Perlstein <bright@mu.org>, <arch@FreeBSD.ORG>
Subject:   Re: Request for review: getcontext, setcontext, etc
Message-ID:  <20020111195957.J858-100000@gamplex.bde.org>
In-Reply-To: <3C3DE998.44DCFA07@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 10 Jan 2002, Terry Lambert wrote:

> Bruce Evans wrote:
> > Actually, userland can look at the state bit in %msw (on i386's) to
> > tell if it can look at the state without trapping.  However, this is
> > not very useful.  The state will often be in the kernel, and then
> > userland will have to trap to the kernel too look at it.  The trap
> > may as well be a syscall that fetches all the state.
>
> How onerous would it be to look at the register in the kernel
> before returning to user space, following a context switch?

Not very, since the register has a known state following a context
switch (since the kernel has just written to it :-).

> I really don't think the lazy task switching FPU state saving
> needs to care about threads, only about processes... and once
> the bit is set, it's set, right?

We don't actually do lazy switching of the FPU state (at least on
i386's).  We just do lazy loading of it, and forced saving of it (if
it was loaded) on every context switch.  So the state tends to be not
in the FPU.  I think it might be worth switching it for threads and
letting kernel threads use it without restrictions, so that there
aren't too many special cases.  We already do this without really
trying for ithreads.  It does need to be lazy so that switching to an
ithread doesn't thrash a process's context even when the ithread doesn't
actually use the FPU.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020111195957.J858-100000>