Re: [Testing wanted] USB patch for HAL

From: Greg Rivers <gcr+freebsd-current_at_tharned.org>
Date: Sun, 26 Jun 2011 02:27:22 -0500 (CDT)
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
_at__at_ -127,3 +127,2 _at__at_
  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
_at__at_ -3592,6 +3592,9 _at__at_
 		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
Received on Sun Jun 26 2011 - 05:27:29 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:15 UTC