NetBSD Problem Report #50037

From www@NetBSD.org  Sun Jul  5 19:07:23 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id E83EFA57FD
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  5 Jul 2015 19:07:22 +0000 (UTC)
Message-Id: <20150705190721.7D1C9A65BE@mollari.NetBSD.org>
Date: Sun,  5 Jul 2015 19:07:21 +0000 (UTC)
From: macallan@netbsd.org
Reply-To: macallan@netbsd.org
To: gnats-bugs@NetBSD.org
Subject: FPU handling on powerpc is broken
X-Send-Pr-Version: www-1.0

>Number:         50037
>Category:       port-powerpc
>Synopsis:       FPU handling on powerpc is broken
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    port-powerpc-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 05 19:10:00 +0000 2015
>Closed-Date:    Sun Jan 08 23:54:14 +0000 2017
>Last-Modified:  Sun Jan 08 23:54:14 +0000 2017
>Originator:     Michael
>Release:        -current
>Organization:
NetBSD Foundation
>Environment:
NetBSD cointreau 7.99.19 NetBSD 7.99.19 (COINTREAU) #5: Sun Jul  5 14:37:25 EDT 2015  ml@blackbush:/stuff/build/obj/sys/arch/macppc/compile/COINTREAU macppc

>Description:
FPU registers get occasionally corrupted, apparently since FPU handling was switched to PCU:
http://mail-index.netbsd.org/source-changes/2011/05/02/msg021630.html
>How-To-Repeat:
#include <sys/types.h>
#include <stdio.h>
#include <math.h>


int main()
{
  register double a, b, c, d, e;
  double diff;
  uint8_t *boo = (void *)&diff;
  int i, j;

  a = 2.0;
  b = 3.0;
  d = 6.0;

  do {
    c = a * b;
    e = d - c;
    diff = fabs(e);
    if (diff > 0.001) {
      printf("diff: %f - %f %f %f %f %f\n", diff, a, b, c, d, e);
      for (j = 0; j < 8; j++) {
        printf(" %02x", boo[j]);
      }
      printf("\n");
    }
  } while (1);
  return 0;
}

Compile without optimization, get lots of this:
diff: 2147483648.000000 - 2.000000 3.000000 6.000000 6.000000 0.000000
 41 e0 00 00 00 00 00 00


>Fix:
n/a

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: macallan@NetBSD.org
State-Changed-When: Mon, 06 Jul 2015 06:19:32 +0000
State-Changed-Why:
matt@ just fixed it, I can no longer trigger it on my beige G3


State-Changed-From-To: closed->pending-pullups
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Mon, 06 Jul 2015 11:23:12 +0000
State-Changed-Why:
this needs to be fixed in -7 and maybe -6?


From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc: port-powerpc-maintainer@netbsd.org, netbsd-bugs@netbsd.org,
	gnats-admin@netbsd.org, mrg@NetBSD.org, macallan@netbsd.org
Subject: Re: port-powerpc/50037 (FPU handling on powerpc is broken)
Date: Mon, 6 Jul 2015 21:18:10 +0300

 On Mon, Jul 06, 2015 at 11:23:12 +0000, mrg@NetBSD.org wrote:

 > State-Changed-From-To: closed->pending-pullups
 > State-Changed-Why:
 > this needs to be fixed in -7 and maybe -6?

 Yes, please, pull this up to -6.  perl and ntpd problems reported on
 the port-macppc are most likely caused by this.

 -uwe

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-powerpc/50037 (FPU handling on powerpc is broken)
Date: Wed, 8 Jul 2015 07:51:43 +0000

 On Mon, Jul 06, 2015 at 06:20:00PM +0000, Valery Ushakov wrote:
  >  > State-Changed-From-To: closed->pending-pullups
  >  > State-Changed-Why:
  >  > this needs to be fixed in -7 and maybe -6?
  >  
  >  Yes, please, pull this up to -6.  perl and ntpd problems reported on
  >  the port-macppc are most likely caused by this.

 pullup-7 #868, pullup-6 #1310

 -- 
 David A. Holland
 dholland@netbsd.org

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-powerpc/50037 (FPU handling on powerpc is broken)
Date: Sat, 14 May 2016 18:37:45 +0000

 On Sat, May 14, 2016 at 05:21:21AM +0000, David Holland wrote:
  > From: David Holland <dholland-bugs@netbsd.org>
  > To: gnats-bugs@NetBSD.org
  > Subject: Re: port-powerpc/50037 (FPU handling on powerpc is broken)
  > Date: Wed, 8 Jul 2015 07:51:43 +0000
  > 
  >  On Mon, Jul 06, 2015 at 06:20:00PM +0000, Valery Ushakov wrote:
  >   >  > State-Changed-From-To: closed->pending-pullups
  >   >  > State-Changed-Why:
  >   >  > this needs to be fixed in -7 and maybe -6?
  >   >  
  >   >  Yes, please, pull this up to -6.  perl and ntpd problems reported on
  >   >  the port-macppc are most likely caused by this.
  >  
  >  pullup-7 #868, pullup-6 #1310

 Don't ask me why this email took 10 months to be delivered into
 gnats... but now that it has been, for the record:

 pullup-7 #868 was done about a week after I filed it.

 pullup-6 #1310 was applied last November and then reverted because it
 broke the build; for some reason even though I filed the pullup I
 didn't find out about this (or possibly I got the email and didn't
 remember I'd had anything to do with it) so nothing's been done about
 fixing the patches.

 I will put it on my list but if someone else feels like attending to
 it that will probably get it done faster.

 -- 
 David A. Holland
 dholland@netbsd.org

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-powerpc/50037 (FPU handling on powerpc is broken)
Date: Sat, 31 Dec 2016 12:46:12 +0300

 The fix actually _was_ pulled up to -6 via patch on May 18, 2016 (see
 ticket):

 sys/arch/powerpc/include/psl.h			1.20 (patch)
 sys/arch/powerpc/include/userret.h		1.29-1.30 (patch)
 sys/arch/powerpc/oea/oea_machdep.c		1.72 (patch)

 	Add a check to make sure that if PSL_FP is set, we own the FPU.
 	Don't clear PSL_FP/PSL_VEC.
 	Remove PSL_SPV from BOOKE PSL_USERMOD
 	Don't preserve PSL_FP/PSL_VEC in cpu_setmcontext.
 	[matt, ticket #1310]

 -uwe

State-Changed-From-To: pending-pullups->closed
State-Changed-By: uwe@NetBSD.org
State-Changed-When: Sun, 08 Jan 2017 23:54:14 +0000
State-Changed-Why:
Pullups done.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.