[Testing wanted] USB patch for HAL

Greg Rivers gcr+freebsd-current at tharned.org
Sun Jun 26 07:27:29 UTC 2011


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


More information about the freebsd-current mailing list