cvs commit: src/sys/cam cam_ccb.h cam_periph.c cam_periph.h cam_sim.c cam_sim.h cam_xpt.c cam_xpt.h cam_xpt_periph.h src/sys/cam/scsi scsi_cd.c scsi_ch.c scsi_da.c scsi_low.c scsi_pass.c scsi_pt.c scsi_sa.c scsi_ses.c scsi_sg.c ...

Nate Lawson nate at root.org
Sun Apr 15 17:28:29 UTC 2007


Scott Long wrote:
> scottl      2007-04-15 08:49:19 UTC
> 
>   FreeBSD src repository
> 
>   Modified files:
>     sys/cam              cam_ccb.h cam_periph.c cam_periph.h 
>                          cam_sim.c cam_sim.h cam_xpt.c cam_xpt.h 
>                          cam_xpt_periph.h 
>     sys/cam/scsi         scsi_cd.c scsi_ch.c scsi_da.c scsi_low.c 
>                          scsi_pass.c scsi_pt.c scsi_sa.c 
>                          scsi_ses.c scsi_sg.c scsi_targ_bh.c 
>                          scsi_target.c 
>     sys/dev/aac          aac_cam.c 
>     sys/dev/advansys     advansys.c adwcam.c 
>     sys/dev/aha          aha.c 
>     sys/dev/ahb          ahb.c 
>     sys/dev/aic          aic.c 
>     sys/dev/aic7xxx      aic79xx_osm.c aic7xxx_osm.c 
>     sys/dev/amd          amd.c 
>     sys/dev/amr          amr_cam.c 
>     sys/dev/arcmsr       arcmsr.c 
>     sys/dev/asr          asr.c 
>     sys/dev/ata          atapi-cam.c 
>     sys/dev/buslogic     bt.c 
>     sys/dev/ciss         ciss.c 
>     sys/dev/dpt          dpt_scsi.c 
>     sys/dev/esp          ncr53c9x.c 
>     sys/dev/firewire     sbp.c sbp_targ.c 
>     sys/dev/hptmv        entry.c 
>     sys/dev/iir          iir.c 
>     sys/dev/isp          isp_freebsd.c 
>     sys/dev/mly          mly.c 
>     sys/dev/mpt          mpt_cam.c 
>     sys/dev/ppbus        vpo.c 
>     sys/dev/rr232x       osm_bsd.c 
>     sys/dev/sym          sym_hipd.c 
>     sys/dev/trm          trm.c 
>     sys/dev/twa          tw_osl_cam.c 
>     sys/dev/usb          umass.c 
>     sys/dev/wds          wd7000.c 
>     sys/pci              ncr.c 
>   Log:
>   Remove Giant from CAM.  Drivers (SIMs) now register a mutex that CAM will
>   use to synchornize and protect all data objects that are used for that
>   SIM.  Drivers that are not yet MPSAFE register Giant and operate as
>   usual.  RIght now, no drivers are MPSAFE, though a few will be changed
>   in the coming week as this work settles down.
>   
>   The driver API has changed, so all CAM drivers will need to be recompiled.
>   The userland API has not changed, so tools like camcontrol do not need to
>   be recompiled.
>   
>   Revision  Changes    Path
>   1.35      +6 -3      src/sys/cam/cam_ccb.h
>   1.65      +86 -45    src/sys/cam/cam_periph.c
>   1.17      +5 -1      src/sys/cam/cam_periph.h
>   1.10      +32 -27    src/sys/cam/cam_sim.c
>   1.7       +19 -2     src/sys/cam/cam_sim.h
>   1.176     +447 -319  src/sys/cam/cam_xpt.c
>   1.8       +6 -0      src/sys/cam/cam_xpt.h
>   1.6       +2 -2      src/sys/cam/cam_xpt_periph.h
>   1.98      +244 -194  src/sys/cam/scsi/scsi_cd.c
>   1.44      +38 -31    src/sys/cam/scsi/scsi_ch.c
>   1.204     +85 -98    src/sys/cam/scsi/scsi_da.c
>   1.27      +2 -2      src/sys/cam/scsi/scsi_low.c
>   1.46      +32 -26    src/sys/cam/scsi/scsi_pass.c
>   1.45      +19 -76    src/sys/cam/scsi/scsi_pt.c
>   1.108     +47 -71    src/sys/cam/scsi/scsi_sa.c
>   1.34      +36 -17    src/sys/cam/scsi/scsi_ses.c
>   1.5       +38 -19    src/sys/cam/scsi/scsi_sg.c
>   1.24      +2 -8      src/sys/cam/scsi/scsi_targ_bh.c
>   1.73      +64 -16    src/sys/cam/scsi/scsi_target.c
>   1.27      +1 -1      src/sys/dev/aac/aac_cam.c
>   1.34      +1 -1      src/sys/dev/advansys/advansys.c
>   1.27      +1 -1      src/sys/dev/advansys/adwcam.c
>   1.63      +2 -2      src/sys/dev/aha/aha.c
>   1.41      +1 -1      src/sys/dev/ahb/ahb.c
>   1.26      +4 -1      src/sys/dev/aic/aic.c
>   1.27      +1 -1      src/sys/dev/aic7xxx/aic79xx_osm.c
>   1.48      +3 -2      src/sys/dev/aic7xxx/aic7xxx_osm.c
>   1.35      +3 -2      src/sys/dev/amd/amd.c
>   1.21      +1 -0      src/sys/dev/amr/amr_cam.c
>   1.22      +3 -2      src/sys/dev/arcmsr/arcmsr.c
>   1.84      +2 -1      src/sys/dev/asr/asr.c
>   1.51      +1 -1      src/sys/dev/ata/atapi-cam.c
>   1.49      +1 -1      src/sys/dev/buslogic/bt.c
>   1.76      +2 -2      src/sys/dev/ciss/ciss.c
>   1.56      +2 -1      src/sys/dev/dpt/dpt_scsi.c
>   1.16      +1 -1      src/sys/dev/esp/ncr53c9x.c
>   1.90      +1 -0      src/sys/dev/firewire/sbp.c
>   1.11      +1 -1      src/sys/dev/firewire/sbp_targ.c
>   1.16      +2 -1      src/sys/dev/hptmv/entry.c
>   1.18      +2 -1      src/sys/dev/iir/iir.c
>   1.138     +4 -3      src/sys/dev/isp/isp_freebsd.c
>   1.44      +2 -0      src/sys/dev/mly/mly.c
>   1.54      +7 -5      src/sys/dev/mpt/mpt_cam.c
>   1.35      +3 -1      src/sys/dev/ppbus/vpo.c
>   1.5       +2 -1      src/sys/dev/rr232x/osm_bsd.c
>   1.64      +1 -1      src/sys/dev/sym/sym_hipd.c
>   1.32      +1 -0      src/sys/dev/trm/trm.c
>   1.9       +1 -1      src/sys/dev/twa/tw_osl_cam.c
>   1.143     +3 -0      src/sys/dev/usb/umass.c
>   1.13      +2 -1      src/sys/dev/wds/wd7000.c
>   1.194     +3 -1      src/sys/pci/ncr.c
> 

Amazing work, I owe you a beer for following through where none of us
did.  I see you went with the SIM lock approach, which seems reasonable.

On the targ diff:
@@ -229,44 +252,56 @@
 	{
 		struct ioc_enable_lun	*new_lun;
 		struct cam_path		*path;
+		struct cam_sim		*sim;

 		new_lun = (struct ioc_enable_lun *)addr;
-		status = xpt_create_path(&path, /*periph*/NULL,
-					 new_lun->path_id,
-					 new_lun->target_id,
-					 new_lun->lun_id);
+		status = xpt_create_path_unlocked(&path, /*periph*/NULL,
+						  new_lun->path_id,
+						  new_lun->target_id,
+						  new_lun->lun_id);
 		if (status != CAM_REQ_CMP) {
 			printf("Couldn't create path, status %#x\n", status);
 			break;
 		}
+		sim = xpt_path_sim(path);
+		mtx_lock(sim->mtx);
 		status = targenable(softc, path, new_lun->grp6_len,
 				    new_lun->grp7_len);
 		xpt_free_path(path);
+		mtx_unlock(sim->mtx);
                ^^^^^^^^^^^^^^^^^^^^^
 		break;
 	}

I think the unlock can come before freeing the path, can't it?

-- 
Nate


More information about the cvs-src mailing list