Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Jun 2011 02:27:22 -0500 (CDT)
From:      Greg Rivers <gcr+freebsd-current@tharned.org>
To:        Hans Petter Selasky <hselasky@c2i.net>
Cc:        freebsd-current@freebsd.org
Subject:   Re: [Testing wanted] USB patch for HAL
Message-ID:  <alpine.BSF.2.00.1106252213060.12946@badger.tharned.org>
In-Reply-To: <201106252054.38056.hselasky@c2i.net>
References:  <201106241531.19375.hselasky@c2i.net> <alpine.BSF.2.00.1106251318540.12946@badger.tharned.org> <201106252054.38056.hselasky@c2i.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.1106252213060.12946>