Re: Pack of CAM improvements

From: Andriy Gapon <avg_at_icyb.net.ua>
Date: Fri, 29 Jan 2010 23:53:55 +0200
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
_at__at_ -1341,6 +1341,20 _at__at_ 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
Received on Fri Jan 29 2010 - 20:54:00 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:00 UTC