NetBSD Problem Report #52895

From www@NetBSD.org  Wed Jan  3 19:17:01 2018
Return-Path: <www@NetBSD.org>
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 032F17A189
	for <gnats-bugs@gnats.NetBSD.org>; Wed,  3 Jan 2018 19:17:00 +0000 (UTC)
Message-Id: <20180103191700.367067A1DF@mollari.NetBSD.org>
Date: Wed,  3 Jan 2018 19:17:00 +0000 (UTC)
From: bsiegert@NetBSD.org
Reply-To: bsiegert@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: kernel assertion failure in iwm driver (NetBSD-8 amd64)
X-Send-Pr-Version: www-1.0

>Number:         52895
>Notify-List:    dogan@tesmer.org.tr
>Category:       kern
>Synopsis:       kernel assertion failure in iwm driver (NetBSD-8 amd64)
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    ozaki-r
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 03 19:20:00 +0000 2018
>Closed-Date:    Tue Jan 16 07:53:26 +0000 2018
>Last-Modified:  Sat Jan 20 15:15:01 +0000 2018
>Originator:     Benny Siegert
>Release:        NetBSD 8.0_BETA with DIAGNOSTIC option, compiled on Jan 3, 2018
>Organization:
The NetBSD Foundation
>Environment:
>Description:
See screenshot at https://twitter.com/bentsukun/status/948621036773367808.

Booting a NetBSD 8.0_BETA (amd64) kernel on an Intel NUC which has an iwm card triggers a panic due to a violated kernel assertion.

/usr/src/net/if.c, line 1819
panic: kernel diagnostic assertion "if_is_deactivated(ifp) || IFNET_LOCKED(ifp)" failed

This used to work with a kernel from a few months ago (October 2017 or so).
>How-To-Repeat:
Boot amd64 kernel (netbsd-8) on Intel hardware.
>Fix:
I strongly suspect pullup-8#456 to be the culprit, since that introduced the kassert.

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->ozaki-r
Responsible-Changed-By: bsiegert@NetBSD.org
Responsible-Changed-When: Sun, 07 Jan 2018 18:05:46 +0000
Responsible-Changed-Why:
ozaki-san, you were the one that sent the pull-up ticket causing the regression.
Could you take a look, please?


From: maya@netbsd.org
To: gnats-bugs@NetBSd.org
Cc: 
Subject: Re: kern/52895: kernel assertion failure in iwm driver (NetBSD-8
 amd64)
Date: Tue, 9 Jan 2018 01:56:22 +0000

 For the interested, backtrace:

 panic: kernel diagnostic assertion "if_is_deactivated(ifp) || IFNET_LOCKED(ifp)" failed, line 1828
 ifa_remove
 if_free_sadl
 if_alloc_sadl
 if_set_sadl
 ether_ifattach
 ieee80211_ifattach
 iwm_preinit

From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, ozaki-r@NetBSD.org, gnats-admin@netbsd.org, 
	netbsd-bugs@netbsd.org, bsiegert@NetBSD.org
Cc: dogan@tesmer.org.tr
Subject: Re: kern/52895: kernel assertion failure in iwm driver (NetBSD-8 amd64)
Date: Mon, 8 Jan 2018 21:24:32 -0500

 On Jan 9,  2:00am, maya@netbsd.org (maya@netbsd.org) wrote:
 -- Subject: Re: kern/52895: kernel assertion failure in iwm driver (NetBSD-8 

 Try:

 https://www.netbsd.org:~christos/if_iwn.c.diff

 christos

State-Changed-From-To: open->feedback
State-Changed-By: maya@NetBSD.org
State-Changed-When: Tue, 09 Jan 2018 19:27:46 +0000
State-Changed-Why:
Please try https://www.netbsd.org/~christos/if_iwm.c.diff


From: "Mustafa Dogan" <dogan@tesmer.org.tr>
To: gnats-bugs@NetBSD.org
Cc: ozaki-r@netbsd.org,
 netbsd-bugs@netbsd.org,
 gnats-admin@netbsd.org,
 maya@netbsd.org,
 bsiegert@netbsd.org
Subject: Re: kern/52895 (kernel assertion failure in iwm driver (NetBSD-8
 amd64))
Date: Tue, 9 Jan 2018 22:31:42 +0300

 > Synopsis: kernel assertion failure in iwm driver (NetBSD-8 amd64)
 >
 > State-Changed-From-To: open->feedback
 > State-Changed-By: maya@NetBSD.org
 > State-Changed-When: Tue, 09 Jan 2018 19:27:46 +0000
 > State-Changed-Why:
 > Please try https://www.netbsd.org/~christos/if_iwm.c.diff
 >

 Hi,
 I compiled new GENERIC kernel with patch you provided. My laptop booted
 without problem. Kernel seems OK.
 My first findings and improvements:
 - Before, "ifconfig iwm0 list scan" wasn't work and gives an error
 message. Now, list scan still doesn't work, doesn't give error, but adds to
 dmesg "iwm0: fatal firmware error" message.
 - Before, wpa_supplicant were associate with ~1 min or more latency. Now
 association is in ~5 sec.
 - iwm connects to network without problem.
 Thanks,
 Mustafa

From: christos@zoulas.com (Christos Zoulas)
To: "Mustafa Dogan" <dogan@tesmer.org.tr>, gnats-bugs@NetBSD.org
Cc: ozaki-r@netbsd.org, netbsd-bugs@netbsd.org, gnats-admin@netbsd.org, 
	maya@netbsd.org, bsiegert@netbsd.org
Subject: Re: kern/52895 (kernel assertion failure in iwm driver (NetBSD-8 amd64))
Date: Tue, 9 Jan 2018 18:59:06 -0500

 On Jan 9, 10:31pm, dogan@tesmer.org.tr ("Mustafa Dogan") wrote:
 -- Subject: Re: kern/52895 (kernel assertion failure in iwm driver (NetBSD-8 

 | > Synopsis: kernel assertion failure in iwm driver (NetBSD-8 amd64)
 | >
 | > State-Changed-From-To: open->feedback
 | > State-Changed-By: maya@NetBSD.org
 | > State-Changed-When: Tue, 09 Jan 2018 19:27:46 +0000
 | > State-Changed-Why:
 | > Please try https://www.netbsd.org/~christos/if_iwm.c.diff
 | >
 | 
 | Hi,
 | I compiled new GENERIC kernel with patch you provided. My laptop booted
 | without problem. Kernel seems OK.
 | My first findings and improvements:
 | - Before, "ifconfig iwm0 list scan" wasn't work and gives an error
 | message. Now, list scan still doesn't work, doesn't give error, but adds to
 | dmesg "iwm0: fatal firmware error" message.
 | - Before, wpa_supplicant were associate with ~1 min or more latency. Now
 | association is in ~5 sec.
 | - iwm connects to network without problem.

 I guess we have something wrong there, but if this is an improvement,
 we should probably just commit it.

 christos

From: "Ryota Ozaki" <ozaki-r@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52895 CVS commit: src/sys/net
Date: Wed, 10 Jan 2018 01:22:26 +0000

 Module Name:	src
 Committed By:	ozaki-r
 Date:		Wed Jan 10 01:22:26 UTC 2018

 Modified Files:
 	src/sys/net: if.c

 Log Message:
 Check MP-safety in ifa_insert and ifa_remove only for IFEF_MPSAFE drivers

 Eventually the assertions should pass for all drivers, however, at this point
 it's too eager.

 Fix PR kern/52895


 To generate a diff of this commit:
 cvs rdiff -u -r1.417 -r1.418 src/sys/net/if.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Alexander Nasonov <alnsn@yandex.ru>
To: Mustafa Dogan <dogan@tesmer.org.tr>
Cc: gnats-bugs@NetBSD.org, ozaki-r@netbsd.org, netbsd-bugs@netbsd.org,
	gnats-admin@netbsd.org, maya@netbsd.org, bsiegert@netbsd.org
Subject: Re: kern/52895 (kernel assertion failure in iwm driver (NetBSD-8
 amd64))
Date: Wed, 10 Jan 2018 09:25:38 +0000

 Mustafa Dogan wrote:
 > Hi,
 > I compiled new GENERIC kernel with patch you provided. My laptop booted
 > without problem. Kernel seems OK.
 > My first findings and improvements:
 > - Before, "ifconfig iwm0 list scan" wasn't work and gives an error
 > message. Now, list scan still doesn't work, doesn't give error, but adds to
 > dmesg "iwm0: fatal firmware error" message.
 > - Before, wpa_supplicant were associate with ~1 min or more latency. Now
 > association is in ~5 sec.
 > - iwm connects to network without problem.
 > Thanks,
 > Mustafa

 I haven't tried the new patch but I can tell how iwm0 worked for me for
 the past two years or so.

 - list scan works without problems (I don't use it very often, though)
 - wpa_supplicant connects instantly to my home network but it can take
   minutes to connect to iPhone hotspot
 - 'firmware error' or similar messages can appear when my laptop is
   booting with a pretty low probability (< 1-2%)
 - probability of hitting those errors increases significantly if
   I keep the laptop up for more than a day
 - weak signal increases the probability

 It crashed once (see kern/52583: kernel crash after iwm firmware error)
 recently, I don't remember any other crashes.

 My hw/fw are:

 iwm0: hw rev 0x210, fw ver 22.361476.0

 -- 
 Alex

From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52895 CVS commit: [netbsd-8] src/sys/net
Date: Sat, 13 Jan 2018 05:41:39 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Sat Jan 13 05:41:39 UTC 2018

 Modified Files:
 	src/sys/net [netbsd-8]: if.c

 Log Message:
 Pull up following revision(s) (requested by ozaki-r in ticket #486):
 	sys/net/if.c: revision 1.418
 Check MP-safety in ifa_insert and ifa_remove only for IFEF_MPSAFE drivers
 Eventually the assertions should pass for all drivers, however, at this point
 it's too eager.
 Fix PR kern/52895


 To generate a diff of this commit:
 cvs rdiff -u -r1.394.2.4 -r1.394.2.5 src/sys/net/if.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Ryota Ozaki <ozaki-r@netbsd.org>
To: "gnats-bugs@NetBSD.org" <gnats-bugs@netbsd.org>
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: PR/52895 CVS commit: [netbsd-8] src/sys/net
Date: Mon, 15 Jan 2018 11:35:13 +0900

 The assertion failure has been fixed in 8.0_BETA.
 Could you try again (w/o christos' patch)?

 Thanks,
   ozaki-r

 On Sat, Jan 13, 2018 at 2:45 PM, Soren Jacobsen <snj@netbsd.org> wrote:
 > The following reply was made to PR kern/52895; it has been noted by GNATS.
 >
 > From: "Soren Jacobsen" <snj@netbsd.org>
 > To: gnats-bugs@gnats.NetBSD.org
 > Cc:
 > Subject: PR/52895 CVS commit: [netbsd-8] src/sys/net
 > Date: Sat, 13 Jan 2018 05:41:39 +0000
 >
 >  Module Name:   src
 >  Committed By:  snj
 >  Date:          Sat Jan 13 05:41:39 UTC 2018
 >
 >  Modified Files:
 >         src/sys/net [netbsd-8]: if.c
 >
 >  Log Message:
 >  Pull up following revision(s) (requested by ozaki-r in ticket #486):
 >         sys/net/if.c: revision 1.418
 >  Check MP-safety in ifa_insert and ifa_remove only for IFEF_MPSAFE drivers
 >  Eventually the assertions should pass for all drivers, however, at this point
 >  it's too eager.
 >  Fix PR kern/52895
 >
 >
 >  To generate a diff of this commit:
 >  cvs rdiff -u -r1.394.2.4 -r1.394.2.5 src/sys/net/if.c
 >
 >  Please note that diffs are not public domain; they are subject to the
 >  copyright notices on the relevant files.
 >

State-Changed-From-To: feedback->closed
State-Changed-By: ozaki-r@NetBSD.org
State-Changed-When: Tue, 16 Jan 2018 07:53:26 +0000
State-Changed-Why:
The reporter confirmed the fix. Thanks.


From: "Mustafa Dogan" <dogan@tesmer.org.tr>
To: gnats-bugs@NetBSD.org
Cc: ozaki-r@netbsd.org,
 gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org,
 bsiegert@netbsd.org
Subject: Re: PR/52895 CVS commit: [netbsd-8] src/sys/net
Date: Tue, 16 Jan 2018 10:50:16 +0300

 Hi,
 I compiled new kernel with sources dated Jan 15, w/o Christos' patch. It
 booted w/o problem and seems working as expected. iwm is also working.
 Thanks,
 Mustafa Dogan

 > The following reply was made to PR kern/52895; it has been noted by GNATS.
 >
 > From: Ryota Ozaki <ozaki-r@netbsd.org>
 > To: "gnats-bugs@NetBSD.org" <gnats-bugs@netbsd.org>
 > Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
 > Subject: Re: PR/52895 CVS commit: [netbsd-8] src/sys/net
 > Date: Mon, 15 Jan 2018 11:35:13 +0900
 >
 >  The assertion failure has been fixed in 8.0_BETA.
 >  Could you try again (w/o christos' patch)?
 >
 >  Thanks,
 >    ozaki-r
 >
 >  On Sat, Jan 13, 2018 at 2:45 PM, Soren Jacobsen <snj@netbsd.org> wrote:
 >  > The following reply was made to PR kern/52895; it has been noted by
 > GNATS.
 >  >
 >  > From: "Soren Jacobsen" <snj@netbsd.org>
 >  > To: gnats-bugs@gnats.NetBSD.org
 >  > Cc:
 >  > Subject: PR/52895 CVS commit: [netbsd-8] src/sys/net
 >  > Date: Sat, 13 Jan 2018 05:41:39 +0000
 >  >
 >  >  Module Name:   src
 >  >  Committed By:  snj
 >  >  Date:          Sat Jan 13 05:41:39 UTC 2018
 >  >
 >  >  Modified Files:
 >  >         src/sys/net [netbsd-8]: if.c
 >  >
 >  >  Log Message:
 >  >  Pull up following revision(s) (requested by ozaki-r in ticket #486):
 >  >         sys/net/if.c: revision 1.418
 >  >  Check MP-safety in ifa_insert and ifa_remove only for IFEF_MPSAFE
 > drivers
 >  >  Eventually the assertions should pass for all drivers, however, at
 > this point
 >  >  it's too eager.
 >  >  Fix PR kern/52895
 >  >
 >  >
 >  >  To generate a diff of this commit:
 >  >  cvs rdiff -u -r1.394.2.4 -r1.394.2.5 src/sys/net/if.c
 >  >
 >  >  Please note that diffs are not public domain; they are subject to the
 >  >  copyright notices on the relevant files.
 >  >
 >
 >


From: Alexander Nasonov <alnsn@yandex.ru>
To: gnats-bugs@NetBSD.org
Cc: ozaki-r@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
	bsiegert@NetBSD.org, dogan@tesmer.org.tr
Subject: Re: kern/52895 (kernel assertion failure in iwm driver (NetBSD-8
 amd64))
Date: Tue, 16 Jan 2018 23:40:04 +0000

 Alexander Nasonov wrote:
 >  iwm0: hw rev 0x210, fw ver 22.361476.0

 With GENERIC_KASLR (-current) compiled today, the kernel doesn't
 crash but it doesn't configure iwm0. Do I need to update firmware
 in /libdata?

 -- 
 Alex

From: coypu@sdf.org
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/52895 (kernel assertion failure in iwm driver (NetBSD-8
 amd64))
Date: Wed, 17 Jan 2018 00:32:36 +0000

 > Do I need to update firmware

 If updating between 7.x probably. there was an update to iwm including a
 firmware update IIRC.

From: Alexander Nasonov <alnsn@yandex.ru>
To: Alexander Nasonov <alnsn@yandex.ru>
Cc: gnats-bugs@NetBSD.org, ozaki-r@NetBSD.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org, bsiegert@NetBSD.org, dogan@tesmer.org.tr
Subject: Re: kern/52895 (kernel assertion failure in iwm driver (NetBSD-8
 amd64))
Date: Sat, 20 Jan 2018 13:14:24 +0000

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

 Alexander Nasonov wrote:
 > Alexander Nasonov wrote:
 > >  iwm0: hw rev 0x210, fw ver 22.361476.0
 > 
 > With GENERIC_KASLR (-current) compiled today, the kernel doesn't
 > crash but it doesn't configure iwm0. Do I need to update firmware
 > in /libdata?

 Booting the new current kernel in a single user mode and typing
 ifconfig -a gives 'Device is not configured' error. Old kernel
 doesn't have this problem.

 I attach a complete diff of dmesg output of those two kernels.

 Alex

 --KsGdsel6WgEHnImy
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="dmesg.diff"

 --- /onetbsd.dmesg	2018-01-20 13:04:13.393327073 +0000
 +++ /netbsd.dmesg	2018-01-20 13:04:13.385385690 +0000
 @@ -2,2 +2,2 @@
 -    2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
 -    The NetBSD Foundation, Inc.  All rights reserved.
 +    2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
 +    2018 The NetBSD Foundation, Inc.  All rights reserved.
 @@ -7 +7 @@
 -NetBSD 8.99.7 (GENERIC) #0: Sat Nov 18 02:35:44 GMT 2017
 +NetBSD 8.99.12 (GENERIC) #0: Sat Jan 20 12:17:16 GMT 2018
 @@ -10 +10 @@
 -avail memory = 11808 MB
 +avail memory = 11807 MB
 @@ -61 +61 @@
 -ACPI: SSDT 0xFFFFE4036FF0DC10 00037F (v02 PmRef  Cpu0Cst  00003001 INTL 20120913)
 +ACPI: SSDT 0xFFFFE4036FEC0C10 00037F (v02 PmRef  Cpu0Cst  00003001 INTL 20120913)
 @@ -63 +63 @@
 -ACPI: SSDT 0xFFFFE4036FFEA810 000660 (v02 PmRef  Cpu0Ist  00003000 INTL 20120913)
 +ACPI: SSDT 0xFFFFE4036FFA0810 000660 (v02 PmRef  Cpu0Ist  00003000 INTL 20120913)
 @@ -65 +65 @@
 -ACPI: SSDT 0xFFFFE4036FFEA010 0005AA (v02 PmRef  ApIst    00003000 INTL 20120913)
 +ACPI: SSDT 0xFFFFE4036FFA0010 0005AA (v02 PmRef  ApIst    00003000 INTL 20120913)
 @@ -67 +67 @@
 -ACPI: SSDT 0xFFFFE40115BB1010 000119 (v02 PmRef  ApCst    00003000 INTL 20120913)
 +ACPI: SSDT 0xFFFFE40115BA2A50 000119 (v02 PmRef  ApCst    00003000 INTL 20120913)
 @@ -224 +224 @@
 -timecounter: Timecounter "TSC" frequency 2592878660 Hz quality 3000
 +timecounter: Timecounter "TSC" frequency 2592882340 Hz quality 3000
 @@ -226 +226 @@
 -uhub0 at usb0: vendor 8086 (0x8086) xHCI Root Hub (0000), class 9/0, rev 1.00/1.00, addr 0
 +uhub0 at usb0: vendor 8086 (0x8086) xHCI Root Hub (0000), class 9/0, rev 3.00/1.00, addr 0
 @@ -247 +247 @@
 -kern.module.path=/stand/amd64/8.99.7/modules
 +kern.module.path=/stand/amd64/8.99.12/modules

 --KsGdsel6WgEHnImy--

From: Alexander Nasonov <alnsn@yandex.ru>
To: Alexander Nasonov <alnsn@yandex.ru>
Cc: gnats-bugs@NetBSD.org, ozaki-r@NetBSD.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org, bsiegert@NetBSD.org, dogan@tesmer.org.tr
Subject: Re: kern/52895 (kernel assertion failure in iwm driver (NetBSD-8
 amd64))
Date: Sat, 20 Jan 2018 13:40:35 +0000

 Alexander Nasonov wrote:
 > Booting the new current kernel in a single user mode and typing
 > ifconfig -a gives 'Device is not configured' error. Old kernel
 > doesn't have this problem.
 > 
 > I attach a complete diff of dmesg output of those two kernels.

 I found the problem. My local copy of if_iwm.c contained a previous
 patch. Building from a clean copy of the tree fixed the problem.

 Alex

From: Benny Siegert <bsiegert@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: ozaki-r@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, 
	dogan@tesmer.org.tr
Subject: Re: kern/52895 (kernel assertion failure in iwm driver (NetBSD-8 amd64))
Date: Sat, 20 Jan 2018 16:11:36 +0100

 With the updated iwm driver, the assertion is fixed (or rather
 removed). However, the wireless connection seems quite flaky and drops
 often. I found that updating /libdata/firmware with the contents from
 -current results in a more stable connection.

>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.