Re: why floating point operations not allowed in kernel mode?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 20 February 2008, Mulyadi Santosa wrote:
> Hi...
>
>
> On Wed, Feb 20, 2008 at 2:59 PM, srimugunthan dhandapani
>
> <muggy.mit@xxxxxxxxx> wrote:
> > Hi all,
> > Can anyone explain why floating point operations are not allowed in
> > kernel mode?
>
> Not sure if it does help you, but IMHO think like this: user-to-kernel
> or vice versa already does costly FPU saving/restoring. Now imagine
> same thing happen in kernel mode only, whether it's
> interrupt-to-normal mode,  interrupt being interrupted....in short
> between any possible kind of kernel path codes. Can you imagine the
> latency that might show up?
>
> So instead letting the kernel does this FPU saving/restoring
> operation, the developers simply decide to forbid it.
>

Hi,

AFAIK there is not FPU saving in user-to-kernel or kernel-to-user switching. 
Also, there is no FPU saving/restoring when switching between processes that 
and at least one of them is not using the FPU. This is called lazy FPU (and 
as I remember it is nicely detailed in "Understanding the Linux Kernel").

So, since the kernel does not save the FPU context of the user space 
processes, using FPU operations in kernel will corrupt the state for the user 
space process that was using FPU operations. This is why they are not 
allowed.

Thanks,
tavi




--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux