NetBSD Problem Report #54157

From martin@duskware.de  Fri May  3 11:56:32 2019
Return-Path: <martin@duskware.de>
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 887B97A18B
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  3 May 2019 11:56:32 +0000 (UTC)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: aprint_normal_dev without device pointer
X-Send-Pr-Version: 3.95

>Number:         54157
>Category:       kern
>Synopsis:       aprint_normal_dev without device pointer
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 03 12:00:00 +0000 2019
>Last-Modified:  Fri May 03 15:30:01 +0000 2019
>Originator:     Martin Husemann
>Release:        NetBSD 8.99.37
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD sunset-glow.duskware.de 8.0_STABLE NetBSD 8.0_STABLE (GENERIC.MP) #0: Sun Apr 28 08:46:17 UTC 2019 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/sparc/compile/GENERIC.MP sparc
Architecture: sparc
Machine: sparc
>Description:

Due to a different bug (see kern/54156) during scsi bus probe I get into
this (reproducably, on every boot). Since sd/cd/... whatever scsi devices
did not (yet?) attach, the periph_dev pointer is NULL.

[   7.2391745] panic: kernel diagnostic assertion "dv != NULL" failed: file "../../../../kern/subr_prf.c", line 811 
[   7.2391745] cpu0: Begin traceback...
[   7.2391745] 0x0(0xf0451880, 0xfa179c28, 0xf0544c00, 0xf0545c00, 0xf0545b80, 0x104) at netbsd:kern_assert+0x3c
[   7.2391745] kern_assert(0xf0451880, 0xf0451870, 0xf049d648, 0xf049d560, 0x32b, 0x4) at netbsd:aprint_normal_dev+0x60
[   7.2391745] aprint_normal_dev(0x0, 0xf04823b0, 0x0, 0x0, 0xffff, 0xf1125820) at netbsd:scsi_async_event_xfer_mode+0x164
[   7.2391745] scsi_async_event_xfer_mode(0xf1297668, 0xfa179d68, 0x1080, 0xf04823b0, 0x0, 0xf1125820) at netbsd:scsipi_async_event+0x134
[   7.2391745] scsipi_async_event(0xf1297668, 0x1, 0xfa179d68, 0x1, 0xc0, 0xf1368810) at netbsd:ncr53c9x_update_xfer_mode+0x80
[   7.2391745] ncr53c9x_update_xfer_mode(0xf1297608, 0xf1101d10, 0xf1112860, 0xf0682000, 0x700, 0xf0525400) at netbsd:ncr53c9x_init+0x118
[   7.2391745] ncr53c9x_init(0xf1297608, 0x1, 0xf12977d6, 0x19, 0xb, 0x4) at netbsd:ncr53c9x_timeout+0x168
[   7.2391745] ncr53c9x_timeout(0xf12977d4, 0x2, 0xf12a4020, 0xf1125820, 0xf12a3fa8, 0xf1297608) at netbsd:callout_softclock+0x3cc
[   7.2391745] callout_softclock(0xf0451870, 0xf0451880, 0xf0542d10, 0x11deeba1, 0xf0542cb0, 0xf12a4030) at netbsd:softint_thread+0xfc
[   7.2391745] softint_thread(0x0, 0x0, 0xfa170218, 0xf0002000, 0xf1112860, 0x2000) at netbsd:lwp_trampoline+0x8


>How-To-Repeat:

Try to boot a -current kernel on a SS20

>Fix:
n/a

>Audit-Trail:
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/54157: aprint_normal_dev without device pointer
Date: Fri, 3 May 2019 13:33:21 -0000 (UTC)

 martin@NetBSD.org writes:

 >Due to a different bug (see kern/54156) during scsi bus probe I get into
 >this (reproducably, on every boot). Since sd/cd/... whatever scsi devices
 >did not (yet?) attach, the periph_dev pointer is NULL.

 Maybe following the example of scsi_print_addr:

 Index: scsi_base.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/scsipi/scsi_base.c,v
 retrieving revision 1.92
 diff -p -u -r1.92 scsi_base.c
 --- scsi_base.c	17 Jun 2017 22:35:50 -0000	1.92
 +++ scsi_base.c	3 May 2019 13:32:19 -0000
 @@ -136,9 +136,17 @@ scsi_kill_pending(struct scsipi_periph *
  static void
  scsi_print_xfer_mode(struct scsipi_periph *periph)
  {
 +	struct scsipi_channel *chan = periph->periph_channel;
 +	struct scsipi_adapter *adapt = chan->chan_adapter;
  	int period, freq, speed, mbs;

 -	aprint_normal_dev(periph->periph_dev, "");
 +	if (periph->periph_dev)
 +		aprint_normal_dev(periph->periph_dev, "");
 +	else
 +		aprint_normal("probe(%s:%d:%d:%d): ",
 +			device_xname(adapt->adapt_dev),
 +			chan->chan_channel, periph->periph_target,
 +			periph->periph_lun);
  	if (periph->periph_mode & (PERIPH_CAP_SYNC | PERIPH_CAP_DT)) {
  		period = scsipi_sync_factor_to_period(periph->periph_period);
  		aprint_normal("sync (%d.%02dns offset %d)",


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

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org, martin@NetBSD.org
Subject: Re: kern/54157: aprint_normal_dev without device pointer
Date: Fri, 3 May 2019 17:28:10 +0200

 On Fri, May 03, 2019 at 01:35:01PM +0000, Michael van Elst wrote:
 >  Maybe following the example of scsi_print_addr:

 That makes it work - LGTM.

 Martin

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 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.