NetBSD Problem Report #38937

From martin@duskware.de  Tue Jun 10 20:27:48 2008
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 8481A63B8BC
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 10 Jun 2008 20:27:48 +0000 (UTC)
Message-Id: <20080610202746.5A96433A87@mail.duskware.de>
Date: Tue, 10 Jun 2008 22:27:46 +0200 (CEST)
From: martin@duskware.de
Reply-To: martin@duskware.de
To: gnats-bugs@gnats.NetBSD.org
Subject: aprint_debug calls make no sense during shutdown
X-Send-Pr-Version: 3.95

>Number:         38937
>Category:       kern
>Synopsis:       aprint_debug calls make no sense during shutdown
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    martin
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 10 20:30:00 +0000 2008
>Closed-Date:    
>Last-Modified:  Sat Dec 31 10:10:01 +0000 2022
>Originator:     Martin Husemann
>Release:        NetBSD 4.99.64
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD night-porter.duskware.de 4.99.64 NetBSD 4.99.64 (PORTER) #50: Tue Jun 10 18:56:22 CEST 2008 martin@night-porter.duskware.de:/usr/src/sys/arch/i386/compile/PORTER i386
Architecture: i386
Machine: i386
>Description:

While trying to debug a shutdown issue, I wonderd why the tons of aprint_debug
messages that should be issued by pmf_system_shutdown() and the functions
it calls never showed up.

I'll leave out the long confusion untill I noticed the obvious: cpu_reboot()
overwrites boothowto, so at that moment aprint_debug and aprint_verbose
stop to work.

>How-To-Repeat:

boot -svxd
at the db prompt: x boothowto; break pmf_system_shutdown; c
at tha shell prompt: halt -p
at the db prompt: x boothowto

>Fix:
copy flags to controll aprint_* early at bootup to a separate variable and
have the actual aprint_*_internal functions test that instead?

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/38937: aprint_debug calls make no sense during shutdown
Date: Sun, 15 Jun 2008 02:43:59 +0200

 --DocE+STaALJfprDB
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline

 I talked to joerg, and here is a patch that models his suggested solution for
 i386 (we would need to modify all cpu_reboot if we go this way)

 Martin


 --DocE+STaALJfprDB
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=patch

 Index: sys/reboot.h
 ===================================================================
 RCS file: /cvsroot/src/sys/sys/reboot.h,v
 retrieving revision 1.25
 diff -c -u -r1.25 reboot.h
 --- sys/reboot.h	25 Dec 2007 18:33:48 -0000	1.25
 +++ sys/reboot.h	15 Jun 2008 00:37:37 -0000
 @@ -64,6 +64,8 @@
  #define	AB_SILENT	0x00040000	/* boot silently */
  #define	AB_DEBUG	0x00080000	/* boot with debug messages */

 +#define AB_VERBOSITY_MASK	(AB_QUIET|AB_VERBOSE|AB_SILENT|AB_DEBUG)
 +
  /*
   * The top 4 bits are architecture specific and are used to
   * pass information between the bootblocks and the machine
 Index: arch/i386/i386/machdep.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/i386/i386/machdep.c,v
 retrieving revision 1.636
 diff -c -u -r1.636 machdep.c
 --- arch/i386/i386/machdep.c	5 Jun 2008 21:44:31 -0000	1.636
 +++ arch/i386/i386/machdep.c	15 Jun 2008 00:37:37 -0000
 @@ -872,7 +872,10 @@
  		goto haltsys;
  	}

 -	boothowto = howto;
 +	/* verbosity flags persist */
 +	boothowto = (howto & ~AB_VERBOSITY_MASK)
 +	    | (boothowto & AB_VERBOSITY_MASK);
 +
  	if ((howto & RB_NOSYNC) == 0 && waittime < 0) {
  		waittime = 0;
  		vfs_shutdown();

 --DocE+STaALJfprDB--

State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 31 Dec 2022 05:12:05 +0000
State-Changed-Why:
This doesn't seem to have been committed; any reason not to?


Responsible-Changed-From-To: kern-bug-people->martin
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Sat, 31 Dec 2022 10:08:56 +0000
Responsible-Changed-Why:
I'll deal with it


State-Changed-From-To: feedback->open
State-Changed-By: martin@NetBSD.org
State-Changed-When: Sat, 31 Dec 2022 10:08:56 +0000
State-Changed-Why:
Needs more work (next year)


From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/38937 (aprint_debug calls make no sense during shutdown)
Date: Sat, 31 Dec 2022 11:07:48 +0100

 On Sat, Dec 31, 2022 at 05:12:05AM +0000, dholland@NetBSD.org wrote:
 > This doesn't seem to have been committed; any reason not to?

 The patch is only a sample fix for i386, would need to do an all-arch
 sweep, but otherwise: yes, it should be commited.

 Martin

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: gnats-precook-prs,v 1.4 2018/12/21 14:20:20 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.