hi i need fast fpu in the kernel for my lexos work
so how am i going to do it on the i386
1 . can i add some save / restore code to the task swicher ( the right
way )
so when it switchs from user to kernel task its saves the fpu state
?
2 . put the save / restore code in my code (NOT! GOOD! i do not wont to
do it this way it is not the right way)
so i have to use fpu in the kernel so its just how am i going to do it ?
thank you
David Rundle <[email protected]>
** Reply to message from david <[email protected]> on Thu, 09 Nov 2000
12:27:29 +1300
> 2 . put the save / restore code in my code (NOT! GOOD! i do not wont to
> do it this way it is not the right way)
That's how most people do it.
--
Timur Tabi - [email protected]
Interactive Silicon - http://www.interactivesi.com
When replying to a mailing-list message, please direct the reply to the mailing list only. Don't send another copy to me.
When you add it to the task switcher, it takes away a lot of cpu cycles
during each task switch and slows down your system. I think this was the
main idea behind _not_ saving those registers. IMHO, it does not make
sense to generally save these registers when nobody else but your driver
uses them.
Good luck!
Reto
david wrote:
>
> hi i need fast fpu in the kernel for my lexos work
> so how am i going to do it on the i386
>
> 1 . can i add some save / restore code to the task swicher ( the right
> way )
> so when it switchs from user to kernel task its saves the fpu state
> ?
>
> 2 . put the save / restore code in my code (NOT! GOOD! i do not wont to
> do it this way it is not the right way)
>
> so i have to use fpu in the kernel so its just how am i going to do it ?
>
> thank you
>
> David Rundle <[email protected]>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> Please read the FAQ at http://www.tux.org/lkml/
the problem is that unless your code does the save/restore of the FPU
registers you will corrupt user code that does floating point.
nothing else in the kernel is supposed to use the FPU, and as a result
(almost) no user->kernek->user transitions touch the FPU and therefor the
registers don't need to be saved.
If your code needs to use them it is your code's responsibility to get a
lock (to prevent something else from interrupting you), save teh
registers, do your work, restore the registers, and release the lock
there may not be a lock, but if not then you cannot schedule/sleep during
the time you have monkeyed with the FPU.
David Lang
On Wed, 8 Nov 2000, Reto Baettig wrote:
> Date: Wed, 08 Nov 2000 10:46:25 -0800
> From: Reto Baettig <[email protected]>
> To: david <[email protected]>
> Cc: Linux Kernel List <[email protected]>
> Subject: Re: fpu now a must in kernel
>
> When you add it to the task switcher, it takes away a lot of cpu cycles
> during each task switch and slows down your system. I think this was the
> main idea behind _not_ saving those registers. IMHO, it does not make
> sense to generally save these registers when nobody else but your driver
> uses them.
>
> Good luck!
>
> Reto
>
> david wrote:
> >
> > hi i need fast fpu in the kernel for my lexos work
> > so how am i going to do it on the i386
> >
> > 1 . can i add some save / restore code to the task swicher ( the right
> > way )
> > so when it switchs from user to kernel task its saves the fpu state
> > ?
> >
> > 2 . put the save / restore code in my code (NOT! GOOD! i do not wont to
> > do it this way it is not the right way)
> >
> > so i have to use fpu in the kernel so its just how am i going to do it ?
> >
> > thank you
> >
> > David Rundle <[email protected]>
> >
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to [email protected]
> > Please read the FAQ at http://www.tux.org/lkml/
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> Please read the FAQ at http://www.tux.org/lkml/
>
On Thu, Nov 09, 2000 at 12:27:29PM +1300, david wrote:
>
> 2 . put the save / restore code in my code (NOT! GOOD! i do not wont to
> do it this way it is not the right way)
It is the right way because it only penalizes your code, not everybody else.
A
-Andi
Andi Kleen wrote:
>
> On Thu, Nov 09, 2000 at 12:27:29PM +1300, david wrote:
> >
> > 2 . put the save / restore code in my code (NOT! GOOD! i do not wont to
> > do it this way it is not the right way)
>
> It is the right way because it only penalizes your code, not everybody else.
>
This is a MAJOR drag on preemptability. MUCH better to keep it out of
the kernel. Barring that, since context switch does not (and should
not) save/restore fp state, the using code must be preemption locked.
Sound folks won't like this.
Maybe you could explain why you think you need this and the community
here could suggest an alternative way to do the same or better.
By the way, since the kernel is not yet preemptable, you could use empty
macros to lock preemption. This way, when preemption comes (2.5) your
code will be easily found.
George