Subject: kern/33137: The 'wdc at pcmcia' cannot attach wd
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <kiyohara@kk.iij4u.or.jp>
List: netbsd-bugs
Date: 03/24/2006 01:55:00
>Number:         33137
>Category:       kern
>Synopsis:       The 'wdc at pcmcia' cannot attach wd
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 24 01:55:00 +0000 2006
>Originator:     KIYOHARA Takashi
>Release:        -current
>Organization:
>Environment:
NetBSD  3.99.17 NetBSD 3.99.17 (OMSAL400) #3: Fri Mar 24 03:11:23 JST 2006  lance@highpriestess.fool:/usr/src/sys/arch/evbmips/compile/OMSAL400 evbmips

>Description:
The 'wdc at pcmcia' cannot attach wd before root-device is asked. 
Because there is a possibility that root-device is asked while it
is tsleep(9). However, if other drivers pending to configure, it
will not notice besides. 

>How-To-Repeat:

>Fix:
The config_pending_{incr,decr}(9) necessary for us. Or, please use daley(9). 

e.g.

Index: wdc_pcmcia.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pcmcia/wdc_pcmcia.c,v
retrieving revision 1.104
diff -u -r1.104 wdc_pcmcia.c
--- wdc_pcmcia.c        22 Jan 2006 00:08:38 -0000      1.104
+++ wdc_pcmcia.c        24 Mar 2006 01:16:20 -0000
@@ -318,7 +318,16 @@
         * and probe properly, so give them half a second.
         * See PR 25659 for details.
         */
+#if 1
+printf("%s: %d: May we sleep?\n", __FILE__, __LINE__);
+printf("  config_pending_incr(9) is necessary for us perhaps.\n");
+printf("  or use delay(9)?\n");
+config_pending_incr();
+#endif
        tsleep(wdc_pcmcia_attach, PWAIT, "wdcattach", hz / 2);
+#if 1
+config_pending_decr();
+#endif
 
        wdcattach(&sc->ata_channel);
        ata_delref(&sc->ata_channel);