NetBSD Problem Report #55814

From tsutsui@ceres.dti.ne.jp  Thu Nov 19 15:05:33 2020
Return-Path: <tsutsui@ceres.dti.ne.jp>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id B0C1B1A921F
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 19 Nov 2020 15:05:33 +0000 (UTC)
Message-Id: <202011191505.0AJF5OOK005796@ceres.dti.ne.jp>
Date: Fri, 20 Nov 2020 00:05:24 +0900 (JST)
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Reply-To: tsutsui@ceres.dti.ne.jp
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: setroot(9) doesn't show "root on xxNa" if RB_ASKNAME is specified
X-Send-Pr-Version: 3.95

>Number:         55814
>Category:       kern
>Synopsis:       setroot(9) doesn't show "root on xxNa" if RB_ASKNAME is specified
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    mlelstv
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 19 15:10:00 +0000 2020
>Closed-Date:    Sun Apr 11 02:00:06 +0000 2021
>Last-Modified:  Sun Apr 11 02:00:06 +0000 2021
>Originator:     Izumi Tsutsui
>Release:        NetBSD 9.1
>Organization:
>Environment:
System: NetBSD mirage 9.1 NetBSD 9.1 (GENERIC) #0: Sun Oct 18 19:24:30 UTC 2020 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386 but maybe MI
Machine: i386 but maybe MI
>Description:
When a kernel is boot with RB_ASKNAME (or no bootinfo),
setroot(9) longer show "root on wd0a" etc.
but only show " dumps on wd0b" etc.

>How-To-Repeat:
Boot kernels wit RB_ASKNAME.

NetBSD/dreamcast 8.0:
 https://dmesgd.nycbug.org/index.cgi?do=view&id=4618
---
wd0 at atabus0 drive 1
wd0: <SDCFHS-032G>
wd0: drive supports 1-sector PIO transfers, LBA48 addressing
wd0: 30535 MB, 62041 cyl, 16 head, 63 sec, 512 bytes/sect x 62537328 sectors
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)
root device: wd0
dump device (default wd0b): 
file system (default generic): 
root on wd0a dumps on wd0b
root file system type: ffs
---

NetBSD/dreamcast 9.0:
 https://dmesgd.nycbug.org/index.cgi?do=view&id=5406
---
wd0 at atabus0 drive 1
wd0: <SDCFHS-032G>
wd0: drive supports 1-sector PIO transfers, LBA48 addressing
wd0: 30535 MB, 62041 cyl, 16 head, 63 sec, 512 bytes/sect x 62537328 sectors
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)root device: wd0a
dump device (default wd0b): 
file system (default generic): 
 dumps on wd0b
root file system type: ffs
---

>Fix:
Maybe something wrong in the following "no functional" change?

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_subr.c#rev1.221
> Refactor setroot, no functional change intended.
> 
> setroot
> - prepare special cases
> - loop until root is set
> 
> setroot_nfs
> - special case for disk boot + NFS root
> 
> setroot_ask
> - Prompt user
> 
> setroot_root
> - set root device
> 
> setroot_dump
> - set dump device

---
Izumi Tsutsui

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->mlelstv
Responsible-Changed-By: mlelstv@NetBSD.org
Responsible-Changed-When: Thu, 19 Nov 2020 16:47:30 +0000
Responsible-Changed-Why:
My bug


From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/55814: setroot(9) doesn't show "root on xxNa" if RB_ASKNAME is specified
Date: Sat, 21 Nov 2020 08:16:47 -0000 (UTC)

 tsutsui@ceres.dti.ne.jp (Izumi Tsutsui) writes:

 >When a kernel is boot with RB_ASKNAME (or no bootinfo),
 >setroot(9) longer show "root on wd0a" etc.
 >but only show " dumps on wd0b" etc.

 I've committed a fix, please verify.

 -- 
 -- 
                                 Michael van Elst
 Internet: mlelstv@serpens.de
                                 "A potential Snark may lurk in every tree."

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@netbsd.org
Cc: mlelstv@netbsd.org, tsutsui@ceres.dti.ne.jp
Subject: Re: kern/55814: setroot(9) doesn't show "root on xxNa" if RB_ASKNAME
	 is specified
Date: Mon, 23 Nov 2020 01:56:30 +0900

 >  >When a kernel is boot with RB_ASKNAME (or no bootinfo),
 >  >setroot(9) longer show "root on wd0a" etc.
 >  >but only show " dumps on wd0b" etc.
 >  
 >  I've committed a fix, please verify.

 Works as expected at least on patched NetBSD/i386 9.1 with "boot -as":
 ---
 [     6.056051] boot device: sd0
 [     6.056051] root device (default sd0a): 
 [     6.640756] dump device (default sd0b): 
 [     6.879593] file system (default generic): 
 [     6.905757] root on sd0a dumps on sd0b
 [     6.911814] root file system type: ffs
 [     6.911814] kern.module.path=/stand/i386/9.1/modules
 ---

 However duplicating printf lines after "refactoring" doesn't seem
 so good, IMO.

 ---
 static void
 setroot_ask(device_t bootdv, int bootpartition)
 {
 [snip]

 	switch (device_class(rootdv)) {
 	case DV_IFNET:
 	case DV_DISK:
 		aprint_normal("root on %s", device_xname(rootdv));
 		if (DEV_USES_PARTITIONS(rootdv))
 			aprint_normal("%c", (int)DISKPART(rootdev) + 'a');
 		break;
 	default:
 		printf("can't determine root device\n");
 		return;
 	}

 	root_device = rootdv;
 	setroot_dump(rootdv, dumpdv);
 }

 ---

 static void
 setroot_root(device_t bootdv, int bootpartition)
 {
 [snip]

 haveroot:
 	switch (device_class(rootdv)) {
 	case DV_IFNET:
 	case DV_DISK:
 		aprint_normal("root on %s", device_xname(rootdv));
 		if (DEV_USES_PARTITIONS(rootdv))
 			aprint_normal("%c", (int)DISKPART(rootdev) + 'a');
 		break;
 	default:
 		printf("can't determine root device\n");
 		return;
 	}

 	root_device = rootdv;
 	setroot_dump(rootdv, NULL);
 }

 ---
 Izumi Tsutsui

State-Changed-From-To: open->closed
State-Changed-By: tsutsui@NetBSD.org
State-Changed-When: Sun, 11 Apr 2021 02:00:06 +0000
State-Changed-Why:
Kernel messages have been fixed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.