From alo@alo.louko.com  Thu Sep 18 01:03:31 2003
Return-Path: <alo@alo.louko.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 9D85216A4BF
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 18 Sep 2003 01:03:31 -0700 (PDT)
Received: from alo.louko.com (x1.louko.com [195.218.71.106])
	by mx1.FreeBSD.org (Postfix) with SMTP id 16CB543F75
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 18 Sep 2003 01:03:30 -0700 (PDT)
	(envelope-from alo@alo.louko.com)
Received: (qmail 39958 invoked by uid 406); 18 Sep 2003 08:03:28 -0000
Message-Id: <20030918080328.39957.qmail@alo.louko.com>
Date: 18 Sep 2003 08:03:28 -0000
From: Antti Louko <alo@iki.fi>
Reply-To: Antti Louko <alo@iki.fi>
To: FreeBSD-gnats-submit@freebsd.org
Cc: alo@iki.fi
Subject: Write to a Compact Flash (CF) card freezes the whole system
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         56975
>Category:       kern
>Synopsis:       Write to a Compact Flash (CF) card freezes the whole system
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 18 01:10:13 PDT 2003
>Closed-Date:    Thu Sep 18 01:20:30 PDT 2003
>Last-Modified:  Thu Sep 18 08:00:34 PDT 2003
>Originator:     Antti Louko
>Release:        FreeBSD 5.1-RELEASE i386
>Organization:
>Environment:
System: FreeBSD xxxx.louko.com 5.1-RELEASE FreeBSD 5.1-RELEASE #26: Tue Sep 16 08:18:42 EEST 2003     root@xxxx.louko.com:/usr/src/sys/i386/compile/LEX2 i386
VIA Eden processor and chipset combo VIA VT8601A, VT82C686B.

>Description:

The machine has a CF slot on the motherboard and the problem occurs
when writing to the CF with either dd to raw disk or through file
system.  The system quite soon freezes completely.

>How-To-Repeat:

Insert CF.
dd if=/dev/zero bs=32k of=/dev/ad2

>Fix:

It appears that chipset/CF combo doesn't like any IO operations
immediately after s status inquiry.  The following path fixes the
problem.  It seemed best to put the delay just after the INB and thus
get it in all exit paths of the function.

*** dev/ata/ata-all.c.orig      Sun May 18 19:43:08 2003
--- dev/ata/ata-all.c   Tue Sep 16 08:14:56 2003
***************
*** 978,983 ****
--- 978,984 ----
      DELAY(1);
      while (timeout < 5000000) { /* timeout 5 secs */
        atadev->channel->status = ATA_IDX_INB(atadev->channel, ATA_STATUS);
+         DELAY(1);
  
        /* if drive fails status, reselect the drive just to be sure */
        if (atadev->channel->status == 0xff) {

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: sos 
State-Changed-When: Thu Sep 18 01:12:29 PDT 2003 
State-Changed-Why:  
You are on the right track, I've just yesterday fixed the problem on 
a system donated by servicefactory.se, just a bit differently from 
your patch and under 4.x. I'll commit my patch in a few days when I'm 
sure it has no ill effects.. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=56975 

From: Pawel Malachowski <pawmal-posting@freebsd.lublin.pl>
To: S?ren Schmidt <sos@FreeBSD.org>
Cc: alo@iki.fi, FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: kern/56975: Write to a Compact Flash (CF) card freezes the whole system
Date: Thu, 18 Sep 2003 16:53:08 +0200

 On Thu, Sep 18, 2003 at 01:20:29AM -0700, S?ren Schmidt wrote:
 
 > State-Changed-From-To: open->closed
 > State-Changed-By: sos
 > State-Changed-When: Thu Sep 18 01:12:29 PDT 2003
 > State-Changed-Why: 
 > You are on the right track, I've just yesterday fixed the problem on
 > a system donated by servicefactory.se, just a bit differently from
 > your patch and under 4.x. I'll commit my patch in a few days when I'm
 > sure it has no ill effects..
 
 So why not to reopen this PR with proper responsible, put it in patched
 state after commiting your fix and close after MFC to 4.x?
 It makes PR database consistent and PR tracking easier.
 
 
 cheers,
 -- 
 Pawe Maachowski
>Unformatted:
