NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: port-alpha/48782: # top [1] Floating point exception (core dumped) top
The following reply was made to PR port-alpha/48782; it has been noted by GNATS.
From: "Naruaki.Etomi" <nullnilaki%gmail.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: port-alpha-maintainer%netbsd.org@localhost, martin%duskware.de@localhost
Subject: Re: port-alpha/48782: # top [1] Floating point exception (core
dumped) top
Date: Sat, 10 May 2014 17:55:11 +0900
I think that this case is conflict between pcu_load() and fpu_state_load().
---------------------------
-mieee-with-inexact option use:
/usr/src/sys/arch/alpha/alpha/fp_complete.c
static int
alpha_fp_complete_at(alpha_instruction *trigger_pc, struct lwp *l,
uint64_t *ucode)
{
int needsig;
...
if (__predict_false(copyin(trigger_pc, &inst, sizeof inst))) {
this_cannot_happen(6, -1);
return SIGSEGV;
}
fpu_load(); <---------------------------------------------------- point
alpha_pal_wrfen(1);
/usr/src/sys/kern/subr_pcu.c
pcu_load(const pcu_ops_t *pcu)
{
const u_int id = pcu->pcu_id;
...
/* Does this CPU already have our PCU state loaded? */
if (ci == curci) {
KASSERT(curci->ci_pcu_curlwp[id] == l);
KASSERT(pcu_used_p(pcu));
panic("Re-enable"); <----------------------------------- point
/* Re-enable */
pcu->pcu_state_load(l, PCU_LOADED | PCU_ENABLE);
<------- point
panic: Re-enable
Stopped in pid 411.1 (a.out) at netbsd:cpu_Debugger+0x4: ret zero,(ra
)
db> tr
cpu_Debugger() at netbsd:cpu_Debugger+0x4
db_panic() at netbsd:db_panic+0x118
vpanic() at netbsd:vpanic+0x1a8
panic() at netbsd:panic+0x58
pcu_load() at netbsd:pcu_load+0x288
alpha_fp_complete_at() at netbsd:alpha_fp_complete_at+0x60
alpha_fp_complete() at netbsd:alpha_fp_complete+0x78
trap() at netbsd:trap+0x114
XentArith() at netbsd:XentArith+0x20
--- arithmetic trap (from ipl 0) ---
--- user mode ---
---------------------------
I think that trapb instruction incompatible with fpu_state_load().
---------------------------
# diff -u fp_complete.c.orig fp_complete.c
--- fp_complete.c.orig 2014-05-10 08:02:31.000000000 +0000
+++ fp_complete.c 2014-05-10 07:48:32.000000000 +0000
@@ -721,6 +721,10 @@
void
fpu_state_load(struct lwp *l, u_int flags)
{
+ if ((PCU_LOADED | PCU_ENABLE) == flags) {
+ return;
+ }
+
struct pcb * const pcb = lwp_getpcb(l);
---------------------------
Is it right?
Please review.
---------------------------
PID USERNAME PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND
0 root 96 0 0K 13M atath 0:01 0.00% 0.00% [system]
466 root 43 0 3992K 2240K CPU 0:00 0.00% 0.00% top
404 root 85 0 9840K 4088K wait 0:00 0.00% 0.00% login
158 root 85 0 7536K 2592K kqueue 0:00 0.00% 0.00% syslogd
396 root 85 0 3888K 2280K wait 0:00 0.00% 0.00% sh
325 root 85 0 3776K 1736K kqueue 0:00 0.00% 0.00% inetd
1 root 85 0 3624K 1704K wait 0:00 0.00% 0.00% init
397 root 85 0 3568K 1536K nanoslp 0:00 0.00% 0.00% cron
412 root 43 0 32M 18M parked 0:00 0.00% 0.00% dhclient
# vi test.c
#include <stdio.h>
int main (int argc, char *argv[])
{
double a, b, c;
a = 1.;
b = 3.;
c = a/b;
fprintf (stderr, "%g / %g = %g\n", a, b, c);
}
# gcc -mieee-with-inexact test.c
# ./a.out
1 / 3 = 0.333333
---------------------------
---
That's very nice of you!
Naruaki Etomi / nullnilaki%gmail.com@localhost
Home |
Main Index |
Thread Index |
Old Index