NetBSD Problem Report #44502

From martin@aprisoft.de  Wed Feb  2 10:57:51 2011
Return-Path: <martin@aprisoft.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id B017B63B873
	for <gnats-bugs@gnats.NetBSD.org>; Wed,  2 Feb 2011 10:57:50 +0000 (UTC)
Message-Id: <20110202105743.4A2EBAF580E@emmas.aprisoft.de>
Date: Wed,  2 Feb 2011 11:57:43 +0100 (CET)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@gnats.NetBSD.org
Subject: eventcounters initialized too early
X-Send-Pr-Version: 3.95

>Number:         44502
>Category:       port-alpha
>Synopsis:       eventcounters initialized too early
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    port-alpha-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 02 11:00:01 +0000 2011
>Closed-Date:    Sun Jul 17 02:59:59 +0000 2011
>Last-Modified:  Sun Jul 17 02:59:59 +0000 2011
>Originator:     Martin Husemann
>Release:        NetBSD 5.99.45
>Organization:
The NetBSD Foundation, Inc.
>Environment:
>Description:
Alpha tries to attach event counters in trap_init(), which is (for the first
processor) called too early, i.e. before evcnt_init(). This causes a panic
at boot.

>How-To-Repeat:
Just boot a current kernel.

>Fix:
Move the event counter initalization out of trap_init()?

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-alpha/44502: eventcounters initialized too early
Date: Wed, 2 Feb 2011 12:56:35 +0100

 --YZ5djTAD1cGYuMQK
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline

 This patch avoids the problem. OK to commit?

 Martin

 --YZ5djTAD1cGYuMQK
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="alpha.patch"

 Index: machdep.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/alpha/alpha/machdep.c,v
 retrieving revision 1.328
 diff -u -p -r1.328 machdep.c
 --- machdep.c	10 Nov 2010 09:27:21 -0000	1.328
 +++ machdep.c	2 Feb 2011 11:52:35 -0000
 @@ -803,6 +803,7 @@ consinit(void)
  void
  cpu_startup(void)
  {
 +	extern struct evcnt fpevent_use, fpevent_reuse;
  	vaddr_t minaddr, maxaddr;
  	char pbuf[9];
  #if defined(DEBUG)
 @@ -865,6 +866,14 @@ cpu_startup(void)
  	 * CPUs.
  	 */
  	hwrpb_primary_init();
 +
 +	/*
 +	 * Initialize some trap event counters.
 +	 */
 +	evcnt_attach_dynamic(&fpevent_use, EVCNT_TYPE_MISC, NULL,
 +	    "FP", "proc use");
 +	evcnt_attach_dynamic(&fpevent_reuse, EVCNT_TYPE_MISC, NULL,
 +	    "FP", "proc re-use");
  }

  /*
 Index: trap.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/alpha/alpha/trap.c,v
 retrieving revision 1.124
 diff -u -p -r1.124 trap.c
 --- trap.c	20 Dec 2010 00:25:24 -0000	1.124
 +++ trap.c	2 Feb 2011 11:52:36 -0000
 @@ -149,17 +149,6 @@ trap_init(void)
  	 */
  	alpha_pal_wrmces(alpha_pal_rdmces() &
  	    ~(ALPHA_MCES_DSC|ALPHA_MCES_DPC));
 -
 -	/*
 -	 * If this is the primary processor, initialize some trap
 -	 * event counters.
 -	 */
 -	if (cpu_number() == hwrpb->rpb_primary_cpu_id) {
 -		evcnt_attach_dynamic(&fpevent_use, EVCNT_TYPE_MISC, NULL,
 -		    "FP", "proc use");
 -		evcnt_attach_dynamic(&fpevent_reuse, EVCNT_TYPE_MISC, NULL,
 -		    "FP", "proc re-use");
 -	}
  }

  static void

 --YZ5djTAD1cGYuMQK--

From: "Michael L. Hitch" <mhitch@lightning.msu.montana.edu>
To: gnats-bugs@NetBSD.org
Cc: martin@NetBSD.org
Subject: Re: port-alpha/44502: eventcounters initialized too early
Date: Wed, 2 Feb 2011 11:06:18 -0700 (MST)

 On Wed, 2 Feb 2011, Martin Husemann wrote:

 > This patch avoids the problem. OK to commit?

    It looks OK to me.  I looked at this problem previously, but didn't see 
 an obvious place to initialize the event counters.  Thanks.

 Mike

 --
 Michael L. Hitch			mhitch@montana.edu
 Computer Consultant
 Information Technology Center
 Montana State University	Bozeman, MT	USA

From: Martin Husemann <martin@duskware.de>
To: "Michael L. Hitch" <mhitch@lightning.msu.montana.edu>
Cc: gnats-bugs@NetBSD.org, martin@NetBSD.org
Subject: Re: port-alpha/44502: eventcounters initialized too early
Date: Wed, 2 Feb 2011 20:24:24 +0100

 On Wed, Feb 02, 2011 at 11:06:18AM -0700, Michael L. Hitch wrote:
 >   It looks OK to me.  I looked at this problem previously, but didn't see 
 > an obvious place to initialize the event counters.  Thanks.

 Matt Thomas suggested to take the opportunity and make them per cpu (i.e.
 move them inside cpu_info).

 Martin

From: Nicolas Joly <njoly@pasteur.fr>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-alpha/44502: eventcounters initialized too early
Date: Thu, 5 May 2011 11:59:28 +0200

 On Wed, Feb 02, 2011 at 11:00:01AM +0000, martin@NetBSD.org wrote:
 > >Number:         44502
 > >Category:       port-alpha
 > >Synopsis:       eventcounters initialized too early
 [...]
 > >Description:
 > Alpha tries to attach event counters in trap_init(), which is (for the first
 > processor) called too early, i.e. before evcnt_init(). This causes a panic
 > at boot.
 > 
 > >How-To-Repeat:
 > Just boot a current kernel.
 > 
 > >Fix:
 > Move the event counter initalization out of trap_init()?

 DIAGNOSTIC kernels boot fine again for me with recent commits
 (machdep.c and trap.c).

 Thanks.

 -- 
 Nicolas Joly

 Projects and Developments in Bioinformatics
 Institut Pasteur, Paris.

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 17 Jul 2011 02:59:59 +0000
State-Changed-Why:
fixed


>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-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.