Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Oct 2007 15:15:13 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        Danovitsch@vitsch.net
Cc:        FreeBSD-Hackers@FreeBSD.org
Subject:   Re: Floating point in interrupt handler
Message-ID:  <20071024.151513.-713548131.imp@bsdimp.com>
In-Reply-To: <200710222211.51590.Danovitsch@vitsch.net>
References:  <200710222211.51590.Danovitsch@vitsch.net>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <200710222211.51590.Danovitsch@vitsch.net>
            "Daan Vreeken [PA4DAN]" <Danovitsch@vitsch.net> writes:
: But what I haven't found is a description of exactly what the kernel is 
: missing to allow floating point operations to be done there.

FPU context is assumed to only change in user processes.  You'd have
to fix the FPU state saving code to cope with it changing everywhere,
or you'd have to explicitly put the goo to save/restore it around the
FP you want to do in the kernel.  You had also make sure that the
floating point exceptions never trap, since trapping inside the kernel
has very limited support.  You'll have to fix the problems that this
would cause, or force the FPU into a state where it never traps.

Sure, maybe you can make it happen.  However, you are in for much pain
and suffering.  The kernel isn't a general purpose computing
environment, and trying to pretend it is will lead to suffering.
Especially inside of an interrupt handler.  It is less bad if this is
an ithread, but could be quite painful if you want to do this inside
of a fast interrupt handler to reduce latency.

I'd recommend strongly against trying this and revaluate your true
need for FP in the kernel.  From your other mail, you don't seem open
to this answer.  If you don't take it, you are setting yourself up for
a lot of pain and suffering.  It is your choice, however.  If you do
manage to pull it of, I'd be very interested in see what things I
didn't know to warn you about...

Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071024.151513.-713548131.imp>