From owner-freebsd-current@FreeBSD.ORG Sun Jun 26 07:27:29 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D737A106567E for ; Sun, 26 Jun 2011 07:27:29 +0000 (UTC) (envelope-from gcr+freebsd-current@tharned.org) Received: from roadkill.tharned.org (roadkill.tharned.org [75.145.12.185]) by mx1.freebsd.org (Postfix) with ESMTP id 798298FC12 for ; Sun, 26 Jun 2011 07:27:29 +0000 (UTC) Received: from badger.tharned.org (badger.tharned.org [10.10.10.23]) (authenticated bits=0) by roadkill.tharned.org (8.14.4/8.14.4) with ESMTP id p5Q7RMvj088015 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 26 Jun 2011 02:27:23 -0500 (CDT) (envelope-from gcr+freebsd-current@tharned.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tharned.org; s=2011; t=1309073243; bh=8Tchrl0I17LXvx8hYFNVpx8eBppEYp0foh32jZKlGqQ=; l=1899; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=TI1AwtL3BE3eU3VljA613BcHsFpEZ/HWv7jC76HQMIPpxErp04QsCrRLmA+lhiJ/I 2VAYfHATIZuTxb7KVui3dZM+z4g7QIjk63wsA0+9wQemWlM1tApOZiR0hLKVrPf1lZ K5Ep+kbBBuLiOovE1K943GSPyShC+ttypfJ3XNhg= Date: Sun, 26 Jun 2011 02:27:22 -0500 (CDT) From: Greg Rivers To: Hans Petter Selasky In-Reply-To: <201106252054.38056.hselasky@c2i.net> Message-ID: References: <201106241531.19375.hselasky@c2i.net> <201106252054.38056.hselasky@c2i.net> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (roadkill.tharned.org [75.145.12.185]); Sun, 26 Jun 2011 02:27:23 -0500 (CDT) Cc: freebsd-current@freebsd.org Subject: Re: [Testing wanted] USB patch for HAL X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jun 2011 07:27:29 -0000 Here are some of the results from testing based on your instructions and patches in IRC earlier today. First, per your instructions, I removed sg by modifying /usr/src/sys/conf/files and rebuilding the kernel: --- files.orig 2011-06-25 16:26:46.000000000 -0500 +++ files 2011-06-25 16:26:58.000000000 -0500 @@ -127,3 +127,2 @@ cam/scsi/scsi_ses.c optional ses -cam/scsi/scsi_sg.c optional sg cam/scsi/scsi_targ_bh.c optional targbh Curiously, with this change, /dev/sg0 was still created and sg0 still appeared in `camcontrol devlist`, but things were better. hald still stopped working after the first detach, but was not unkillable and started working again after it was restarted. And whether or not hald was restarted, the USB bus no longer wedged and continued to work properly. Next, leaving the above patch in place, I rebuilt the kernel with the patch you provided for /usr/src/sys/cam/cam_xpt.c: --- cam_xpt.c 2011-06-26 00:16:44.000000000 +0200 +++ cam_xpt.c 2011-06-26 00:16:13.000000000 +0200 @@ -3592,6 +3592,9 @@ xpt_free_ccb(free_ccb); sim->ccb_count--; } else { + /* reset private data */ + memset(&free_ccb->ccb_h.periph_priv, 0, sizeof(free_ccb->ccb_h.periph_priv)); + SLIST_INSERT_HEAD(&sim->ccb_freeq, &free_ccb->ccb_h, xpt_links.sle); } With this change, the USB bus continued to operate as expected while attaching and detaching a USB flash drive. On start up, hald was not detecting the attach/detach events, but started working and kept working after restarting it. In summary, with both of the above changes, everything worked pretty much correctly. I know this is still inconclusive, but I wanted to report what I had so far. After I get some sleep, I'll proceed with trying to get the back traces inside cam_periph_release_locked that you asked for. -- Greg Rivers