From: Helge Hafting <helge.hafting@aitel.hist.no>
To: Phillip Susi <psusi@cfl.rr.com>
Cc: "linux-os (Dick Johnson)" <linux-os@analogic.com>,
Jan Engelhardt <jengelh@linux01.gwdg.de>,
beware <wimille@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: Float numbers in module programming
Date: Mon, 03 Apr 2006 08:55:33 +0200 [thread overview]
Message-ID: <4430C6E5.20101@aitel.hist.no> (raw)
In-Reply-To: <442C1415.6080906@cfl.rr.com>
Phillip Susi wrote:
> linux-os (Dick Johnson) wrote:
>
>> No. Any file I/O, or anything that takes time sleeps and gives up
>> the CPU, ultimately calling schedule(). That means that anybody
>> can have its coprocessor state dorked. This has been discussed many
>
>
> The FPU state is saved across normal thread switches if either the new
> or old thread uses the fpu, so this should be safe. Unless this does
> not apply to kernel threads?
Wrong. The FPU state is saved if context is switched from one
userspace thread to another. I don't know about kernel threads, but
be aware that lots of the kernel code is not executed in a kernel thread
context, so thread switching details doesn't matter at all.
Driver code is often executed in interrupt context. Any thread can
be interrupted while doing floating-point work, and the floating
point registers are _not_ saved when an interrupt comes in. This
goes for all drivers - disk drivers, usb, serial, audio, video, ...
Drivers may then call all sorts of kernel functions, so the
cpu may have "hot" FPU registers when executing filesystem and VM
code and almost anything else too.
To further complicate this: Your driver can save the FPU registers,
but it too may get interrupted. Possibly even by another instance of
itself, if the user have several devices.
>> If you divulge the mathematics you need calculated, I'll bet you
>> will get many answers from responders to the linux-kernel list.
>
Excellent advice. This problem has been solved so many times already .
Helge Hafting
next prev parent reply other threads:[~2006-04-03 6:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-29 14:34 Float numbers in module programming beware
2006-03-29 15:02 ` linux-os (Dick Johnson)
2006-03-30 8:11 ` Jan Engelhardt
2006-03-30 13:09 ` linux-os (Dick Johnson)
2006-03-30 17:23 ` Phillip Susi
2006-04-03 6:55 ` Helge Hafting [this message]
2006-04-03 9:20 ` Jan Engelhardt
2006-03-30 17:31 ` Al Viro
2006-03-30 17:40 ` Roland Dreier
2006-03-30 18:02 ` Valdis.Kletnieks
2006-03-30 18:26 ` Andre Noll
2006-03-30 18:46 ` linux-os (Dick Johnson)
2006-03-31 7:57 ` Olivier Galibert
2006-03-31 11:05 ` Peter Williams
2006-03-29 15:07 ` Helge Hafting
2006-03-30 8:12 ` Jan Engelhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4430C6E5.20101@aitel.hist.no \
--to=helge.hafting@aitel.hist.no \
--cc=jengelh@linux01.gwdg.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-os@analogic.com \
--cc=psusi@cfl.rr.com \
--cc=wimille@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.