From owner-svn-src-all@FreeBSD.ORG Fri Aug 22 05:34:55 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9C932618 for ; Fri, 22 Aug 2014 05:34:55 +0000 (UTC) Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 61875362E for ; Fri, 22 Aug 2014 05:34:54 +0000 (UTC) Received: by mail-pa0-f45.google.com with SMTP id eu11so15868734pac.32 for ; Thu, 21 Aug 2014 22:34:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:content-type:mime-version:subject:from :in-reply-to:date:cc:message-id:references:to; bh=M56PJt+uAvDrwGyk4PhURAIgCei3in/1rJeldvoFeVE=; b=i01umXrgtPRE/HS1rCXS7XZCg65xVWQSTqity2vpLZ6mIR3XSJ2IxBXZWUvmaj8g0S H5tn6j7SszG3l6YUdCOohuZ3NDDjHmSMEO1r8QsopzOw3rMOBau0uVfVbpk3hyHd3mlU KbGo/GqYvVZMwS733Y0sKZwyZburt5RKdXTZf1u9rdwVHsFRSbypKeG48F74K1Bfd7U5 Jpyw2J6Mzp4ZRcAi9NRwTdMmwPpiag+uxB0SPQO5rHj61t9xNmBi6o2P7WoqBcf0vkqZ 4GNzCgwizAyPrFn4YsHTMby6XaoUR02Uum8TaK3IcYQu+3QI01T5jqkKZ7GyOcYMJtBh dPiw== X-Gm-Message-State: ALoCoQkVoC5YgoNnib2vGqfbCXT6t7Haobbr/2fv+HGKnpkG7t/ItwUegNKhrjBifm3sK8DXRNgr X-Received: by 10.68.162.3 with SMTP id xw3mr3558204pbb.142.1408685694083; Thu, 21 Aug 2014 22:34:54 -0700 (PDT) Received: from [10.64.25.67] (dc1-prod.netflix.com. [69.53.236.251]) by mx.google.com with ESMTPSA id rn7sm98276797pab.39.2014.08.21.22.34.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Aug 2014 22:34:53 -0700 (PDT) Sender: Warner Losh Content-Type: multipart/signed; boundary="Apple-Mail=_087EAC53-4CC3-4EC0-BEA0-734653A71204"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r270249 - head/sys/cam/ata From: Warner Losh In-Reply-To: Date: Thu, 21 Aug 2014 23:34:49 -0600 Message-Id: <0DAF2357-4BBA-4D5B-8F17-D61845BACDA5@bsdimp.com> References: <201408202258.s7KMwDh3073409@svn.freebsd.org> To: Neel Natu X-Mailer: Apple Mail (2.1878.6) Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Warner Losh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Aug 2014 05:34:55 -0000 --Apple-Mail=_087EAC53-4CC3-4EC0-BEA0-734653A71204 Content-Type: multipart/mixed; boundary="Apple-Mail=_A472B53B-3FAE-4A43-9CDD-C534C8B6E52C" --Apple-Mail=_A472B53B-3FAE-4A43-9CDD-C534C8B6E52C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On Aug 21, 2014, at 10:31 PM, Neel Natu wrote: > Hi Warner, >=20 > On Wed, Aug 20, 2014 at 3:58 PM, Warner Losh wrote: >> Author: imp >> Date: Wed Aug 20 22:58:12 2014 >> New Revision: 270249 >> URL: http://svnweb.freebsd.org/changeset/base/270249 >>=20 >> Log: >> Turns out that IDENTIFY DEVICE and IDENTIFY PACKET DEVICE return = data >> that's only mostly similar. Specifically word 78 bits are defined = for >> IDENTIFY DEVICE as >> 5 Supports Hardware Feature Control >> while a IDENTIFY PACKET DEVICE defines them as >> 5 Asynchronous notification supported >> Therefore, only pay attention to bit 5 when we're talking to ATAPI >> devices (we don't use the hardware feature control at this time). >> Ignore it for ATA devices. Remove kludge that papered over this = issue >> for Samsung SATA SSDs, since Micron drives also have the bit set and >> the error was caused by this bad interpretation of the spec (which = is >> quite easy to do, since bits aren't normally overlapping like this). >>=20 >> Modified: >> head/sys/cam/ata/ata_xpt.c >>=20 >> Modified: head/sys/cam/ata/ata_xpt.c >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/cam/ata/ata_xpt.c Wed Aug 20 22:39:26 2014 = (r270248) >> +++ head/sys/cam/ata/ata_xpt.c Wed Aug 20 22:58:12 2014 = (r270249) >> @@ -458,12 +458,18 @@ negotiate: >> 0, 0x02); >> break; >> case PROBE_SETAN: >> - /* Remember what transport thinks about AEN. */ >> - if (softc->caps & CTS_SATA_CAPS_H_AN) >> + /* >> + * Only ATAPI defines this bit to mean AEN, but = remember >> + * what transport thinks about AEN. >> + */ >> + if ((softc->caps & CTS_SATA_CAPS_H_AN) && >> + periph->path->device->protocol =3D=3D = PROTO_ATAPI) >> path->device->inq_flags |=3D SID_AEN; >> else >> path->device->inq_flags &=3D ~SID_AEN; >> xpt_async(AC_GETDEV_CHANGED, path, NULL); >> + if (periph->path->device->protocol !=3D PROTO_ATAPI) >> + break; >> cam_fill_ataio(ataio, >> 1, >> probedone, >> @@ -750,14 +756,6 @@ out: >> goto noerror; >>=20 >> /* >> - * Some Samsung SSDs report supported Asynchronous = Notification, >> - * but return ABORT on attempt to enable it. >> - */ >> - } else if (softc->action =3D=3D PROBE_SETAN && >> - status =3D=3D CAM_ATA_STATUS_ERROR) { >> - goto noerror; >> - >> - /* >> * SES and SAF-TE SEPs have different IDENTIFY = commands, >> * but SATA specification doesn't tell how to identify = them. >> * Until better way found, just try another if first = fail. >>=20 >=20 > This change causes a panic for me on boot. Here is the boot log: >=20 > ahci0: port > 0xf050-0xf057,0xf040-0xf043,0xf030-0xf037,0xf020-0xf023,0xf000-0xf01f > mem 0xfbb21000-0xfbb217ff irq 18 at device 31.2 on pci0 > ahci0: AHCI v1.30 with 6 6Gbps ports, Port Multiplier not supported > ahcich0: at channel 0 on ahci0 > ahcich1: at channel 1 on ahci0 > ahcich2: at channel 2 on ahci0 > ahcich3: at channel 3 on ahci0 > ahcich4: at channel 4 on ahci0 > ahcich5: at channel 5 on ahci0 > ahciem0: on ahci0 > ... > xpt_action_default: CCB type 0xdeadc0de not supported > ... > run_interrupt_driven_hooks: still waiting after 60 seconds for = xpt_config > run_interrupt_driven_hooks: still waiting after 120 seconds for = xpt_config > run_interrupt_driven_hooks: still waiting after 180 seconds for = xpt_config > run_interrupt_driven_hooks: still waiting after 240 seconds for = xpt_config > run_interrupt_driven_hooks: still waiting after 300 seconds for = xpt_config > panic: run_interrupt_driven_config_hooks: waited too long > cpuid =3D 0 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame = 0xffffffff81d92920 > kdb_backtrace() at kdb_backtrace+0x39/frame 0xffffffff81d929d0 > vpanic() at vpanic+0x189/frame 0xffffffff81d92a50 > kassert_panic() at kassert_panic+0x139/frame 0xffffffff81d92ac0 > boot_run_interrupt_driven_config_hooks() at > boot_run_interrupt_driven_config_hooks+0x111/frame 0xffffffff81d92b50 > mi_startup()fffff81d92b70 > btext() at btext+0x2c > KDB: enter: panic > [ thread pid 0 tid 100000 ] > Stopped at kdb_enter+0x3e: movq $0,kdb_why > db> >=20 > The peripheral in question is a SATA attached CDROM: >=20 > % camcontrol devlist > at scbus0 target 0 lun 0 = (pass0,ada0) > at scbus2 target 0 lun 0 = (cd0,pass1) > at scbus3 target 0 lun 0 = (pass2,ada1) > at scbus4 target 0 lun 0 = (pass3,ada2) > at scbus6 target 0 lun 0 = (ses0,pass4) >=20 > pass1 at ahcich2 bus 0 scbus2 target 0 lun 0 > pass1: Removable CD-ROM SCSI-0 device > pass1: Serial Number 3524472 2N8225501140 > pass1: 150.000MB/s transfers (SATA 1.x, UDMA5, ATAPI 12bytes, PIO = 8192bytes) >=20 > The following patch fixes the panic. >=20 > Index: sys/cam/ata/ata_xpt.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sys/cam/ata/ata_xpt.c (revision 270249) > +++ sys/cam/ata/ata_xpt.c (working copy) > @@ -468,7 +468,8 @@ > else > path->device->inq_flags &=3D ~SID_AEN; > xpt_async(AC_GETDEV_CHANGED, path, NULL); > - if (periph->path->device->protocol !=3D PROTO_ATAPI) > + if (periph->path->device->protocol !=3D PROTO_ATAPI && > + periph->path->device->protocol !=3D PROTO_SCSI) > break; > cam_fill_ataio(ataio, > 1, I think the more proper test is =3D=3D PROTO_ATA elsewhere, since that=92s= what distinguishes the ATA_IDENTIFY from the ATAPI_IDENTIFY. > However, there seem to be a couple of issues with the original patch: >=20 > 1. The 'periph->path->device->protocol' is not initialized to > PROTO_ATAPI anywhere in the tree so the not-equal-to test is a no-op. We test here to determine which identify command to send: if (periph->path->device->protocol =3D=3D PROTO_ATA) ata_28bit_cmd(ataio, ATA_ATA_IDENTIFY, 0, 0, 0); else ata_28bit_cmd(ataio, ATA_ATAPI_IDENTIFY, 0, 0, = 0); and that is working to send the right command. > 2. It seems not right to break out of switch in 'probestart()' without > providing a way for 'probedone()' to be called. I believe that this > stops the state machine from making forward progress and results in > 'xpt_config()' not completing. That=92s a problem, you=92re right. Let me rework. > If you need more information to debug this some more or test a proper > fix then I am happy to help. Please try the one included here. I think it will address things. I=92ve = tried it on one system, and am trying it on others in parallel to = sending this. Warner --Apple-Mail=_A472B53B-3FAE-4A43-9CDD-C534C8B6E52C Content-Disposition: attachment; filename=ata-xpt-patch Content-Type: application/octet-stream; x-unix-mode=0664; name="ata-xpt-patch" Content-Transfer-Encoding: 7bit diff -r a293b21e7c58 sys/cam/ata/ata_xpt.c --- a/sys/cam/ata/ata_xpt.c +++ b/sys/cam/ata/ata_xpt.c @@ -458,18 +458,12 @@ negotiate: 0, 0x02); break; case PROBE_SETAN: - /* - * Only ATAPI defines this bit to mean AEN, but remember - * what transport thinks about AEN. - */ - if ((softc->caps & CTS_SATA_CAPS_H_AN) && - periph->path->device->protocol == PROTO_ATAPI) + /* Remember what transport thinks about AEN. */ + if (softc->caps & CTS_SATA_CAPS_H_AN) path->device->inq_flags |= SID_AEN; else path->device->inq_flags &= ~SID_AEN; xpt_async(AC_GETDEV_CHANGED, path, NULL); - if (periph->path->device->protocol != PROTO_ATAPI) - break; cam_fill_ataio(ataio, 1, probedone, @@ -1057,7 +1051,8 @@ noerror: } /* FALLTHROUGH */ case PROBE_SETDMAAA: - if ((ident_buf->satasupport & ATA_SUPPORT_ASYNCNOTIF) && + if (path->device->protocol != PROTO_ATA && + (ident_buf->satasupport & ATA_SUPPORT_ASYNCNOTIF) && (!(softc->caps & CTS_SATA_CAPS_H_AN)) != (!(ident_buf->sataenabled & ATA_SUPPORT_ASYNCNOTIF))) { PROBE_SET_ACTION(softc, PROBE_SETAN); @@ -1178,7 +1173,7 @@ notsata: else caps = 0; /* Remember what transport thinks about AEN. */ - if (caps & CTS_SATA_CAPS_H_AN) + if ((caps & CTS_SATA_CAPS_H_AN) && path->device->protocol != PROTO_ATA) path->device->inq_flags |= SID_AEN; else path->device->inq_flags &= ~SID_AEN; --Apple-Mail=_A472B53B-3FAE-4A43-9CDD-C534C8B6E52C Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --Apple-Mail=_A472B53B-3FAE-4A43-9CDD-C534C8B6E52C-- --Apple-Mail=_087EAC53-4CC3-4EC0-BEA0-734653A71204 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJT9tZ5AAoJEGwc0Sh9sBEAX7kP/1gLvkIaMbHs2q9c/UZFbe+I OgyxtY1d2xcYFpah/h3SakXIEQ4C41R73n88saZ+an8g9stdyrcDQMn7D8pSaWhV g8Un1+QhB/qYmXl5PM2ENbZY/h7BxArPZaeqscwdnqfS5Zs/xfAImD9mbPgTWaU9 W56iSmWeRTms/DDZ/OKEUqF9DOsYaG2iBhBZgmZeahHMaEK3WL48toAGyGvamspQ dUrHXqgv7meGd6XQOLLSbHUSEAOznkDmX1bsMWhJ9lko5SWNj2X6GGoSUgaopAKc zF9yT1P4dsrtTc6mdvSz4xZ1r4ZZKB9kxiVqrof0Nz+0H/q+t7Q8OFKl5RLoS6cV f/GZNvJQ4arCEzUN9SGkV7G97KJkrs5ck80ZU99fWD4BFCKt7z/emq7G5eVtnHXJ KLNu1Yl2o0fslTEOpKfA5Ogll68kZW0jtJooQhpIDyRjpMvAtpXKo1fxjrwH9kc5 D0iW3U6djWyEi0Gs3gdewyPf4sg4mLRt6lld7/YlOf4/Kld/o7BRw7m5fhel0Ftk UbK1c8UJxL3bvdmxsX8Y9Y2p7bfTwhl+4pekIe0reSrEaHHz0RukIhldVSA9yiC1 LMaO39w/KYlmBvc1RNMyh/4yidF5TgyxqTYkMdWw1/lQaR2P3tEuwRlyiUuCilxl w5U1uSfcTtfwPlx0XKXB =2tWf -----END PGP SIGNATURE----- --Apple-Mail=_087EAC53-4CC3-4EC0-BEA0-734653A71204--