NetBSD Problem Report #38502

From martin@duskware.de  Thu Apr 24 21:09:26 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 80F7763B874
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 24 Apr 2008 21:09:26 +0000 (UTC)
Message-Id: <20080424210923.E901F33A85@mail.duskware.de>
Date: Thu, 24 Apr 2008 23:09:23 +0200 (CEST)
From: martin@duskware.de
Reply-To: martin@duskware.de
To: gnats-bugs@gnats.NetBSD.org
Subject: ifconfig wi0 hangs
X-Send-Pr-Version: 3.95

>Number:         38502
>Category:       kern
>Synopsis:       ifconfig wi0 hangs
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    ad
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 24 21:10:02 +0000 2008
>Closed-Date:    Tue Apr 29 19:51:21 +0000 2008
>Last-Modified:  Tue Apr 29 19:51:21 +0000 2008
>Originator:     Martin Husemann
>Release:        NetBSD 4.99.61
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD somnambulist.duskware.de 4.99.61 NetBSD 4.99.61 (SOMNA) #10: Thu Apr 24 20:56:09 CEST 2008 martin@night-porter.duskware.de:/usr/src/sys/arch/sparc/compile/SOMNA sparc
Architecture: sparc
Machine: sparc
>Description:

With a -current kernel as of a few hours ago (after the socket merge) I can
not "ifconfig wi0 ..." on my Sparc LX any more. The system just hangs idle:

db> bt
cpu_Debugger(0xf0480640, 0x0, 0x17, 0xf022c408, 0x98, 0x4c0) at netbsd:zsc_intr_
hard+0x78
zsc_intr_hard(0xf0480600, 0x7ffffc00, 0x2071871, 0x16c6, 0xffff, 0xfe073571) at$
etbsd:zshard+0x2c
zshard(0x0, 0xf0168cf4, 0xf00, 0x418000e6, 0x414000e6, 0x41400fe6) at netbsd:spa
rc_interrupt44c+0x128
sparc_interrupt44c(0x1, 0x0, 0xf01d1eb0, 0x0, 0x0, 0xf00022f0) at netbsd:sched_c
urcpu_runnable_p+0x28
sched_curcpu_runnable_p(0xf35a6d80, 0xf35a6d80, 0xffff, 0x0, 0xf0482f6c, 0xfffff
ffc) at netbsd:lwp_trampoline+0x8
db> ps /l
 PID         LID S     FLAGS       STRUCT LWP *               NAME WAIT 
 5             1 3         4           f35a9260           ifconfig nelldel
 2             1 3        84           f35a9020               tcsh pause
 1             1 3        84           f35ad6c0               init wait  
>0            24 3       204           f35add80        vmem_rehash vmem_rehash
              23 3       204           f35adb40           aiodoned aiodoned
              22 3       204           f35ad900            ioflush syncer
              21 3       204           f35ad480           pgdaemon pgdaemon
              12 3       204           f35a96e0              nell0 nellevt
              11 3       204           f35a9920           scsibus0 sccomp
              10 3       204           f35a9b60           pmfevent pmfevent
               9 3       204           f35a9da0            cachegc cachegc
               8 3       204           f35a6000              vrele vrele  
               7 3       204           f35a6240            xcall/0 xcall
               6 1       204           f35a6480          softser/0
               5 3       204           f35a66c0          softclk/0 tstile
               4 1       204           f35a6900          softbio/0
               3 1       204           f35a6b40          softnet/0
           >   2 7  20000205           f35a6d80             idle/0
               1 3       204           f01f2ae0            swapper schedule


This wi0 is at pcmcia @ nell0 @ sbus.

>How-To-Repeat:
ifconfig wi0 192.x.x.x

Yesterdays kernel worked fine, userland has not been updated.

>Fix:
n/a

>Release-Note:

>Audit-Trail:
From: Andrew Doran <ad@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/38502: ifconfig wi0 hangs
Date: Thu, 24 Apr 2008 22:31:10 +0100

 On Thu, Apr 24, 2008 at 09:10:03PM +0000, martin@duskware.de wrote:

 >  PID         LID S     FLAGS       STRUCT LWP *               NAME WAIT 
 >  5             1 3         4           f35a9260           ifconfig nelldel

 t/a f35a9260

 >                5 3       204           f35a66c0          softclk/0 tstile

 t/a f35a66c0

 LOCKDEBUG is also likely to be of use here, instead of a simple deadlock it could be
 leaking a lock somewhere.

 Thanks,
 Andrew

From: Martin Husemann <martin@duskware.de>
To: Andrew Doran <ad@netbsd.org>
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org
Subject: Re: kern/38502: ifconfig wi0 hangs
Date: Fri, 25 Apr 2008 00:12:02 +0200

 On Thu, Apr 24, 2008 at 09:35:02PM +0000, Andrew Doran wrote:
 >  LOCKDEBUG is also likely to be of use here, instead of a simple deadlock it could be
 >  leaking a lock somewhere.

 LOCKDEBUG didn't turn up anything, but I missed the obvious: it sleeps 
 in src/sys/dev/sbus/stp4020.c line 1185:

 	tsleep(sc, 0, "nelldel", ticks);

 with ticks==40 and never awakes.


 Martin

From: Martin Husemann <martin@duskware.de>
To: Andrew Doran <ad@netbsd.org>
Cc: gnats-bugs@NetBSD.org
Subject: Re: kern/38502: ifconfig wi0 hangs
Date: Fri, 25 Apr 2008 00:33:02 +0200

 On Fri, Apr 25, 2008 at 12:12:02AM +0200, Martin Husemann wrote:
 > 	tsleep(sc, 0, "nelldel", ticks);
 > 
 > with ticks==40 and never awakes.

 This happens the first time this function is called !cold - backtrace
 is:

 stp4020_delay(0xf0541ea0, 0xf019036c, 0xf0541ea0, 0xf0267400, 0x29, 0xf0267800) a
 t netbsd:pcmcia_socket_enable+0x20
 pcmcia_socket_enable(0xf0541c00, 0xf04df580, 0x7, 0xf0062770, 0xf0542000, 0xf053
 f8a8) at netbsd:pcmcia_function_enable+0x24                                    
 pcmcia_function_enable(0xf04df580, 0x7, 0xf0062770, 0xf0542000, 0x1, 0xf35e9260)
  at netbsd:wi_pcmcia_enable+0x38                                               
 wi_pcmcia_enable(0xf0542000, 0x700, 0x80000000, 0x0, 0x41400fe2, 0x41400fe2) at n
 etbsd:wi_init+0x40
 wi_init(0xf0542088, 0xf053f86c, 0xf052d078, 0xf01efe50, 0x675, 0x41400fe3) at ne
 tbsd:ether_ioctl+0x144                                                         
 ether_ioctl(0xf0542088, 0x8090690c, 0xf053f800, 0x8090690c, 0x41400fe4, 0x41400f
 e4) at netbsd:ieee80211_ioctl+0x1a34                                           
 ieee80211_ioctl(0xf05422a8, 0x8090690c, 0xf053f800, 0xf35e9260, 0xf0002000, 0xf0
 271878) at netbsd:wi_ioctl+0xb58                                               
 wi_ioctl(0xf0542088, 0x8090690c, 0xf053f800, 0xf0267400, 0x29, 0xf0267800) at ne
 tbsd:in_ifinit+0x13c                                                           
 in_ifinit(0xf0542088, 0xf053f800, 0xf3d4ee40, 0x0, 0x8040691a, 0xf053f8a8) at ne
 tbsd:in_control+0xc44                                                          
 in_control(0x0, 0x8040691a, 0xf3d4ee30, 0xf0542088, 0x1, 0xf35e9260) at netbsd:i
 fioctl+0x574                                                                   
 ifioctl(0x2d, 0x8040691a, 0xf3d4ee30, 0xf35e9260, 0x0, 0x0) at netbsd:sys_ioctl+
 0x224                                                                          

From: Andrew Doran <ad@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/38502: ifconfig wi0 hangs
Date: Thu, 24 Apr 2008 23:46:32 +0100

 On Thu, Apr 24, 2008 at 10:35:02PM +0000, Martin Husemann wrote:
 > The following reply was made to PR kern/38502; it has been noted by GNATS.
 > 
 > From: Martin Husemann <martin@duskware.de>
 > To: Andrew Doran <ad@netbsd.org>
 > Cc: gnats-bugs@NetBSD.org
 > Subject: Re: kern/38502: ifconfig wi0 hangs
 > Date: Fri, 25 Apr 2008 00:33:02 +0200
 > 
 >  On Fri, Apr 25, 2008 at 12:12:02AM +0200, Martin Husemann wrote:
 >  > 	tsleep(sc, 0, "nelldel", ticks);
 >  > 
 >  > with ticks==40 and never awakes.
 >  
 >  This happens the first time this function is called !cold - backtrace
 >  is:
 >  
 >  stp4020_delay(0xf0541ea0, 0xf019036c, 0xf0541ea0, 0xf0267400, 0x29, 0xf0267800) a
 >  t netbsd:pcmcia_socket_enable+0x20
 >  pcmcia_socket_enable(0xf0541c00, 0xf04df580, 0x7, 0xf0062770, 0xf0542000, 0xf053
 >  f8a8) at netbsd:pcmcia_function_enable+0x24                                    
 >  pcmcia_function_enable(0xf04df580, 0x7, 0xf0062770, 0xf0542000, 0x1, 0xf35e9260)
 >   at netbsd:wi_pcmcia_enable+0x38                                               
 >  wi_pcmcia_enable(0xf0542000, 0x700, 0x80000000, 0x0, 0x41400fe2, 0x41400fe2) at n
 >  etbsd:wi_init+0x40
 >  wi_init(0xf0542088, 0xf053f86c, 0xf052d078, 0xf01efe50, 0x675, 0x41400fe3) at ne
 >  tbsd:ether_ioctl+0x144                                                         
 >  ether_ioctl(0xf0542088, 0x8090690c, 0xf053f800, 0x8090690c, 0x41400fe4, 0x41400f
 >  e4) at netbsd:ieee80211_ioctl+0x1a34                                           
 >  ieee80211_ioctl(0xf05422a8, 0x8090690c, 0xf053f800, 0xf35e9260, 0xf0002000, 0xf0
 >  271878) at netbsd:wi_ioctl+0xb58                                               
 >  wi_ioctl(0xf0542088, 0x8090690c, 0xf053f800, 0xf0267400, 0x29, 0xf0267800) at ne
 >  tbsd:in_ifinit+0x13c                                                           
 >  in_ifinit(0xf0542088, 0xf053f800, 0xf3d4ee40, 0x0, 0x8040691a, 0xf053f8a8) at ne
 >  tbsd:in_control+0xc44                                                          
 >  in_control(0x0, 0x8040691a, 0xf3d4ee30, 0xf0542088, 0x1, 0xf35e9260) at netbsd:i
 >  fioctl+0x574                                                                   
 >  ifioctl(0x2d, 0x8040691a, 0xf3d4ee30, 0xf35e9260, 0x0, 0x0) at netbsd:sys_ioctl+
 >  0x224                                                                          

 It's a deadlock.. The softclk thread does wakeups for tsleep. It's blocked
 waiting for softnet_lock (presumably running some kind of IP stack callout)
 and so can't proceeed to wake up the nell thread, which holds the lock and
 is sleeping. I guess that we need to drop softnet_lock at some point during
 in_control() processing but I don't know without looking at it in detail.
 I'll fix it tomorrow unless someone beats me to it.

 Thanks,
 Andrew

Responsible-Changed-From-To: kern-bug-people->ad
Responsible-Changed-By: ad@NetBSD.org
Responsible-Changed-When: Sat, 26 Apr 2008 09:00:20 +0000
Responsible-Changed-Why:
I'm working on it.


State-Changed-From-To: open->analyzed
State-Changed-By: ad@NetBSD.org
State-Changed-When: Sat, 26 Apr 2008 09:00:20 +0000
State-Changed-Why:
It's tough to see where softnet_lock should be dropped, but I think
that is the basic solution.


State-Changed-From-To: analyzed->feedback
State-Changed-By: ad@NetBSD.org
State-Changed-When: Tue, 29 Apr 2008 18:36:31 +0000
State-Changed-Why:
I think this should be fixed now, can you confirm?


State-Changed-From-To: feedback->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Tue, 29 Apr 2008 19:51:21 +0000
State-Changed-Why:
yes, it works - thanks!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.