All of lore.kernel.org
 help / color / mirror / Atom feed
* kernel hangs within kernel_fpu_begin()...kernel_fpu_end()
@ 2012-11-02  2:10 Digant
  2012-11-02  9:18 ` Tobias Boege
  0 siblings, 1 reply; 2+ messages in thread
From: Digant @ 2012-11-02  2:10 UTC (permalink / raw)
  To: kernelnewbies

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.

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);

thanks

Regards,
Digant Desai.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20121101/428b396d/attachment.html 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* kernel hangs within kernel_fpu_begin()...kernel_fpu_end()
  2012-11-02  2:10 kernel hangs within kernel_fpu_begin()...kernel_fpu_end() Digant
@ 2012-11-02  9:18 ` Tobias Boege
  0 siblings, 0 replies; 2+ messages in thread
From: Tobias Boege @ 2012-11-02  9:18 UTC (permalink / raw)
  To: kernelnewbies

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-02  9:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-02  2:10 kernel hangs within kernel_fpu_begin()...kernel_fpu_end() Digant
2012-11-02  9:18 ` Tobias Boege

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.