NetBSD Problem Report #35008
From perry@piermont.com Tue Nov 7 14:37:52 2006
Return-Path: <perry@piermont.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by narn.NetBSD.org (Postfix) with ESMTP id 9347C63B9FB
for <gnats-bugs@gnats.NetBSD.org>; Tue, 7 Nov 2006 14:37:52 +0000 (UTC)
Message-Id: <20061107144012.26F2C8D1FAC@ein.piermont.com>
Date: Tue, 7 Nov 2006 09:40:12 -0500 (EST)
From: perry@piermont.com
Reply-To: perry@piermont.com
To: gnats-bugs@NetBSD.org
Subject: viaide.c v1.35 sometimes fails horribly
X-Send-Pr-Version: 3.95
>Number: 35008
>Category: kern
>Synopsis: viaide.c v1.35 sometimes fails horribly
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: bouyer
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Nov 07 14:40:00 +0000 2006
>Closed-Date: Sat Feb 10 02:23:18 +0000 2007
>Last-Modified: Sat Feb 10 02:23:18 +0000 2007
>Originator: Perry E. Metzger
>Release: NetBSD 4.99.3
>Organization:
>Environment:
System: NetBSD ein.piermont.com 4.99.3 NetBSD 4.99.3 (ZWEI) #1: Mon Nov 6 21:29:02 EST 2006 perry@ein.piermont.com:/usr/src/sys/arch/amd64/compile/ZWEI amd64
Architecture: x86_64
Machine: amd64
>Description:
I'm running on an amd64 box with a viaide SATA controller. With ACPI
not on in the kernel, both version 1.34 and version 1.35 of viaide.c
lead to periodic failures to boot (perhaps one in every five times),
with the driver spewing errors during boot and failing to read the
disk.
However, this PR is about the behavior with ACPI turned on.
Version 1.35 leads to failure about one in every five to ten reboots.
I get lots of messages, most of which scroll off the screen,
preventing me from writing them down. :(
This is what was left on the screen that I could type in by hand:
[...]
: <ST506>
wd0: drive supports 1-sector PIO transfers, chs addressing
[note: this is a modern drive and does fine most reboots.]
wd0: 69632 KB, 1024 cyl, 8 head, 17 sec, 512 bytes/sect x 139264 sectors
[that's totally wrong of course, and it works on most boots.]
[then we have a bunch of unimportant junk, and then...]
wd0(viaide1:0:0): using PIO mode 0
viaide1:0:0: wait timed out
wd0d: device timeout reading fsbn 0 (wd0 bn 0; cn 0 tn 0 sn 0), retrying
wd0: soft error (corrected)
wd0: mbr partition exceeds disk size
wd0: mbr partition exceeds disk size
wd0: mbr partition exceeds disk size
wd0: mbr partition exceeds disk size
boot device: <unknown>
root device:
[and then it wants me to type in a boot device.]
Version 1.34 of viaide.c works fine -- I've tried rebooting about 30
times without failure.
Note that the behavior without ACPI on is also disturbing -- it
appears that sometimes the chip doesn't get properly initialized by
the driver. This may be some variation on that theme. However, if we
can at least fix this regression, I can limp along...
>How-To-Repeat:
It might be difficult without my particular mobo and chip set, or it
might happen with any hardware. With my boxes, it is pretty
straightforward, if labor intensive, to reproduce. Note that I get the
same symptoms on multiple boxes.
>Fix:
My guess is that something in v1.35 depends on the state the chip is
in on boot and that every once in a while it is not in that state. (I
also suspect this is the problem without ACPI turned on, but that ACPI
initializes things "better"). My guess is that the problem can be
fixed by cleanly initializing the chip during boot, but I have no real
knowledge of the chip in question.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: kern-bug-people->bouyer
Responsible-Changed-By: bouyer@netbsd.org
Responsible-Changed-When: Sun, 12 Nov 2006 23:28:08 +0000
Responsible-Changed-Why:
I changed the probe method
State-Changed-From-To: open->feedback
State-Changed-By: bouyer@netbsd.org
State-Changed-When: Sun, 12 Nov 2006 23:28:08 +0000
State-Changed-Why:
I sent a patch
From: Manuel Bouyer <bouyer@antioche.eu.org>
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@NetBSD.org, gnats-admin@NetBSD.org,
netbsd-bugs@NetBSD.org
Subject: Re: kern/35008: viaide.c v1.35 sometimes fails horribly
Date: Mon, 13 Nov 2006 00:27:25 +0100
--9amGYk9869ThD9tj
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Tue, Nov 07, 2006 at 02:40:00PM +0000, perry@piermont.com wrote:
> I'm running on an amd64 box with a viaide SATA controller. With ACPI
> not on in the kernel, both version 1.34 and version 1.35 of viaide.c
> lead to periodic failures to boot (perhaps one in every five times),
> with the driver spewing errors during boot and failing to read the
> disk.
>
> However, this PR is about the behavior with ACPI turned on.
>
> Version 1.35 leads to failure about one in every five to ten reboots.
> I get lots of messages, most of which scroll off the screen,
> preventing me from writing them down. :(
>
> This is what was left on the screen that I could type in by hand:
>
> [...]
> : <ST506>
> wd0: drive supports 1-sector PIO transfers, chs addressing
> [note: this is a modern drive and does fine most reboots.]
> wd0: 69632 KB, 1024 cyl, 8 head, 17 sec, 512 bytes/sect x 139264 sectors
> [that's totally wrong of course, and it works on most boots.]
> [then we have a bunch of unimportant junk, and then...]
> wd0(viaide1:0:0): using PIO mode 0
> viaide1:0:0: wait timed out
> wd0d: device timeout reading fsbn 0 (wd0 bn 0; cn 0 tn 0 sn 0), retrying
> wd0: soft error (corrected)
> wd0: mbr partition exceeds disk size
> wd0: mbr partition exceeds disk size
> wd0: mbr partition exceeds disk size
> wd0: mbr partition exceeds disk size
> boot device: <unknown>
> root device:
OK, it looks like the drive rejected the IDENTIFY command. Maybe is
needs a reset (currently the sata probe resets only the interface, not
the drive itself, while the old probe resets the drives). Could you try
the attached patch ?
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--
--9amGYk9869ThD9tj
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff
Index: wdc.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/wdc.c,v
retrieving revision 1.240
diff -u -u -r1.240 wdc.c
--- wdc.c 25 Oct 2006 20:14:00 -0000 1.240
+++ wdc.c 12 Nov 2006 23:24:14 -0000
@@ -238,7 +238,13 @@
bus_space_write_4(wdr->sata_iot, wdr->sata_control, 0, scontrol);
tsleep(wdr, PRIBIO, "sataup", mstohz(50));
- sstatus = bus_space_read_4(wdr->sata_iot, wdr->sata_status, 0);
+ /* wait up to 1s for device to come up */
+ for (i = 0; i < 100; i++) {
+ sstatus = bus_space_read_4(wdr->sata_iot, wdr->sata_status, 0);
+ if ((sstatus & SStatus_DET_mask) == SStatus_DET_DEV)
+ break;
+ tsleep(wdr, PRIBIO, "sataup", mstohz(10));
+ }
switch (sstatus & SStatus_DET_mask) {
case SStatus_DET_NODEV:
@@ -286,6 +292,12 @@
aprint_normal("%s: port %d: device present, speed: %s\n",
chp->ch_atac->atac_dev.dv_xname, chp->ch_channel,
sata_speed(sstatus));
+ /*
+ * issue a reset in case only the interface part of the drive
+ * is up
+ */
+ if (wdcreset(chp, RESET_SLEEP) != 0)
+ chp->ch_drive[0].drive_flags = 0;
break;
default:
--9amGYk9869ThD9tj--
From: Manuel Bouyer <bouyer@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: PR/35008 CVS commit: src/sys/dev/ic
Date: Tue, 14 Nov 2006 18:39:10 +0000 (UTC)
Module Name: src
Committed By: bouyer
Date: Tue Nov 14 18:39:10 UTC 2006
Modified Files:
src/sys/dev/ic: wdc.c
Log Message:
wdc_sataprobe():
- wait up to 1s for SStatus_DET_DEV after SControl_DET_INIT toggle (from
FreeBSD)
- reset the drive once we know it's there. It may be in some PM state and
not able to properly reply to IDENTIFY. Tested by Teemu Rinta-aho,
fixes PR kern/35049 and should also fix PR kern/35008.
To generate a diff of this commit:
cvs rdiff -r1.240 -r1.241 src/sys/dev/ic/wdc.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: perry@netbsd.org
State-Changed-When: Sat, 10 Feb 2007 02:23:18 +0000
State-Changed-Why:
no longer an issue
>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.