NetBSD Problem Report #8639
Received: (qmail 29585 invoked from network); 17 Oct 1999 17:22:50 -0000
Message-Id: <199910171722.CAA01161@pc1-inoue.kusm.kyoto-u.ac.jp>
Date: Mon, 18 Oct 1999 02:22:43 +0900 (JST)
From: pf5y-inue@asahi-net.or.jp
Reply-To: pf5y-inue@asahi-net.or.jp
To: gnats-bugs@gnats.netbsd.org
Cc: pf5y-inue@asahi-net.or.jp
Subject: wdc bug
X-Send-Pr-Version: 3.95
>Number: 8639
>Category: kern
>Synopsis: wdc does not wake up forever
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Oct 17 10:24:01 +0000 1999
>Closed-Date: Fri Oct 22 10:38:48 +0000 1999
>Last-Modified: Fri Oct 22 10:39:25 +0000 1999
>Originator: INOUE Yoshinari
>Release: NetBSD 1.4.1
>Organization:
ASAHI-NET, JAPAN
>Environment:
Casio FIVA MPC-101M32
System: NetBSD pc1-inoue.kusm.kyoto-u.ac.jp 1.4.1 NetBSD 1.4.1 (J) #47: Mon Oct 18 00:18:21 JST 1999 inoue@pc1-inoue.kusm.kyoto-u.ac.jp:/home/inoue/src/NetBSD/sys.bak/arch/i386/compile/J i386
>Description:
wdc_exec_command() does not wake up forever when __wdccommand_intr()
ignores IRQ.
>How-To-Repeat:
On Casio FIVA, NetBSD kernel with APM support fails to boot.
I believe NetBSD-current has the same bug.
>Fix:
--- wdc.c.org Thu Jun 24 09:06:01 1999
+++ wdc.c Sun Oct 17 22:57:27 1999
@@ -1078,8 +1078,11 @@
chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive), DEBUG_INTR);
if (wdcwait(chp, wdc_c->r_st_pmask, wdc_c->r_st_pmask,
(irq == 0) ? wdc_c->timeout : 0)) {
- if (irq && (xfer->c_flags & C_TIMEOU) == 0)
+ if (irq && (xfer->c_flags & C_TIMEOU) == 0) {
+ chp->ch_flags |= WDCF_IRQ_WAIT;
+ timeout(wdctimeout, chp, hz);
return 0; /* IRQ was not for us */
+ }
wdc_c->flags |= AT_TIMEOU;
__wdccommand_done(chp, xfer);
return 1;
---
INOUE, Yoshinari pf5y-inue@asahi-net.or.jp
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback
State-Changed-By: bouyer
State-Changed-When: Tue Oct 19 08:05:09 PDT 1999
State-Changed-Why:
I believe this has been fixed in -current and the release branch since 1.4.1
has been released. Could you try a kernel from the sources in:
ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-release/tar_files/src/sys.tar.gz
and tell me if the problem is still here ?
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: pf5y-inue@asahi-net.or.jp
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: kern/8639
Date: Tue, 19 Oct 1999 20:35:45 +0200
On Wed, Oct 20, 1999 at 02:00:09AM +0900, pf5y-inue@asahi-net.or.jp wrote:
> Thank you for your response. I just have tried it, but I still have to
> modify wdc.c as follows to boot my machine.
>
> --- wdc.c.org Wed Oct 20 00:42:31 1999
> +++ wdc.c Wed Oct 20 01:32:28 1999
> @@ -1108,8 +1108,10 @@
> chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive), DEBUG_INTR);
> if (wdcwait(chp, wdc_c->r_st_pmask, wdc_c->r_st_pmask,
> (irq == 0) ? wdc_c->timeout : 0)) {
> - if (irq && (xfer->c_flags & C_TIMEOU) == 0)
> + if (irq && (xfer->c_flags & C_TIMEOU) == 0) {
> + chp->ch_flags |= WDCF_IRQ_WAIT;
> return 0; /* IRQ was not for us */
> + }
> wdc_c->flags |= AT_TIMEOU;
> __wdccommand_done(chp, xfer);
> return 1;
You're rigth, there's a problem here. There are similar botches at other
places in the kernel with the same problem, so I think the rigth thing is to
handle this in wdcintr - where the WDCF_IRQ_WAIT flag gets cleared.
Could you test the following patch and tell me how it goes please ?
--
Manuel Bouyer, LIP6, Universite Paris VI. Manuel.Bouyer@lip6.fr
--
Index: wdc.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/wdc.c,v
retrieving revision 1.74
diff -u -r1.74 wdc.c
--- wdc.c 1999/09/23 11:04:32 1.74
+++ wdc.c 1999/10/19 18:32:45
@@ -646,6 +646,7 @@
{
struct channel_softc *chp = arg;
struct wdc_xfer *xfer;
+ int ret;
if ((chp->ch_flags & WDCF_IRQ_WAIT) == 0) {
WDCDEBUG_PRINT(("wdcintr: inactive controller\n"), DEBUG_INTR);
@@ -655,7 +656,10 @@
WDCDEBUG_PRINT(("wdcintr\n"), DEBUG_INTR);
chp->ch_flags &= ~WDCF_IRQ_WAIT;
xfer = chp->ch_queue->sc_xfer.tqh_first;
- return xfer->c_intr(chp, xfer, 1);
+ ret = xfer->c_intr(chp, xfer, 1);
+ if (ret == 0) /* irq was not for us, still waiting for irq */
+ chp->ch_flags |= WDCF_IRQ_WAIT;
+ return (ret);
}
/* Put all disk in RESET state */
From: pf5y-inue@asahi-net.or.jp
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: pf5y-inue@asahi-net.or.jp, gnats-bugs@gnats.netbsd.org
Subject: Re: kern/8639
Date: Wed, 20 Oct 1999 15:47:00 +0900
In message <19991019203544.A28915@antioche.lip6.fr> you write:
>You're rigth, there's a problem here. There are similar botches at other
>places in the kernel with the same problem, so I think the rigth thing is to
>handle this in wdcintr - where the WDCF_IRQ_WAIT flag gets cleared.
>
>Could you test the following patch and tell me how it goes please ?
(snip)
It works fine on my machine. Thank you.
---
Yoshinari Inoue pf5y-inue@asahi-net.or.jp
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: pf5y-inue@asahi-net.or.jp
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: kern/8639
Date: Thu, 21 Oct 1999 16:38:49 +0200
On Wed, Oct 20, 1999 at 03:47:00PM +0900, pf5y-inue@asahi-net.or.jp wrote:
> In message <19991019203544.A28915@antioche.lip6.fr> you write:
> >You're rigth, there's a problem here. There are similar botches at other
> >places in the kernel with the same problem, so I think the rigth thing is to
> >handle this in wdcintr - where the WDCF_IRQ_WAIT flag gets cleared.
> >
> >Could you test the following patch and tell me how it goes please ?
> (snip)
>
> It works fine on my machine. Thank you.
Ok, thanks. I commited the fix and asked for a pullup to the release banch.
I should be able to close your PR soon :)
--
Manuel Bouyer, LIP6, Universite Paris VI. Manuel.Bouyer@lip6.fr
--
State-Changed-From-To: feedback->closed
State-Changed-By: bouyer
State-Changed-When: Fri Oct 22 03:38:48 PDT 1999
State-Changed-Why:
-current and -release have been fixed.
>Unformatted:
(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.