From philk@rotfl.com.au  Sat May 27 00:38:30 2006
Return-Path: <philk@rotfl.com.au>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 39EC116AE68
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 27 May 2006 00:38:30 +0000 (UTC)
	(envelope-from philk@rotfl.com.au)
Received: from mail.rotfl.com.au (eth1779.sa.adsl.internode.on.net [150.101.235.242])
	by mx1.FreeBSD.org (Postfix) with ESMTP id A019F43D48
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 27 May 2006 00:38:29 +0000 (GMT)
	(envelope-from philk@rotfl.com.au)
Received: from localhost (localhost.rotfl.com.au [127.0.0.1])
	by mail.rotfl.com.au (Postfix) with ESMTP id 82D031CD90
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 27 May 2006 10:08:27 +0930 (CST)
Received: from mail.rotfl.com.au ([127.0.0.1])
	by localhost (mail.rotfl.com.au [127.0.0.1]) (amavisd-new, port 10024)
	with LMTP id BtyMutM3ZbIg for <FreeBSD-gnats-submit@freebsd.org>;
	Sat, 27 May 2006 10:07:51 +0930 (CST)
Message-Id: <20060527003751.83E921CD91@mail.rotfl.com.au>
Date: Sat, 27 May 2006 10:07:51 +0930 (CST)
From: Phil Kernick <philk@rotfl.com.au>
Reply-To: Phil Kernick <philk@rotfl.com.au>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: DMA is broken for VIA 82C596B UDMA66controller
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         97996
>Category:       kern
>Synopsis:       [ata] DMA is broken for VIA 82C596B UDMA66controller
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat May 27 00:40:15 GMT 2006
>Closed-Date:    Tue Oct 26 14:55:53 UTC 2010
>Last-Modified:  Tue Oct 26 14:55:53 UTC 2010
>Originator:     Phil Kernick
>Release:        FreeBSD 5.5-BETA4 i386
>Organization:
>Environment:
System: FreeBSD catbert.rotfl.com.au 5.5-BETA4 FreeBSD 5.5-BETA4 #1: Wed Apr 19 16:29:31 CST 2006 root@catbert.rotfl.com.au:/usr/src/sys/i386/compile/CATBERT i386

$ dmesg | grep ata
atapci0: <VIA 82C596B UDMA66 controller> port
0xc000-0xc00f,0x376,0x170-0x177,0x3f6,0x1f0-0x1f7 at device 7.1 on pci0
ata0: channel #0 on atapci0
ata1: channel #1 on atapci0
atapci1: <HighPoint HPT370 UDMA100 controller> port
0xe800-0xe8ff,0xe400-0xe403,0xe000-0xe007,0xdc00-0xdc03,0xd800-0xd807 irq 10
at device 11.0 on pci0
ata2: channel #0 on atapci1
ata3: channel #1 on atapci1
ad0: 76319MB <ST380011A/3.06> [155061/16/63] at ata0-master PIO4
acd0: DVDROM <LITE-ON DVD SOHD-16P9S/FS07> at ata1-master PIO4
ad3: 114473MB <ST3120026A/8.01> [232581/16/63] at ata1-slave PIO4
ad4: 152627MB <ST3160023A/8.01> [310101/16/63] at ata2-master PIO4
ad6: 152627MB <ST3160023A/3.06> [310101/16/63] at ata3-master PIO4
 disk0 READY on ad4 at ata2-master
 disk1 READY on ad6 at ata3-master
cd0 at ata1 bus 0 target 0 lun 0

>Description:
I have been having repeated filesystem corruption issues on 5.4 and 5.5-beta4.

The problems only occur on disks connected to the VIA 82C596B UDMA66
controller.  There have been no problems at all with the HighPoint controller.

I have replaced the disk, motherboard, cables, ram and everything else but
the problem does not go away.  The one commonality is FreeBSD.

I first noticed the problem when a moved from 4.11 to 5.4, and upgrading to
5.5-beta didn't fix the problem.

Looking through the stable archives this was reported last year but there
does not seem to be any resolution of the problem.

Since it is limited to a specific controller, and is definitely DMA related,
I assume that it is a bug in the controller handling code, but I don't know
how to track it down.

>How-To-Repeat:
The problems only occur under heavy load with lots of reads and writes, such
as a snapshot dump on a live filesystem or a large port compile.

>Fix:
Adding these lines to loader.conf completely solves the corruption problem:
$ grep ata /boot/loader.conf
hw.ata.wc=0
hw.ata.ata_dma=0

Unfortunately it also slows disk IO to 20% of previous and loads CPU with
interrupt waits all the time.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-i386->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sat Jun 24 03:29:26 UTC 2006 
Responsible-Changed-Why:  
This does not sound i386-specific. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=97996 
State-Changed-From-To: open->feedback 
State-Changed-By: jh 
State-Changed-When: Mon Oct 25 15:49:07 UTC 2010 
State-Changed-Why:  
Can you still reproduce this on a supported release? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=97996 
State-Changed-From-To: feedback->closed 
State-Changed-By: jh 
State-Changed-When: Tue Oct 26 14:55:52 UTC 2010 
State-Changed-Why:  
Submitter can't reproduce anymore. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=97996 
>Unformatted:
