From owner-freebsd-scsi@FreeBSD.ORG Tue Apr 22 21:16:16 2008 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54C7D106566B; Tue, 22 Apr 2008 21:16:16 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from hosted.kievnet.com (hosted.kievnet.com [193.138.144.10]) by mx1.freebsd.org (Postfix) with ESMTP id E172F8FC13; Tue, 22 Apr 2008 21:16:15 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from localhost ([127.0.0.1] helo=edge.pp.kiev.ua) by hosted.kievnet.com with esmtpa (Exim 4.62) (envelope-from ) id 1JoPqY-000F4R-Ub; Wed, 23 Apr 2008 00:16:15 +0300 Message-ID: <480E5598.5030502@icyb.net.ua> Date: Wed, 23 Apr 2008 00:16:08 +0300 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.12 (X11/20080320) MIME-Version: 1.0 To: freebsd-usb@freebsd.org, freebsd-scsi@freebsd.org References: <480E4780.6010106@icyb.net.ua> In-Reply-To: <480E4780.6010106@icyb.net.ua> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Subject: Re: issue with umass plugged-in during boot up X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Apr 2008 21:16:16 -0000 on 22/04/2008 23:16 Andriy Gapon said the following: > BTW, I use RELENG_7, i386, UP. > > Anyway, I see a different issue with booting while a umass device is > connected. First issue was that k3b hasn't found my two cd/atapicam > devices. Then I executed camcontrol rescan all, it failed with EINVAL. > camcontrol reset all - the same error. ktrace showed that the error came > from ioctl on xpt device. > I rebooted without the umass device and everything went back to normal. > I'll try to do more debugging later. Here is a complete and correct scenario with more details. Original boot: uhci1: port 0xbc00-0xbc1f irq 7 at device 12.0 on pci0 uhci1: [GIANT-LOCKED] uhci1: [ITHREAD] usb1: on uhci1 usb1: USB revision 1.0 uhub1: on usb1 uhub1: 2 ports with 2 removable, self powered uhci2: port 0xc000-0xc01f irq 10 at device 12.1 on pci0 uhci2: [GIANT-LOCKED] uhci2: [ITHREAD] usb2: on uhci2 usb2: USB revision 1.0 uhub2: on usb2 uhub2: 2 ports with 2 removable, self powered ehci0: mem 0xe7005000-0xe70050ff irq 11 at device 12.2 on pci0 ehci0: [GIANT-LOCKED] ehci0: [ITHREAD] usb3: EHCI version 1.0 usb3: companion controllers, 2 ports each: usb1 usb2 usb3: on ehci0 usb3: USB revision 2.0 uhub3: on usb3 uhub3: 4 ports with 4 removable, self powered umass0: on uhub3 ... unknown: FAILURE - INQUIRY ILLEGAL REQUEST asc=0x24 ascq=0x00 sks=0x40 0x00 0x01 da0 at umass-sim0 bus 0 target 0 lun 0 da0: Fixed Direct Access SCSI-0 device da0: 40.000MB/s transfers da0: 381554MB (781422768 512 byte sectors: 255H 63S/T 48641C) cam_periph_alloc: attempt to re-allocate valid device pass2 rejected passasync: Unable to attach new device due to status 0x6: CCB request was invalid cam_periph_alloc: attempt to re-allocate valid device cd2 rejected cdasync: Unable to attach new device due to status 0x6 cd2 at ata1 bus 0 target 0 lun 0 cd2: Removable CD-ROM SCSI-0 device cd2: 3.300MB/s transfers cd2: cd present [2236704 x 2048 byte records] unknown: FAILURE - INQUIRY ILLEGAL REQUEST asc=0x24 ascq=0x00 cam_periph_alloc: attempt to re-allocate valid device pass1 rejected passasync: Unable to attach new device due to status 0x6: CCB request was invalid cd1 at ata0 bus 0 target 0 lun 0 cd1: Removable CD-ROM SCSI-0 device cd1: 3.300MB/s transfers cd1: Attempt to query device size failed: NOT READY, Medium not present After boot I cane execute all camcontrol commands without any problems. Here is output of camcontrol devlist -v: scbus0 on umass-sim0 bus 0: at scbus0 target 0 lun 0 (da0,pass0) scbus1 on ata0 bus 0: at scbus1 target 0 lun 0 (cd1,pass1) < > at scbus1 target -1 lun -1 () scbus2 on ata1 bus 0: at scbus2 target 0 lun 0 (pass2,cd2) < > at scbus2 target -1 lun -1 () scbus3 on ata2 bus 0: < > at scbus3 target -1 lun -1 () scbus4 on ata3 bus 0: < > at scbus4 target -1 lun -1 () scbus-1 on xpt0 bus 0: < > at scbus-1 target -1 lun -1 (xpt0) Then I detach the umass disk: umass0: at uhub3 port 2 (addr 2) disconnected (da0:umass-sim0:0:0:0): lost device (da0:umass-sim0:0:0:0): removing device entry GEOM_LABEL: Label ufs/extstuff removed. GEOM_LABEL: Label ufs/extbackup removed. umass0: detached And here is new output of camcontrol devlist -v: scbus1 on ata0 bus 0: at scbus1 target 0 lun 0 (cd1,pass1) < > at scbus1 target -1 lun -1 () scbus2 on ata1 bus 0: at scbus2 target 0 lun 0 (pass2,cd2) < > at scbus2 target -1 lun -1 () scbus3 on ata2 bus 0: < > at scbus3 target -1 lun -1 () scbus4 on ata3 bus 0: < > at scbus4 target -1 lun -1 () scbus-1 on xpt0 bus 0: < > at scbus-1 target -1 lun -1 (xpt0) After that camcontrol commands referring to "all" (rescan and reset) fail with EINVAL. ktrace shows that EINVAL comes from ioctl CAMIOCOMMAND on xpt0 device. My clumsy ddb debugging shows that the error is produced somewhere in xptioctl->xpt_find_bus. It seems that xpt might be unhappy about scbus0/pass0 going away. Maybe this is because in /-1 case camcontrol sends ccb with path_id (implicitly) set to zero and xptioctl performs xpt_find_bus for all ioctl commands (including XPT_DEV_MATCH)? I.e. see case of bus=-1 in rescan_or_reset_bus() in camcontrol.c -- Andriy Gapon