From owner-freebsd-current@FreeBSD.ORG  Wed Feb  5 02:08:14 2014
Return-Path: <owner-freebsd-current@FreeBSD.ORG>
Delivered-To: freebsd-current@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 A944CEAD;
 Wed,  5 Feb 2014 02:08:14 +0000 (UTC)
Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu
 [128.95.76.21])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by mx1.freebsd.org (Postfix) with ESMTPS id 85F5F1A70;
 Wed,  5 Feb 2014 02:08:14 +0000 (UTC)
Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu
 [127.0.0.1])
 by troutmask.apl.washington.edu (8.14.7/8.14.7) with ESMTP id s152846x054127
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO);
 Tue, 4 Feb 2014 18:08:04 -0800 (PST)
 (envelope-from sgk@troutmask.apl.washington.edu)
Received: (from sgk@localhost)
 by troutmask.apl.washington.edu (8.14.7/8.14.7/Submit) id s15284XP054126;
 Tue, 4 Feb 2014 18:08:04 -0800 (PST) (envelope-from sgk)
Date: Tue, 4 Feb 2014 18:08:04 -0800
From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: Alexander Motin <mav@FreeBSD.org>
Subject: Re: Instant panic CAM or USB subsystem
Message-ID: <20140205020804.GA54095@troutmask.apl.washington.edu>
References: <20140125172106.GA67590@troutmask.apl.washington.edu>
 <201401281232.21958.jhb@freebsd.org>
 <20140128195842.GA83173@troutmask.apl.washington.edu>
 <52F09914.5040202@FreeBSD.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <52F09914.5040202@FreeBSD.org>
User-Agent: Mutt/1.5.22 (2013-10-16)
Cc: freebsd-current@freebsd.org, scsi@freebsd.org
X-BeenThere: freebsd-current@freebsd.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: Discussions about the use of FreeBSD-current
 <freebsd-current.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/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: Wed, 05 Feb 2014 02:08:14 -0000

On Tue, Feb 04, 2014 at 09:39:00AM +0200, Alexander Motin wrote:
> 
> I guess problem may be not that phone is reported as CD, but that it is 
> reported as several CDs on one target. Note that you already see cd1 
> reported, but another one was still trying to allocate when system panicked.

Good guess see below.

> I think that CAM CD driver incorrectly assumes that your device is CD 
> changer. I've pulled real 5-disk SCSI CD changer from my depths of my 
> table and got panic very much like yours just on boot. It seems that 
> respective changer code was not properly re-locked during recent CAM 
> locking project.

If you come up with a patch, I can test it for you.

> I am going to analyze this case deeper to fix in properly, while for 
> your case I can propose such quick quirk:
> 
> --- scsi_cd.c   (revision 261448)
> +++ scsi_cd.c   (working copy)
> @@ -223,6 +223,10 @@ static struct cd_quirk_entry cd_quirk_table[] =
>          {
>                  { T_CDROM, SIP_MEDIA_REMOVABLE, "CHINON", "CD-ROM 
> CDS-535","*"},
>                  /* quirks */ CD_Q_BCD_TRACKS
> +       },
> +       {
> +               { T_CDROM, SIP_MEDIA_REMOVABLE, "SAMSUNG", "CD-ROM","1.00"},
> +               /* quirks */ CD_Q_NO_CHANGER
>          }
>   };
> 

With your quirk, the laptop booted and plugging in the cellphone
does not cause a panic.  :-)  

dmesg shows

ugen3.2: <Qualcomm, Incorporated> at usbus3
umass1: <Qualcomm, Incorporated USB MMC Storage, class 0/0, rev 1.10/0.00,\
         addr 2> on usbus3
cd1 at umass-sim1 bus 1 scbus5 target 0 lun 0
cd1: <SAMSUNG CD-ROM 1.00> Removable CD-ROM SCSI-2 device 
cd1: Serial Number 000000000002
cd1: 1.000MB/s transfers
cd1: cd present [3840000 x 512 byte records]
cd1: quirks=0x14<NO_CHANGER,10_BYTE_ONLY>
cd2 at umass-sim1 bus 1 scbus5 target 0 lun 1
cd2: <SAMSUNG CD-ROM 1.00> Removable CD-ROM SCSI-2 device 
cd2: Serial Number 000000000002
cd2: 1.000MB/s transfers
cd2: cd present [1084 x 512 byte records]
cd2: quirks=0x14<NO_CHANGER,10_BYTE_ONLY>

After a few seconds, the cellphone display shows

> Sync Music to Phone
> Sync Music to Card
> Copy/Move Files

and the following appears in dmesg

ugen3.2: <Qualcomm, Incorporated> at usbus3 (disconnected)
umass1: at uhub3, port 2, addr 2 (disconnected)
cd1 at umass-sim1 bus 1 scbus5 target 0 lun 0
cd1: <SAMSUNG CD-ROM 1.00> s/n 000000000002 detached
cd2 at umass-sim1 bus 1 scbus5 target 0 lun 1
cd2: <SAMSUNG CD-ROM 1.00> s/n 000000000002 detached
(cd2:umass-sim1:1:0:1): Periph destroyed
(cd1:umass-sim1:1:0:0): Periph destroyed
ugen3.2: <SAMSUNG Electronics Bo.,Ltd.> at usbus3

This is fine with me as I only use the laptop as a charging station.

-- 
Steve