From owner-freebsd-scsi@FreeBSD.ORG Thu Jan 5 15:22:40 2012 Return-Path: Delivered-To: scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4FD3C106564A for ; Thu, 5 Jan 2012 15:22:40 +0000 (UTC) (envelope-from Kashyap.Desai@lsi.com) Received: from na3sys009aog125.obsmtp.com (na3sys009aog125.obsmtp.com [74.125.149.153]) by mx1.freebsd.org (Postfix) with ESMTP id D49F28FC12 for ; Thu, 5 Jan 2012 15:22:39 +0000 (UTC) Received: from paledge01.lsi.com ([192.19.193.42]) (using TLSv1) by na3sys009aob125.postini.com ([74.125.148.12]) with SMTP ID DSNKTwXAP4vWpuDn0cYVQdbsU5RLFKsNeCuB@postini.com; Thu, 05 Jan 2012 07:22:39 PST Received: from PALHUB01.lsi.com (128.94.213.114) by PALEDGE01.lsi.com (192.19.193.42) with Microsoft SMTP Server (TLS) id 8.3.137.0; Thu, 5 Jan 2012 10:16:06 -0500 Received: from inbexch01.lsi.com (135.36.98.37) by PALHUB01.lsi.com (128.94.213.114) with Microsoft SMTP Server (TLS) id 8.3.106.1; Thu, 5 Jan 2012 10:11:42 -0500 Received: from inbmail01.lsi.com ([135.36.98.64]) by inbexch01.lsi.com ([135.36.98.37]) with mapi; Thu, 5 Jan 2012 20:41:39 +0530 From: "Desai, Kashyap" To: "scsi@freebsd.org" , "Kenneth D. Merry" Date: Thu, 5 Jan 2012 20:41:38 +0530 Thread-Topic: kldunload hangs on FreeBSD with camcontrol debug on Thread-Index: AczLvFLEJn+sZ/RgRbiyo3blVV3MEw== Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "gibbs@FreeBSD.org" , "McConnell, Stephen" Subject: kldunload hangs on FreeBSD with camcontrol debug on 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: Thu, 05 Jan 2012 15:22:40 -0000 While doing some sanity test on "mps" driver, I found kldunload hangs in be= low condition. Case-1 1. Connect LSI 2008 controller(any SAS2 card). Load there mps driver and de= tect the controller. 2. unload driver/load driver in loop. There will not be any problem. Case-2=20 Run above Case-1 with below settings. "camcontorl debug -IT " A moment I enable CAM debug level -I and -T, kldunload always hangs on "sim= ->refcount" Here is relavent output for reference. Jan 5 06:42:08 dhcp-135-24-192-146 kernel: mpslsi30: mps_detach_sas:754 re= f count 2 Jan 5 06:42:08 dhcp-135-24-192-146 kernel: mpslsi30: path ID 6 Jan 5 06:42:08 dhcp-135-24-192-146 kernel: (noperiph:mpslsi30:0:-1:-1): xp= t_compile_path Jan 5 06:42:08 dhcp-135-24-192-146 kernel: (noperiph:mpslsi30:0:-1:-1): xp= t_async Jan 5 06:42:08 dhcp-135-24-192-146 kernel: (noperiph:mpslsi30:0:-1:-1): xp= t_async Jan 5 06:42:08 dhcp-135-24-192-146 kernel: (noperiph:mpslsi30:0:-1:-1): xp= t_release_path Jan 5 06:42:08 dhcp-135-24-192-146 kernel: mpslsi30: mps_detach_sas:757 re= f count 2 I have added few prints in detach routine (mps_detach_sas) as below. if (sassc->sim !=3D NULL) { mps_dprint(sc, MPS_INFO, "%s:%d ref count %d\n", __func__,__LINE__,= sassc->sim->refcount); mps_dprint(sc, MPS_INFO, "path ID %d\n",cam_sim_path(sassc->sim)); xpt_bus_deregister(cam_sim_path(sassc->sim)); mps_dprint(sc, MPS_INFO, "%s:%d ref count %d\n", __func__,__LINE__,= sassc->sim->refcount); cam_sim_free(sassc->sim, FALSE); } Before entering into " xpt_bus_deregister" sim->refcount is 2 and which nev= er goes to 0. And eventually Driver unloading hangs at Cam_sim_free() at below location.... error =3D msleep(sim, sim->mtx, PRIBIO, "simfree", 0); Any idea about this issue ? Regards, Kashyap