From owner-freebsd-current@FreeBSD.ORG  Fri Jan 29 21:54:00 2010
Return-Path: <owner-freebsd-current@FreeBSD.ORG>
Delivered-To: freebsd-current@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 09D621065696;
	Fri, 29 Jan 2010 21:54:00 +0000 (UTC) (envelope-from avg@icyb.net.ua)
Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140])
	by mx1.freebsd.org (Postfix) with ESMTP id 104CC8FC20;
	Fri, 29 Jan 2010 21:53:58 +0000 (UTC)
Received: from porto.topspin.kiev.ua (porto-e.starpoint.kiev.ua
	[212.40.38.100])
	by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id XAA13834;
	Fri, 29 Jan 2010 23:53:57 +0200 (EET) (envelope-from avg@icyb.net.ua)
Received: from localhost.topspin.kiev.ua ([127.0.0.1])
	by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD))
	id 1Naymq-0005rM-OW; Fri, 29 Jan 2010 23:53:56 +0200
Message-ID: <4B6358F3.7080908@icyb.net.ua>
Date: Fri, 29 Jan 2010 23:53:55 +0200
From: Andriy Gapon <avg@icyb.net.ua>
User-Agent: Thunderbird 2.0.0.23 (X11/20091128)
MIME-Version: 1.0
To: Alexander Motin <mav@FreeBSD.org>
References: <4B55D9D4.1000008@FreeBSD.org>	<alpine.OSX.2.00.1001232228180.2800@idate.home.yamagi.org>	<alpine.BSF.2.00.1001281701530.29385@screw.home.yamagi.org>	<4B61C688.2050609@FreeBSD.org>	<alpine.BSF.2.00.1001281835110.30867@screw.home.yamagi.org>	<4B61CCB6.4040005@FreeBSD.org>	<alpine.OSX.2.00.1001281922010.4896@idate.home.yamagi.org>	<4B62C97F.7080000@FreeBSD.org>
	<4B62EDFB.1060103@icyb.net.ua>
	<201001291949.o0TJnCAa013981@triton8.kn-bremen.de>
	<4B633FED.3030103@FreeBSD.org>
In-Reply-To: <4B633FED.3030103@FreeBSD.org>
X-Enigmail-Version: 0.96.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: freebsd-current@FreeBSD.org, Juergen Lock <nox@jelal.kn-bremen.de>,
	Yamagi Burmeister <lists@yamagi.org>
Subject: Re: Pack of CAM improvements
X-BeenThere: freebsd-current@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Discussions about the use of FreeBSD-current
	<freebsd-current.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-current>, 
	<mailto:freebsd-current-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-current>
List-Post: <mailto:freebsd-current@freebsd.org>
List-Help: <mailto:freebsd-current-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-current>,
	<mailto:freebsd-current-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 29 Jan 2010 21:54:00 -0000

on 29/01/2010 22:07 Alexander Motin said the following:
> Juergen Lock wrote:
>> Ok while we are talking about ahci(4) on IXP700...  Can anyone reproduce
>> the `test unit ready' bug on one of those?  Since I saw no reply to
>> my post,
>> 	http://docs.freebsd.org/cgi/mid.cgi?201001231407.o0NE7l8j002620
>> maybe the bug is controller-specific?  How to reproduce:  just try
>> 	camcontrol tur adaX
>> or
>> 	cdrecord -scanbus
>> or (at least I think this is the same issue) start xfburn without hal
>> running, then watch for the bus to hang at the next disk access.
>> (Also leaving the disk led on solid here.)  With the previous patch,
>> 	http://people.freebsd.org/~mav/cam-ata.20100119.patch
>> (haven't tested the latest one yet) at least it now seems to recover
>> after some timeout, leaving this in dmesg:  (sorry I didn't notice
>> when I first tried, guess I didn't wait long enough...)
> 
> It is controller specific. Intel and NVidia controllers just return
> error immediately, as they should, and continue operation. ATI IXP700 -
> doesn't:

I have this simple patch in my local tree:

--- a/sys/cam/ata/ata_xpt.c
+++ b/sys/cam/ata/ata_xpt.c
@@ -1341,6 +1341,20 @@ ata_action(union ccb *start_ccb)
 		(*(sim->sim_action))(sim, start_ccb);
 		break;
 	}
+	case XPT_SCSI_IO:
+	{
+		struct cam_ed *device;
+
+		device = start_ccb->ccb_h.path->device;
+		if (device->protocol == PROTO_ATA) {
+			xpt_print(start_ccb->ccb_h.path,
+			    "XPT_SCSI_IO command for device with PROTO_ATA\n");
+			start_ccb->ccb_h.status = CAM_REQ_INVALID;
+			xpt_done(start_ccb);
+			return;
+		}
+		/* FALLTHROUGH */
+	}
 	default:
 		xpt_action_default(start_ccb);
 		break;

Here's what it does:
$ drecord -scanbus
Cdrecord-ProDVD-ProBD-Clone 2.01.01a72 (amd64-unknown-freebsd9.0) Copyright (C)
1995-2010 Jörg Schilling
Using libscg version 'schily-0.9'.
scsibus0:
        0,0,0     0) '' '' '' NON CCS Disk
        0,1,0     1) *
        0,2,0     2) *
        0,3,0     3) *
        0,4,0     4) *
        0,5,0     5) *
        0,6,0     6) *
        0,7,0     7) *
scsibus1:
        1,0,0   100) '' '' '' NON CCS Disk
        1,1,0   101) *
        1,2,0   102) *
        1,3,0   103) *
        1,4,0   104) *
        1,5,0   105) *
        1,6,0   106) *
        1,7,0   107) *
scsibus5:
        5,0,0   500) 'Optiarc ' 'DVD RW AD-7191S ' '1.02' Removable CD-ROM
        5,1,0   501) *
        5,2,0   502) *
        5,3,0   503) *
        5,4,0   504) *
        5,5,0   505) *
        5,6,0   506) *
        5,7,0   507) *

And in dmesg:
kernel: (pass0:ahcich0:0:0:0): XPT_SCSI_IO command for device with PROTO_ATA
last message repeated 2 times
kernel: (pass1:ahcich1:0:0:0): XPT_SCSI_IO command for device with PROTO_ATA

I remember that this patch is not perfect, but it works for my simple desktop
setup.  No bad side-effects from it either.

-- 
Andriy Gapon