linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: Question on SIGFPE
@ 2003-10-30 13:57 Sreeram Kumar Ravinoothala
  0 siblings, 0 replies; 11+ messages in thread
From: Sreeram Kumar Ravinoothala @ 2003-10-30 13:57 UTC (permalink / raw)
  To: root; +Cc: linux-kernel, Magnus Naeslund(t)

Hi Mr Johnson,
	I used it and was able to compile, run. Well it still was
crashing. We are using a mips processor. I am sorry I didn't mention
about this. Thanks a lot for the help.

Regards
Sreeram

---Never doubt that a small group of thoughtful, committed people can
change the world. Indeed, it is the only thing that ever has. -- Copied
from a mail
 

-----Original Message-----
From: Richard B. Johnson [mailto:root@chaos.analogic.com] 
Sent: Thursday, October 30, 2003 7:22 PM
To: Sreeram Kumar Ravinoothala
Cc: Magnus Naeslund(t); Linux kernel
Subject: RE: Question on SIGFPE


On Thu, 30 Oct 2003, Sreeram Kumar Ravinoothala wrote:

>
> Hi Mr Johnson,
> 	Thanks for the mail and sorry for pestering you. Actually the
call 
> __setfpucw is not visible anywhere. Should I use
>  _FPU_SETCW(cw) instead of that?
>
> Thanks and Regards
> SReeram

Yes. I just looked on a RH-9 system. The stuff I referenced
was probably before there was a Red Hat!

I don't like that MACRO. Hopefully it works. It accesses memory that may
not exist if you do _FPU_SETCW(_FPU_DEFAULT).

For safety do:

fpu_control_t cw = _FPU_DEFAULT;
_FPU_SETCW(cw);


Cheers,
Dick Johnson
Penguin : Linux version 2.4.22 on an i686 machine (797.90 BogoMips).
            Note 96.31% of all statistics are fiction.



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

* RE: Question on SIGFPE
  2003-10-30 13:37 Sreeram Kumar Ravinoothala
@ 2003-10-30 13:51 ` Richard B. Johnson
  0 siblings, 0 replies; 11+ messages in thread
From: Richard B. Johnson @ 2003-10-30 13:51 UTC (permalink / raw)
  To: Sreeram Kumar Ravinoothala; +Cc: Magnus Naeslund(t), Linux kernel

On Thu, 30 Oct 2003, Sreeram Kumar Ravinoothala wrote:

>
> Hi Mr Johnson,
> 	Thanks for the mail and sorry for pestering you. Actually the
> call __setfpucw is not visible anywhere. Should I use
>  _FPU_SETCW(cw) instead of that?
>
> Thanks and Regards
> SReeram

Yes. I just looked on a RH-9 system. The stuff I referenced
was probably before there was a Red Hat!

I don't like that MACRO. Hopefully it works. It accesses memory
that may not exist if you do _FPU_SETCW(_FPU_DEFAULT).

For safety do:

fpu_control_t cw = _FPU_DEFAULT;
_FPU_SETCW(cw);


Cheers,
Dick Johnson
Penguin : Linux version 2.4.22 on an i686 machine (797.90 BogoMips).
            Note 96.31% of all statistics are fiction.



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

* RE: Question on SIGFPE
@ 2003-10-30 13:37 Sreeram Kumar Ravinoothala
  2003-10-30 13:51 ` Richard B. Johnson
  0 siblings, 1 reply; 11+ messages in thread
From: Sreeram Kumar Ravinoothala @ 2003-10-30 13:37 UTC (permalink / raw)
  To: root; +Cc: Magnus Naeslund(t), Linux kernel

Hi Mr Johnson,
	Thanks for the mail and sorry for pestering you. Actually the
call __setfpucw is not visible anywhere. Should I use 
 _FPU_SETCW(cw) instead of that?

Thanks and Regards
SReeram

---Never doubt that a small group of thoughtful, committed people can
change the world. Indeed, it is the only thing that ever has. -- Copied
from a mail
 

-----Original Message-----
From: Richard B. Johnson [mailto:root@chaos.analogic.com] 
Sent: Thursday, October 30, 2003 6:56 PM
To: Sreeram Kumar Ravinoothala
Cc: Magnus Naeslund(t); Linux kernel
Subject: RE: Question on SIGFPE


On Thu, 30 Oct 2003, Sreeram Kumar Ravinoothala wrote:

>
> Hi Mr Johnson,
>     Thanks for the mail. Actually I see that there is no fpu_control.h

> in my src.
>
> Thanks and Regards
> SReeram

With more recent C runtime libraries, the header is
/usr/include/fpu_control.h instead of /usr/include/i386/fpu_control.h

Cheers,
Dick Johnson
Penguin : Linux version 2.4.22 on an i686 machine (797.90 BogoMips).
            Note 96.31% of all statistics are fiction.



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

* RE: Question on SIGFPE
  2003-10-30 13:18 Sreeram Kumar Ravinoothala
@ 2003-10-30 13:26 ` Richard B. Johnson
  0 siblings, 0 replies; 11+ messages in thread
From: Richard B. Johnson @ 2003-10-30 13:26 UTC (permalink / raw)
  To: Sreeram Kumar Ravinoothala; +Cc: Magnus Naeslund(t), Linux kernel

On Thu, 30 Oct 2003, Sreeram Kumar Ravinoothala wrote:

>
> Hi Mr Johnson,
>     Thanks for the mail. Actually I see that there is no fpu_control.h
> in my src.
>
> Thanks and Regards
> SReeram

With more recent C runtime libraries, the header is
/usr/include/fpu_control.h instead of /usr/include/i386/fpu_control.h

Cheers,
Dick Johnson
Penguin : Linux version 2.4.22 on an i686 machine (797.90 BogoMips).
            Note 96.31% of all statistics are fiction.



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

* RE: Question on SIGFPE
@ 2003-10-30 13:18 Sreeram Kumar Ravinoothala
  2003-10-30 13:26 ` Richard B. Johnson
  0 siblings, 1 reply; 11+ messages in thread
From: Sreeram Kumar Ravinoothala @ 2003-10-30 13:18 UTC (permalink / raw)
  To: root; +Cc: Magnus Naeslund(t), Linux kernel

Hi Mr Johnson,
    Thanks for the mail. Actually I see that there is no fpu_control.h
in my src.

Thanks and Regards
SReeram

---Never doubt that a small group of thoughtful, committed people can
change the world. Indeed, it is the only thing that ever has. -- Copied
from a mail
 

-----Original Message-----
From: Richard B. Johnson [mailto:root@chaos.analogic.com] 
Sent: Thursday, October 30, 2003 6:23 PM
To: Sreeram Kumar Ravinoothala
Cc: Magnus Naeslund(t); Linux kernel
Subject: RE: Question on SIGFPE


On Thu, 30 Oct 2003, Sreeram Kumar Ravinoothala wrote:

> Hi,
> 	I tried this. It says that the address is 0. And also I saw that
it 
> doesn't fall into any of the si_codes of SIGFPE.
>
> Regards
> Sreeram
>

First, to see if it's an access violation (#GP) or an actual FPE, set
the FPU unit to ignore /0 errors. You do it like this:

---------------
/*
 *  Note FPU control only exists per process. Therefore, you have
 *  to set up the FPU before you use it in any program.
 */
#include <i386/fpu_control.h>

#define FPU_MASK (_FPU_MASK_IM |\
                  _FPU_MASK_DM |\
                  _FPU_MASK_ZM |\
                  _FPU_MASK_OM |\
                  _FPU_MASK_UM |\
                  _FPU_MASK_PM)

void fpu()
{
//    __setfpucw(_FPU_DEFAULT & ~FPU_MASK);
    __setfpucw(_FPU_DEFAULT);
}


main() {
   double zero=0.0;
   double one=1.0;
   fpu();

   one /=zero;
}
--------------

With the above code, you can divide by zero with no problem. If you
unmask, using the FPU_MASK, you get the divide by zero error.

If your program now "functions", you have a real divide by zero error
that may be related to "real-world" data, that was not caught during
your initial testing.

If your program still fails, the error is really caused by the FPU
attempting to access memory you don't own. Note that all floating-pount
numbers exist as memory oprands in Intel stuff. So you could have an
out-of-bounds access or, perhaps, a stack- overflow.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.22 on an i686 machine (797.90 BogoMips).
            Note 96.31% of all statistics are fiction.



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

* RE: Question on SIGFPE
  2003-10-30 12:03 Sreeram Kumar Ravinoothala
@ 2003-10-30 12:53 ` Richard B. Johnson
  0 siblings, 0 replies; 11+ messages in thread
From: Richard B. Johnson @ 2003-10-30 12:53 UTC (permalink / raw)
  To: Sreeram Kumar Ravinoothala; +Cc: Magnus Naeslund(t), Linux kernel

On Thu, 30 Oct 2003, Sreeram Kumar Ravinoothala wrote:

> Hi,
> 	I tried this. It says that the address is 0. And also I saw that
> it doesn't fall into any of the si_codes of SIGFPE.
>
> Regards
> Sreeram
>

First, to see if it's an access violation (#GP) or an actual FPE,
set the FPU unit to ignore /0 errors. You do it like this:

---------------
/*
 *  Note FPU control only exists per process. Therefore, you have
 *  to set up the FPU before you use it in any program.
 */
#include <i386/fpu_control.h>

#define FPU_MASK (_FPU_MASK_IM |\
                  _FPU_MASK_DM |\
                  _FPU_MASK_ZM |\
                  _FPU_MASK_OM |\
                  _FPU_MASK_UM |\
                  _FPU_MASK_PM)

void fpu()
{
//    __setfpucw(_FPU_DEFAULT & ~FPU_MASK);
    __setfpucw(_FPU_DEFAULT);
}


main() {
   double zero=0.0;
   double one=1.0;
   fpu();

   one /=zero;
}
--------------

With the above code, you can divide by zero with no problem. If
you unmask, using the FPU_MASK, you get the divide by zero error.

If your program now "functions", you have a real divide by zero error
that may be related to "real-world" data, that was not caught during
your initial testing.

If your program still fails, the error is really caused by the
FPU attempting to access memory you don't own. Note that all
floating-pount numbers exist as memory oprands in Intel stuff.
So you could have an out-of-bounds access or, perhaps, a stack-
overflow.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.22 on an i686 machine (797.90 BogoMips).
            Note 96.31% of all statistics are fiction.



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

* RE: Question on SIGFPE
@ 2003-10-30 12:03 Sreeram Kumar Ravinoothala
  2003-10-30 12:53 ` Richard B. Johnson
  0 siblings, 1 reply; 11+ messages in thread
From: Sreeram Kumar Ravinoothala @ 2003-10-30 12:03 UTC (permalink / raw)
  To: Magnus Naeslund(t); +Cc: linux-kernel

Hi,
	I tried this. It says that the address is 0. And also I saw that
it doesn't fall into any of the si_codes of SIGFPE.

Regards
Sreeram

---Never doubt that a small group of thoughtful, committed people can
change the world. Indeed, it is the only thing that ever has. -- Copied
from a mail
 

-----Original Message-----
From: Magnus Naeslund(t) [mailto:mag@fbab.net] 
Sent: Thursday, October 30, 2003 3:53 PM
To: Sreeram Kumar Ravinoothala
Cc: linux-kernel@vger.kernel.org
Subject: Re: Question on SIGFPE


Sreeram Kumar Ravinoothala wrote:

 > Hi,
 > 	We get this problem when we run it on disk on chip where linux
 > 2.4.5 is used.
 >
 > Thanks and Regards
 > Sreeram

Since I don't know what your app is doing, it's kind of hard to know 
whats causing the problem. I still would guess on a divide by zero, 
maybe because of some timing issue.

Use sigaction(2) to trap the signal, and then look at the 
siginfo_t->si_addr to find out where it happens.

Or better yet, just run the program through gdb, it will catch the
thing...

Magnus


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

* Re: Question on SIGFPE
  2003-10-30 10:13 Sreeram Kumar Ravinoothala
@ 2003-10-30 10:22 ` Magnus Naeslund(t)
  0 siblings, 0 replies; 11+ messages in thread
From: Magnus Naeslund(t) @ 2003-10-30 10:22 UTC (permalink / raw)
  To: Sreeram Kumar Ravinoothala; +Cc: linux-kernel

Sreeram Kumar Ravinoothala wrote:

 > Hi,
 > 	We get this problem when we run it on disk on chip where linux
 > 2.4.5 is used.
 >
 > Thanks and Regards
 > Sreeram

Since I don't know what your app is doing, it's kind of hard to know 
whats causing the problem. I still would guess on a divide by zero, 
maybe because of some timing issue.

Use sigaction(2) to trap the signal, and then look at the 
siginfo_t->si_addr to find out where it happens.

Or better yet, just run the program through gdb, it will catch the thing...

Magnus


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

* RE: Question on SIGFPE
@ 2003-10-30 10:13 Sreeram Kumar Ravinoothala
  2003-10-30 10:22 ` Magnus Naeslund(t)
  0 siblings, 1 reply; 11+ messages in thread
From: Sreeram Kumar Ravinoothala @ 2003-10-30 10:13 UTC (permalink / raw)
  To: Magnus Naeslund(t); +Cc: linux-kernel

Hi,
	We get this problem when we run it on disk on chip where linux
2.4.5 is used.

Thanks and Regards
Sreeram

---Never doubt that a small group of thoughtful, committed people can
change the world. Indeed, it is the only thing that ever has. -- Copied
from a mail
 

-----Original Message-----
From: Magnus Naeslund(t) [mailto:mag@fbab.net] 
Sent: Thursday, October 30, 2003 3:44 PM
To: Sreeram Kumar Ravinoothala
Cc: linux-kernel@vger.kernel.org
Subject: Re: Question on SIGFPE


Sreeram Kumar Ravinoothala wrote:

> Hi,
> 	I am trying to run a multi threaded application on kernel 2.4.5.
The 
> application vanishes without leaving any trace (no core dump) when 
> there is a link up on the hardware I use. If I try to debug I see the 
> application being killed because of SIGFPE. Can anyone throw some 
> light on this please? Also please cc the answer to me as I am not a 
> member of the list.
 >

The most obvious thing is to check you code for a divide by zero error.

Magnus


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

* Re: Question on SIGFPE
  2003-10-30 10:07 Sreeram Kumar Ravinoothala
@ 2003-10-30 10:13 ` Magnus Naeslund(t)
  0 siblings, 0 replies; 11+ messages in thread
From: Magnus Naeslund(t) @ 2003-10-30 10:13 UTC (permalink / raw)
  To: Sreeram Kumar Ravinoothala; +Cc: linux-kernel

Sreeram Kumar Ravinoothala wrote:

> Hi,
> 	I am trying to run a multi threaded application on kernel 2.4.5.
> The application vanishes without leaving any trace (no core dump) when
> there is a link up on the hardware I use. If I try to debug I see the
> application being killed because of SIGFPE. Can anyone throw some light
> on this please? Also please cc the answer to me as I am not a member of
> the list.
 >

The most obvious thing is to check you code for a divide by zero error.

Magnus


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

* Question on SIGFPE
@ 2003-10-30 10:07 Sreeram Kumar Ravinoothala
  2003-10-30 10:13 ` Magnus Naeslund(t)
  0 siblings, 1 reply; 11+ messages in thread
From: Sreeram Kumar Ravinoothala @ 2003-10-30 10:07 UTC (permalink / raw)
  To: linux-kernel; +Cc: Sreeram Kumar Ravinoothala

Hi,
	I am trying to run a multi threaded application on kernel 2.4.5.
The application vanishes without leaving any trace (no core dump) when
there is a link up on the hardware I use. If I try to debug I see the
application being killed because of SIGFPE. Can anyone throw some light
on this please? Also please cc the answer to me as I am not a member of
the list.

Thanks and Regards
Sreeram

---Never doubt that a small group of thoughtful, committed people can
change the world. Indeed, it is the only thing that ever has. -- Copied
from a mail
 

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

end of thread, other threads:[~2003-10-30 13:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-30 13:57 Question on SIGFPE Sreeram Kumar Ravinoothala
  -- strict thread matches above, loose matches on Subject: below --
2003-10-30 13:37 Sreeram Kumar Ravinoothala
2003-10-30 13:51 ` Richard B. Johnson
2003-10-30 13:18 Sreeram Kumar Ravinoothala
2003-10-30 13:26 ` Richard B. Johnson
2003-10-30 12:03 Sreeram Kumar Ravinoothala
2003-10-30 12:53 ` Richard B. Johnson
2003-10-30 10:13 Sreeram Kumar Ravinoothala
2003-10-30 10:22 ` Magnus Naeslund(t)
2003-10-30 10:07 Sreeram Kumar Ravinoothala
2003-10-30 10:13 ` Magnus Naeslund(t)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).