Re: Switch from legacy ata(4) to CAM-based ATA

From: Alexander Motin <mav_at_FreeBSD.org>
Date: Thu, 21 Apr 2011 00:17:44 +0300
Alexander Motin wrote:
> Bruce Cran wrote:
>> On Wed, 20 Apr 2011 15:21:48 +0300
>> Alexander Motin <mav_at_FreeBSD.org> wrote:
>>
>>> Verbose dmesg from the fresh system would be appreciated.
>> I've put a verbose dmesg at
>> http://www.cran.org.uk/~brucec/freebsd/dmesg.verbose_20110420.txt
> 
> Thank you. I've compared your and Daniel dmesgs, and while they are
> showing different emulated controllers, the problems seems to be common:
> ata_generic_reset() reports two devices on the channel with CD, while
> there is only one. As result, attempts to send requests to the missing
> device predictably cause timeouts. I have doubts that problem is
> specific to CAM-based ATA. It looks more probable to me that difference
> is just in command timeouts: 1 second with legacy ATA, and 30 seconds
> with CAM. Could you show me verbose dmesg with legacy ATA to make sure?
> Same time I'll try to think what can we do about it.

2 Bruce: Looking on XEN sources, it seems that the only place how it
differs missing and present disk is the device signature. ata(4) at this
moment doesn't checks signature if it is not ATAPI and READY bit is set.
Attached patch should solve the problem by using more strict check, and
I only hope it won't break anything else. Try it please.

2 Daniel: Your situation is different, as both devices reported equally
during soft-reset. The only place where I see difference is on SATA
layer. But the funny thing is that I can't find SATA support in XEN
sources. What are you using? Can you send me full verbose dmesg and
`pciconf -lvcb`?

-- 
Alexander Motin

Index: ata-lowlevel.c
===================================================================
--- ata-lowlevel.c	(revision 220837)
+++ ata-lowlevel.c	(working copy)
_at__at_ -535,7 +535,7 _at__at_
 		    if (lsb == ATAPI_MAGIC_LSB && msb == ATAPI_MAGIC_MSB) {
 			ch->devices |= ATA_ATAPI_MASTER;
 		    }
-		    else if (stat0 & ATA_S_READY) {
+		    else if (lsb == 0 && msb == 0 && (stat0 & ATA_S_READY)) {
 			ch->devices |= ATA_ATA_MASTER;
 		    }
 		}
_at__at_ -568,7 +568,7 _at__at_
 		    if (lsb == ATAPI_MAGIC_LSB && msb == ATAPI_MAGIC_MSB) {
 			ch->devices |= ATA_ATAPI_SLAVE;
 		    }
-		    else if (stat1 & ATA_S_READY) {
+		    else if (lsb == 0 && msb == 0 && (stat1 & ATA_S_READY)) {
 			ch->devices |= ATA_ATA_SLAVE;
 		    }
 		}
Received on Wed Apr 20 2011 - 19:18:08 UTC

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