NetBSD Problem Report #14559
Received: (qmail 13874 invoked from network); 12 Nov 2001 17:17:15 -0000
Message-Id: <200111121717.fACHHCI02190@cattop.portalify.fi>
Date: Mon, 12 Nov 2001 19:17:12 +0200 (EET)
From: cat@iki.fi
Reply-To: cat@iki.fi
To: gnats-bugs@gnats.netbsd.org
Subject: 400ms lockup every minute in wi driver
X-Send-Pr-Version: 3.95
>Number: 14559
>Category: kern
>Synopsis: wi driver lockups for 400ms when trying to update statistics
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: martin
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Nov 12 17:18:00 +0000 2001
>Closed-Date: Mon Feb 18 18:18:49 +0000 2002
>Last-Modified: Mon Feb 18 18:18:49 +0000 2002
>Originator: Patrik Andersin
>Release: NetBSD 1.5Y
>Organization:
Portalify Ltd.
>Environment:
System: NetBSD cattop.portalify.fi 1.5Y NetBSD 1.5Y (CATTOP.cb2) #2: Fri Nov 9 13:21:55 EET 2001 root@cattop.portalify.fi:/usr/src/sys/arch/i386/compile/CATTOP.cb2 i386
Architecture: i386
Machine: i386
>Description:
Wi driver hangs for 400ms once a minute when it tries to update
statistics. This has been tested with Lucent Orinoco Silver card.
wi_inquire_stats() calls once minute:
wi_cmd(sc, WI_CMD_INQUIRE, WI_INFO_COUNTERS);
wi_cmd() gets through CSR_WRITE_2() lines but the for loop
after those, where it tests for cmd completed bit, loops from
0 to WI_TIMEOUT (65536).
>How-To-Repeat:
Just run ntpdate -b in a loop. You should notice when clock gets out of sync.
#!/bin/sh
while sleep 10
do
ntpdate -b time2.stupi.se
done
>Fix:
Workaround: Don't initialize statistics gathering.
In file sys/dev/ic/wi.c comment out callout_reset in wi_init():
#if 0
callout_reset(&sc->wi_stats_ch, STATS_FREQUENCY, wi_inquire_stats, sc);
#endif
>Release-Note:
>Audit-Trail:
From: joda@pdc.kth.se (Johan Danielsson)
To: cat@iki.fi
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: kern/14559: 400ms lockup every minute in wi driver
Date: 13 Nov 2001 09:09:56 +0100
--- wivar.h 2001/10/13 15:00:24 1.6
+++ wivar.h 2001/11/13 08:08:32
@@ -51,6 +51,7 @@
int sc_prism2;
int sc_prism2_ver;
int sc_pci; /* attach to PCI-Bus */
+ int sc_broken_stats_inquire;
bus_space_tag_t sc_iot; /* bus cookie */
bus_space_handle_t sc_ioh; /* bus i/o handle */
--- wi.c 2001/11/11 00:16:07 1.28
+++ wi.c 2001/11/13 08:09:22
@@ -484,14 +484,18 @@
if ((sc->sc_dev.dv_flags & DVF_ACTIVE) == 0)
return;
- callout_reset(&sc->wi_stats_ch, STATS_FREQUENCY, wi_inquire_stats, sc);
-
/* Don't do this while we're transmitting */
- if (ifp->if_flags & IFF_OACTIVE)
- return;
-
- wi_cmd(sc, WI_CMD_INQUIRE, WI_INFO_COUNTERS);
+ if (!(ifp->if_flags & IFF_OACTIVE)) {
+ if(wi_cmd(sc, WI_CMD_INQUIRE, WI_INFO_COUNTERS) == ETIMEDOUT) {
+ printf("%s: inquire operation timed out; disabling\n",
+ sc->sc_dev.dv_xname);
+ sc->sc_broken_stats_inquire++;
+ }
}
+ if(!sc->sc_broken_stats_inquire)
+ callout_reset(&sc->wi_stats_ch, STATS_FREQUENCY,
+ wi_inquire_stats, sc);
+}
void wi_inquire_scan(xsc)
void *xsc;
@@ -666,6 +670,9 @@
break;
}
+ if (i == WI_TIMEOUT)
+ return(ETIMEDOUT);
+
CSR_WRITE_2(sc, WI_PARAM0, val);
CSR_WRITE_2(sc, WI_PARAM1, 0);
CSR_WRITE_2(sc, WI_PARAM2, 0);
@@ -678,6 +685,9 @@
DELAY(1);
}
+ if (i == WI_TIMEOUT)
+ return(ETIMEDOUT);
+
/* Ack the command */
CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_CMD);
@@ -685,9 +695,6 @@
if (s & WI_STAT_CMD_RESULT)
return(EIO);
- if (i == WI_TIMEOUT)
- return(ETIMEDOUT);
-
return(0);
}
@@ -1646,7 +1653,9 @@
ifp->if_flags |= IFF_RUNNING;
ifp->if_flags &= ~IFF_OACTIVE;
- callout_reset(&sc->wi_stats_ch, STATS_FREQUENCY, wi_inquire_stats, sc);
+ if(!sc->sc_broken_stats_inquire)
+ callout_reset(&sc->wi_stats_ch, STATS_FREQUENCY,
+ wi_inquire_stats, sc);
out:
if (error) {
State-Changed-From-To: open->analyzed
State-Changed-By: martin
State-Changed-When: Sun Feb 17 02:58:49 PST 2002
State-Changed-Why:
The suggested patch is not acceptable.
On cards where the timeout does not happen, the card blocks the kernel still
for nearly 400 ms.
We simply can not poll for statistics inquiries to complete.
Responsible-Changed-From-To: kern-bug-people->martin
Responsible-Changed-By: martin
Responsible-Changed-When: Sun Feb 17 02:58:49 PST 2002
Responsible-Changed-Why:
I will look into this.
State-Changed-From-To: analyzed->feedback
State-Changed-By: martin
State-Changed-When: Sun Feb 17 11:25:03 PST 2002
State-Changed-Why:
I just commited a fix.
Can you please test if this works for you too?
Thansk,
Martin
State-Changed-From-To: feedback->closed
State-Changed-By: martin
State-Changed-When: Mon Feb 18 10:17:27 PST 2002
State-Changed-Why:
Submitter confirms the problem is solved in -current.
A pullup to the 1.5 branch is in teh work.
>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.