kernel hangs within kernel_fpu_begin()...kernel_fpu_end()

Tobias Boege tobias at gambas-buch.de
Fri Nov 2 05:18:45 EDT 2012


On Thu, 01 Nov 2012, Digant wrote:
> Hello ,
> I am developing a feature in a X86-64 machine running kernel 3.5.5. I am
> exporting this symbol to test FPU and kernel compiles fine if I call this
> symbol from my module it works great. But when I used this symbol from
> scheduler particularly *enqueue_fair()* (few times per second)
> in/kernel/sched/fair.c it behaves weirdly. During boot kernel hangs
> abruptly after few hundreds correct prints in this function after 1st
> print.
> 

Have a look at the comment above arch/x86/kernel/i387.c:irq_fpu_usable()
which states that it is sometimes awry to use the FPU from interrupt
context. Seems not unlikely to me that you run into one of these situations
regularly from within the timer interrupt. Maybe you should just print the
return value of that function, too, to see if you are messing up anything.

> Am I missing any rule, because I looked it up on internet they says nothing
> else than this way to use fpu. Any help is appreciated. I tried 10-20 boots
> and each time it hangs.
> 
> *Code snippet for reference:*
>   1 /*test FPU*/
>   2 #include <asm/i387.h>
>   3 #include <linux/time.h>
>   4
>   5
>   6 void my_symbol(void){
>   7     unsigned long i = get_seconds();
>   8
>   9     printk(KERN_DEBUG "i:%lu,",i);
>  10     kernel_fpu_begin();
>  11             float d = 3.123456*(i%3);
>  12             i=(unsigned long)(d*1000000);
>  13     kernel_fpu_end();
>  14     printk(KERN_DEBUG "%lu\n",i);
>  15 }
>  16 EXPORT_SYMBOL_GPL(my_symbol);

Regards,
Tobi




More information about the Kernelnewbies mailing list