Re: Floating point problems

2002-10-25 Thread Juli Mallett
* De: Bruce Evans [EMAIL PROTECTED] [ Data: 2002-10-24 ]
[ Subjecte: Re: Floating point problems ]
 Thanks.  This makes the main bug clear.  The PCB_NPXINITDONE bit in the
 state was not being restored.  This was confusing to debug because gdb
 doesn't understand this bug so it shows the state that should have been
 restored until npxdna() unrestores it consistently.  Try this fix.

FWIW, this fixes every reproducable hang I've had with X and related.

Thanks!
juli.
-- 
Juli Mallett [EMAIL PROTECTED]   | FreeBSD: The Power To Serve
Will break world for fulltime employment. | finger [EMAIL PROTECTED]
http://people.FreeBSD.org/~jmallett/  | Support my FreeBSD hacking!

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: Floating point problems

2002-10-25 Thread Peter Edwards
I can also confirm that my X server has been rock solid since applying the
patch.
I think Bruce deserves a lollipop.

Juli Mallett [EMAIL PROTECTED] wrote:

 
 * De: Bruce Evans [EMAIL PROTECTED] [ Data: 2002-10-24 ]
   [ Subjecte: Re: Floating point problems ]
  Thanks.  This makes the main bug clear.  The PCB_NPXINITDONE bit in the
  state was not being restored.  This was confusing to debug because gdb
  doesn't understand this bug so it shows the state that should have been
  restored until npxdna() unrestores it consistently.  Try this fix.
 
 FWIW, this fixes every reproducable hang I've had with X and related.
 
 Thanks!
 juli.
 -- 
 Juli Mallett [EMAIL PROTECTED]   | FreeBSD: The Power To Serve
 Will break world for fulltime employment. | finger [EMAIL PROTECTED]
 http://people.FreeBSD.org/~jmallett/  | Support my FreeBSD hacking!
 

-- 
Peter Edwards.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: Floating point problems

2002-10-25 Thread Alexander Leidinger
On Fri, 25 Oct 2002 03:43:03 -0700
Juli Mallett [EMAIL PROTECTED] wrote:

 FWIW, this fixes every reproducable hang I've had with X and related.

AOL

Bye,
Alexander.

-- 
The dark ages were caused by the Y1K problem.

http://www.Leidinger.net   Alexander @ Leidinger.net
  GPG fingerprint = C518 BC70 E67F 143F BE91  3365 79E2 9C60 B006 3FE7

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Floating point problems

2002-10-24 Thread Peter Edwards
Hi,
There was some discussion about issues with interactions between the floating 
point context and signal handling in a thread a week or so ago, and a suggestion 
that someone try and get a simple test that would fail. I was surprised how
easy it was: The following program just spins calculating the value of 6.0 / 
3.0, and traps SIGINT.

If you run it on -current (as of a few hours ago), 99% of the time, hitting 
ctl-C will cause the program to exit with an error. A 4.5 kernel never causes 
any problems.

I'm pretty sure this is what's causing the stalls and crashes in X. I've taken
stack traces of crashes, and from spinning processes, and I can spot NaNs on
the stack that shouldn't be there, etc.

I just thought it might be useful to send this, to firmly take the blame
away from the X server, and give someone a way of reproducing the bug.

fptest.c:

#include math.h
#include stdio.h
#include signal.h
#include assert.h


int count = 0;
void sigint(int sig)
{
write(2, INT\n, 4);
count++;
}

int
main(int argc, char **argv)
{
double x = 6.0;
double y = 3.0;
double d;
double err;
struct sigaction sa;

sa.sa_handler = sigint;
sa.sa_flags = 0;
sigemptyset(sa.sa_mask);
sigaction(SIGINT, sa, 0);

while (count  30) {
d = x / y;
err = 2.0 - d;
if (err != 0.0) {
fprintf(stderr, err %f!\n, err);
exit(-1);
}
}
}


-- 
Peter Edwards.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: Floating point problems

2002-10-24 Thread Bruce Evans
On Thu, 24 Oct 2002, Peter Edwards wrote:

 There was some discussion about issues with interactions between the floating
 point context and signal handling in a thread a week or so ago, and a suggestion
 that someone try and get a simple test that would fail. I was surprised how
 easy it was: The following program just spins calculating the value of 6.0 /
 3.0, and traps SIGINT.

 If you run it on -current (as of a few hours ago), 99% of the time, hitting
 ctl-C will cause the program to exit with an error. A 4.5 kernel never causes
 any problems.

 I'm pretty sure this is what's causing the stalls and crashes in X. I've taken
 stack traces of crashes, and from spinning processes, and I can spot NaNs on
 the stack that shouldn't be there, etc.

Thanks.  This makes the main bug clear.  The PCB_NPXINITDONE bit in the
state was not being restored.  This was confusing to debug because gdb
doesn't understand this bug so it shows the state that should have been
restored until npxdna() unrestores it consistently.  Try this fix.

%%%
Index: npx.c
===
RCS file: /home/ncvs/src/sys/i386/isa/npx.c,v
retrieving revision 1.133
diff -u -2 -r1.133 npx.c
--- npx.c   20 Oct 2002 17:30:30 -  1.133
+++ npx.c   24 Oct 2002 14:20:33 -
@@ -1004,4 +1007,5 @@
bcopy(addr, td-td_pcb-pcb_save, sizeof(*addr));
}
+   curthread-td_pcb-pcb_flags |= PCB_NPXINITDONE;
 }

%%%

Bruce


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: Floating point problems

2002-10-24 Thread Peter Edwards
Well, that's certainly fixed the problems my test app had.

As for X:
I was regularly able to hurt X by clicking randomly on the transfers 
window in Opera, and switching between it and other internal frames:
symptoms included SEGVs, minute-long hangs, etc. Invoking such rain-dances
failed to produce any positive results after about 5 mins., which is
3-4 times longer than its ever been up before under the same stress. I'll
report back in about 24 hours either way, but I think that's cured it.
--
Peter.



Bruce Evans [EMAIL PROTECTED] wrote:

 
 On Thu, 24 Oct 2002, Peter Edwards wrote:
 
  There was some discussion about issues with interactions between the floating
  point context and signal handling in a thread a week or so ago, and a suggestion
  that someone try and get a simple test that would fail. I was surprised how
  easy it was: The following program just spins calculating the value of 6.0 /
  3.0, and traps SIGINT.
 
  If you run it on -current (as of a few hours ago), 99% of the time, hitting
  ctl-C will cause the program to exit with an error. A 4.5 kernel never causes
  any problems.
 
  I'm pretty sure this is what's causing the stalls and crashes in X. I've taken
  stack traces of crashes, and from spinning processes, and I can spot NaNs on
  the stack that shouldn't be there, etc.
 
 Thanks.  This makes the main bug clear.  The PCB_NPXINITDONE bit in the
 state was not being restored.  This was confusing to debug because gdb
 doesn't understand this bug so it shows the state that should have been
 restored until npxdna() unrestores it consistently.  Try this fix.
 
 %%%
 Index: npx.c
 ===
 RCS file: /home/ncvs/src/sys/i386/isa/npx.c,v
 retrieving revision 1.133
 diff -u -2 -r1.133 npx.c
 --- npx.c 20 Oct 2002 17:30:30 -  1.133
 +++ npx.c 24 Oct 2002 14:20:33 -
 @@ -1004,4 +1007,5 @@
   bcopy(addr, td-td_pcb-pcb_save, sizeof(*addr));
   }
 + curthread-td_pcb-pcb_flags |= PCB_NPXINITDONE;
  }
 
 %%%
 
 Bruce
 
 

-- 
Peter Edwards.



To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



floating point problems after update from a pre gcc3.1 world

2002-07-07 Thread Alexander Leidinger

Hi,

I've updated to todays current from a -current as of May 1 and I get the
following error from my mailer (tkrat 2.0.3, written in tcl/tk):
---snip---
expected floating-point number but got 0.045132
expected floating-point number but got 0.045132
while executing
.f1.t.messlist.scroll set 0.045132 1
(vertical scrolling command executed by text)
---snip---

It doesn't crash, the only misbehaving I observe is: after deleting a
mail it doesn't advance to the next available mail anymore (and pops up
an error box with the above error).

Any ideas what the reason is?

Bye,
Alexander.

-- 
  To boldly go where I surely don't belong.

http://www.Leidinger.net   Alexander @ Leidinger.net
  GPG fingerprint = C518 BC70 E67F 143F BE91  3365 79E2 9C60 B006 3FE7


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: floating point problems after update from a pre gcc3.1 world

2002-07-07 Thread Alexander Leidinger

On  8 Jul, Bruce Evans wrote:

 Compilng libc with gcc3 -O2 does this.
 
 PR:   40209

Thanks, after recompiling libc{,_r} it works as expected.

Bye,
Alexander.

-- 
  The best things in life are free, but the
expensive ones are still worth a look.

http://www.Leidinger.net   Alexander @ Leidinger.net
  GPG fingerprint = C518 BC70 E67F 143F BE91  3365 79E2 9C60 B006 3FE7


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message