This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi Johni,
I do not see a good example of linux driver using float/double. I am checking with Linux experts
and will get their feedback on that. So i will come back after couple of days.
- Keerthy
Hi Johni,
Here's the response from our expert. In summary it's easy and not right to enable floating operations in Linux kernel.
For the current 64-bit kernel we don't know if there is a 'good' way to do this.
The basic issue is kernel space typically doesn't maintain a floating point context. Often its only added to a user process in a lazy way so as to keep context switch costs down. Only user processes who use floats pay the cost. The mechanism to do the lazy usage typically has the float feature disabled until first use. At first float use an exception happens where the kernel then allocates and assigns resources.
For something in the kernel to use floats, it needs to save and restore any floating point context it touches. It may have to enable and disable the unit. Further, some worry needs to be given to preemption of system code (kernel entities and interrupt handlers). Even if a context were created for the kernel how would multiple interrupt handlers leveraged by different processes share this."
As told earlier we do not recommend float usage in Linux kernel drivers. Hope you can close the issue
Best regards,
Keerthy