PERFORCE change 118640 for review
Matt Jacob
mjacob at FreeBSD.org
Mon Apr 23 06:02:04 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=118640
Change 118640 by mjacob at mjexp on 2007/04/23 06:01:01
Rip out all locking in preparation for mpsafe.
Affected files ...
.. //depot/projects/mjexp/sys/dev/mpt/mpt.c#6 edit
.. //depot/projects/mjexp/sys/dev/mpt/mpt.h#10 edit
.. //depot/projects/mjexp/sys/dev/mpt/mpt_cam.c#18 edit
.. //depot/projects/mjexp/sys/dev/mpt/mpt_pci.c#10 edit
.. //depot/projects/mjexp/sys/dev/mpt/mpt_raid.c#4 edit
Differences ...
==== //depot/projects/mjexp/sys/dev/mpt/mpt.c#6 (text+ko) ====
@@ -1171,7 +1171,6 @@
}
KASSERT(req->state != REQ_STATE_FREE, ("freeing free request"));
KASSERT(!(req->state & REQ_STATE_LOCKED), ("freeing locked request"));
- KASSERT(MPT_OWNED(mpt), ("mpt_free_request: mpt not locked\n"));
KASSERT(mpt_req_on_free_list(mpt, req) == 0,
("mpt_free_request: req %p:%u func %x already on freelist",
req, req->serno, ((MSG_REQUEST_HEADER *)req->req_vbuf)->Function));
@@ -1220,7 +1219,6 @@
request_t *req;
retry:
- KASSERT(MPT_OWNED(mpt), ("mpt_get_request: mpt not locked\n"));
req = TAILQ_FIRST(&mpt->request_free_list);
if (req != NULL) {
KASSERT(req == &mpt->request_pool[req->index],
==== //depot/projects/mjexp/sys/dev/mpt/mpt.h#10 (text+ko) ====
@@ -740,9 +740,6 @@
#define MPT_IFLAGS INTR_TYPE_CAM
#define MPT_LOCK(mpt) mpt_lockspl(mpt)
#define MPT_UNLOCK(mpt) mpt_unlockspl(mpt)
-#define MPT_OWNED(mpt) mpt->mpt_islocked
-#define MPTLOCK_2_CAMLOCK MPT_UNLOCK
-#define CAMLOCK_2_MPTLOCK MPT_LOCK
#define MPT_LOCK_SETUP(mpt)
#define MPT_LOCK_DESTROY(mpt)
@@ -794,57 +791,11 @@
}
#else
-#ifdef LOCKING_WORKED_AS_IT_SHOULD
-#error "Shouldn't Be Here!"
-#define MPT_IFLAGS INTR_TYPE_CAM | INTR_ENTROPY | INTR_MPSAFE
-#define MPT_LOCK_SETUP(mpt) \
- mtx_init(&mpt->mpt_lock, "mpt", NULL, MTX_DEF); \
- mpt->mpt_locksetup = 1
-#define MPT_LOCK_DESTROY(mpt) \
- if (mpt->mpt_locksetup) { \
- mtx_destroy(&mpt->mpt_lock); \
- mpt->mpt_locksetup = 0; \
- }
-
-#define MPT_LOCK(mpt) mtx_lock(&(mpt)->mpt_lock)
-#define MPT_UNLOCK(mpt) mtx_unlock(&(mpt)->mpt_lock)
-#define MPT_OWNED(mpt) mtx_owned(&(mpt)->mpt_lock)
-#define MPTLOCK_2_CAMLOCK(mpt) \
- mtx_unlock(&(mpt)->mpt_lock); mtx_lock(&Giant)
-#define CAMLOCK_2_MPTLOCK(mpt) \
- mtx_unlock(&Giant); mtx_lock(&(mpt)->mpt_lock)
-#define mpt_sleep(mpt, ident, priority, wmesg, timo) \
- msleep(ident, &(mpt)->mpt_lock, priority, wmesg, timo)
-
-#else
-
#define MPT_IFLAGS INTR_TYPE_CAM | INTR_ENTROPY
#define MPT_LOCK_SETUP(mpt) do { } while (0)
#define MPT_LOCK_DESTROY(mpt) do { } while (0)
-#if 0
-#define MPT_LOCK(mpt) \
- device_printf(mpt->dev, "LOCK %s:%d\n", __FILE__, __LINE__); \
- KASSERT(mpt->mpt_locksetup == 0, \
- ("recursive lock acquire at %s:%d", __FILE__, __LINE__)); \
- mpt->mpt_locksetup = 1
-#define MPT_UNLOCK(mpt) \
- device_printf(mpt->dev, "UNLK %s:%d\n", __FILE__, __LINE__); \
- KASSERT(mpt->mpt_locksetup == 1, \
- ("release unowned lock at %s:%d", __FILE__, __LINE__)); \
- mpt->mpt_locksetup = 0
-#else
-#define MPT_LOCK(mpt) \
- KASSERT(mpt->mpt_locksetup == 0, \
- ("recursive lock acquire at %s:%d", __FILE__, __LINE__)); \
- mpt->mpt_locksetup = 1
-#define MPT_UNLOCK(mpt) \
- KASSERT(mpt->mpt_locksetup == 1, \
- ("release unowned lock at %s:%d", __FILE__, __LINE__)); \
- mpt->mpt_locksetup = 0
-#endif
-#define MPT_OWNED(mpt) mpt->mpt_locksetup
-#define MPTLOCK_2_CAMLOCK(mpt) MPT_UNLOCK(mpt)
-#define CAMLOCK_2_MPTLOCK(mpt) MPT_LOCK(mpt)
+#define MPT_LOCK(mpt) do { } while (0)
+#define MPT_UNLOCK(mpt) do { } while (0)
static __inline int
mpt_sleep(struct mpt_softc *, void *, int, const char *, int);
@@ -853,13 +804,10 @@
mpt_sleep(struct mpt_softc *mpt, void *i, int p, const char *w, int t)
{
int r;
- MPT_UNLOCK(mpt);
r = tsleep(i, p, w, t);
- MPT_LOCK(mpt);
return (r);
}
#endif
-#endif
/******************************* Register Access ******************************/
static __inline void mpt_write(struct mpt_softc *, size_t, uint32_t);
==== //depot/projects/mjexp/sys/dev/mpt/mpt_cam.c#18 (text+ko) ====
@@ -295,7 +295,6 @@
/*
* The rest of this is CAM foo, for which we need to drop our lock
*/
- MPTLOCK_2_CAMLOCK(mpt);
/*
* Create the device queue for our SIM(s).
@@ -340,7 +339,6 @@
* devices if the controller supports RAID.
*/
if (mpt->ioc_page2 == NULL || mpt->ioc_page2->MaxPhysDisks == 0) {
- CAMLOCK_2_MPTLOCK(mpt);
return (0);
}
@@ -371,12 +369,10 @@
error = ENOMEM;
goto cleanup;
}
- CAMLOCK_2_MPTLOCK(mpt);
mpt_lprt(mpt, MPT_PRT_DEBUG, "attached cam\n");
return (0);
cleanup:
- CAMLOCK_2_MPTLOCK(mpt);
cleanup0:
mpt_cam_detach(mpt);
return (error);
@@ -836,11 +832,9 @@
/*
* Try to add some target command resources
*/
- MPT_LOCK(mpt);
if (mpt_add_target_commands(mpt) == FALSE) {
mpt_prt(mpt, "failed to add target commands\n");
}
- MPT_UNLOCK(mpt);
}
mpt->ready = 1;
}
@@ -873,21 +867,17 @@
}
if (mpt->sim != NULL) {
- MPTLOCK_2_CAMLOCK(mpt);
xpt_free_path(mpt->path);
xpt_bus_deregister(cam_sim_path(mpt->sim));
cam_sim_free(mpt->sim, TRUE);
mpt->sim = NULL;
- CAMLOCK_2_MPTLOCK(mpt);
}
if (mpt->phydisk_sim != NULL) {
- MPTLOCK_2_CAMLOCK(mpt);
xpt_free_path(mpt->phydisk_path);
xpt_bus_deregister(cam_sim_path(mpt->phydisk_sim));
cam_sim_free(mpt->phydisk_sim, TRUE);
mpt->phydisk_sim = NULL;
- CAMLOCK_2_MPTLOCK(mpt);
}
}
@@ -899,9 +889,7 @@
struct mpt_softc *mpt;
mpt = (struct mpt_softc *)cam_sim_softc(sim);
- MPT_LOCK(mpt);
mpt_intr(mpt);
- MPT_UNLOCK(mpt);
}
/*
@@ -917,7 +905,6 @@
ccb = (union ccb *)arg;
mpt = ccb->ccb_h.ccb_mpt_ptr;
- MPT_LOCK(mpt);
req = ccb->ccb_h.ccb_req_ptr;
mpt_prt(mpt, "request %p:%u timed out for ccb %p (req->ccb %p)\n", req,
req->serno, ccb, req->ccb);
@@ -928,7 +915,6 @@
req->state |= REQ_STATE_TIMEDOUT;
mpt_wakeup_recovery_thread(mpt);
}
- MPT_UNLOCK(mpt);
}
/*
@@ -1024,9 +1010,7 @@
ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d\n", __LINE__));
xpt_done(ccb);
- CAMLOCK_2_MPTLOCK(mpt);
mpt_free_request(mpt, req);
- MPTLOCK_2_CAMLOCK(mpt);
return;
}
@@ -1249,9 +1233,7 @@
if (seg < nseg && nxt_off >= MPT_REQUEST_AREA) {
request_t *nrq;
- CAMLOCK_2_MPTLOCK(mpt);
nrq = mpt_get_request(mpt, FALSE);
- MPTLOCK_2_CAMLOCK(mpt);
if (nrq == NULL) {
error = ENOMEM;
@@ -1299,9 +1281,7 @@
ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d\n", __LINE__));
xpt_done(ccb);
- CAMLOCK_2_MPTLOCK(mpt);
mpt_free_request(mpt, req);
- MPTLOCK_2_CAMLOCK(mpt);
return;
}
@@ -1336,9 +1316,7 @@
tgt->state = TGT_STATE_MOVING_DATA;
#endif
}
- CAMLOCK_2_MPTLOCK(mpt);
mpt_send_cmd(mpt, req);
- MPTLOCK_2_CAMLOCK(mpt);
}
static void
@@ -1427,9 +1405,7 @@
ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d\n", __LINE__));
xpt_done(ccb);
- CAMLOCK_2_MPTLOCK(mpt);
mpt_free_request(mpt, req);
- MPTLOCK_2_CAMLOCK(mpt);
return;
}
@@ -1651,9 +1627,7 @@
if (seg < nseg && nxt_off >= MPT_REQUEST_AREA) {
request_t *nrq;
- CAMLOCK_2_MPTLOCK(mpt);
nrq = mpt_get_request(mpt, FALSE);
- MPTLOCK_2_CAMLOCK(mpt);
if (nrq == NULL) {
error = ENOMEM;
@@ -1701,9 +1675,7 @@
ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d\n", __LINE__));
xpt_done(ccb);
- CAMLOCK_2_MPTLOCK(mpt);
mpt_free_request(mpt, req);
- MPTLOCK_2_CAMLOCK(mpt);
return;
}
@@ -1738,9 +1710,7 @@
tgt->state = TGT_STATE_MOVING_DATA;
#endif
}
- CAMLOCK_2_MPTLOCK(mpt);
mpt_send_cmd(mpt, req);
- MPTLOCK_2_CAMLOCK(mpt);
}
static void
@@ -1759,7 +1729,6 @@
mpt = ccb->ccb_h.ccb_mpt_ptr;
raid_passthru = (sim == mpt->phydisk_sim);
- CAMLOCK_2_MPTLOCK(mpt);
if ((req = mpt_get_request(mpt, FALSE)) == NULL) {
if (mpt->outofbeer == 0) {
mpt->outofbeer = 1;
@@ -1768,14 +1737,12 @@
}
ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
mpt_set_ccb_status(ccb, CAM_REQUEUE_REQ);
- MPTLOCK_2_CAMLOCK(mpt);
xpt_done(ccb);
return;
}
#ifdef INVARIANTS
mpt_req_not_spcl(mpt, req, "mpt_start", __LINE__);
#endif
- MPTLOCK_2_CAMLOCK(mpt);
if (sizeof (bus_addr_t) > 4) {
cb = mpt_execute_req_a64;
@@ -1797,15 +1764,12 @@
mpt_req->Function = MPI_FUNCTION_SCSI_IO_REQUEST;
if (raid_passthru) {
mpt_req->Function = MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH;
- CAMLOCK_2_MPTLOCK(mpt);
if (mpt_map_physdisk(mpt, ccb, &tgt) != 0) {
- MPTLOCK_2_CAMLOCK(mpt);
ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
mpt_set_ccb_status(ccb, CAM_DEV_NOT_THERE);
xpt_done(ccb);
return;
}
- MPTLOCK_2_CAMLOCK(mpt);
mpt_req->Bus = 0; /* we never set bus here */
} else {
tgt = ccb->ccb_h.target_id;
@@ -2099,7 +2063,6 @@
} else {
pathid = cam_sim_path(mpt->sim);
}
- MPTLOCK_2_CAMLOCK(mpt);
/*
* Allocate a CCB, create a wildcard path for this bus,
* and schedule a rescan.
@@ -2107,19 +2070,16 @@
ccb = xpt_alloc_ccb_nowait();
if (ccb == NULL) {
mpt_prt(mpt, "unable to alloc CCB for rescan\n");
- CAMLOCK_2_MPTLOCK(mpt);
break;
}
if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, pathid,
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
- CAMLOCK_2_MPTLOCK(mpt);
mpt_prt(mpt, "unable to create path for rescan\n");
xpt_free_ccb(ccb);
break;
}
xpt_rescan(ccb);
- CAMLOCK_2_MPTLOCK(mpt);
break;
}
#else
@@ -2214,13 +2174,11 @@
} else {
sim = mpt->sim;
}
- MPTLOCK_2_CAMLOCK(mpt);
for (lun_id = 0; lun_id < MPT_MAX_LUNS; lun_id++) {
if (xpt_create_path(&tmppath, NULL, cam_sim_path(sim),
pqf->TargetID, lun_id) != CAM_REQ_CMP) {
mpt_prt(mpt, "unable to create a path to send "
"XPT_REL_SIMQ");
- CAMLOCK_2_MPTLOCK(mpt);
break;
}
xpt_setup_ccb(&crs.ccb_h, tmppath, 5);
@@ -2233,7 +2191,6 @@
}
xpt_free_path(tmppath);
}
- CAMLOCK_2_MPTLOCK(mpt);
break;
}
case MPI_EVENT_EVENT_CHANGE:
@@ -2329,9 +2286,7 @@
req, req->serno);
}
KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d\n", __LINE__));
- MPTLOCK_2_CAMLOCK(mpt);
xpt_done(ccb);
- CAMLOCK_2_MPTLOCK(mpt);
if ((req->state & REQ_STATE_TIMEDOUT) == 0) {
TAILQ_REMOVE(&mpt->request_pending_list, req, links);
} else {
@@ -2904,7 +2859,6 @@
CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("mpt_action\n"));
mpt = (struct mpt_softc *)cam_sim_softc(sim);
- KASSERT(MPT_OWNED(mpt) == 0, ("mpt owned on entrance to mpt_action"));
raid_passthru = (sim == mpt->phydisk_sim);
tgt = ccb->ccb_h.target_id;
@@ -2913,15 +2867,12 @@
ccb->ccb_h.func_code != XPT_PATH_INQ &&
ccb->ccb_h.func_code != XPT_RESET_BUS &&
ccb->ccb_h.func_code != XPT_RESET_DEV) {
- CAMLOCK_2_MPTLOCK(mpt);
if (mpt_map_physdisk(mpt, ccb, &tgt) != 0) {
- MPTLOCK_2_CAMLOCK(mpt);
ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
mpt_set_ccb_status(ccb, CAM_DEV_NOT_THERE);
xpt_done(ccb);
return;
}
- MPTLOCK_2_CAMLOCK(mpt);
}
ccb->ccb_h.ccb_mpt_ptr = mpt;
@@ -2970,9 +2921,7 @@
} else {
xpt_print(ccb->ccb_h.path, "reset device\n");
}
- CAMLOCK_2_MPTLOCK(mpt);
(void) mpt_bus_reset(mpt, tgt, lun, FALSE);
- MPTLOCK_2_CAMLOCK(mpt);
/*
* mpt_bus_reset is always successful in that it
@@ -2986,7 +2935,6 @@
case XPT_ABORT:
{
union ccb *accb = ccb->cab.abort_ccb;
- CAMLOCK_2_MPTLOCK(mpt);
switch (accb->ccb_h.func_code) {
case XPT_ACCEPT_TARGET_IO:
case XPT_IMMED_NOTIFY:
@@ -3003,7 +2951,6 @@
ccb->ccb_h.status = CAM_REQ_INVALID;
break;
}
- MPTLOCK_2_CAMLOCK(mpt);
break;
}
@@ -3143,7 +3090,6 @@
period >>= MPI_SCSIDEVPAGE1_RP_SHIFT_MIN_SYNC_PERIOD;
}
#endif
- CAMLOCK_2_MPTLOCK(mpt);
if (dval & DP_DISC_ENABLE) {
mpt->mpt_disc_enable |= (1 << tgt);
} else if (dval & DP_DISC_DISABL) {
@@ -3161,7 +3107,6 @@
mpt_setsync(mpt, tgt, period, offset);
}
if (dval == 0) {
- MPTLOCK_2_CAMLOCK(mpt);
mpt_set_ccb_status(ccb, CAM_REQ_CMP);
break;
}
@@ -3173,7 +3118,6 @@
} else {
mpt_set_ccb_status(ccb, CAM_REQ_CMP);
}
- MPTLOCK_2_CAMLOCK(mpt);
break;
}
case XPT_GET_TRAN_SETTINGS:
@@ -3344,14 +3288,12 @@
{
int result;
- CAMLOCK_2_MPTLOCK(mpt);
if (ccb->cel.enable)
result = mpt_enable_lun(mpt,
ccb->ccb_h.target_id, ccb->ccb_h.target_lun);
else
result = mpt_disable_lun(mpt,
ccb->ccb_h.target_id, ccb->ccb_h.target_lun);
- MPTLOCK_2_CAMLOCK(mpt);
if (result == 0) {
mpt_set_ccb_status(ccb, CAM_REQ_CMP);
} else {
@@ -3381,7 +3323,6 @@
} else {
trtp = &mpt->trt[lun];
}
- CAMLOCK_2_MPTLOCK(mpt);
if (ccb->ccb_h.func_code == XPT_ACCEPT_TARGET_IO) {
mpt_lprt(mpt, MPT_PRT_DEBUG1,
"Put FREE ATIO %p lun %d\n", ccb, lun);
@@ -3396,13 +3337,10 @@
mpt_lprt(mpt, MPT_PRT_ALWAYS, "Got Notify ACK\n");
}
mpt_set_ccb_status(ccb, CAM_REQ_INPROG);
- MPTLOCK_2_CAMLOCK(mpt);
return;
}
case XPT_CONT_TARGET_IO:
- CAMLOCK_2_MPTLOCK(mpt);
mpt_target_start_io(mpt, ccb);
- MPTLOCK_2_CAMLOCK(mpt);
return;
default:
@@ -3446,16 +3384,13 @@
CONFIG_PAGE_SCSI_DEVICE_0 tmp;
dval = 0;
- CAMLOCK_2_MPTLOCK(mpt);
tmp = mpt->mpt_dev_page0[tgt];
rv = mpt_read_cur_cfg_page(mpt, tgt, &tmp.Header,
sizeof(tmp), FALSE, 5000);
if (rv) {
- MPTLOCK_2_CAMLOCK(mpt);
mpt_prt(mpt, "can't get tgt %d config page 0\n", tgt);
return (rv);
}
- MPTLOCK_2_CAMLOCK(mpt);
mpt_lprt(mpt, MPT_PRT_DEBUG,
"mpt_get_spi_settings[%d]: current NP %x Info %x\n", tgt,
tmp.NegotiatedParameters, tmp.Information);
@@ -3656,7 +3591,6 @@
mtx_lock(&Giant);
#endif
mpt = (struct mpt_softc *)arg;
- MPT_LOCK(mpt);
for (;;) {
if (TAILQ_EMPTY(&mpt->request_timeout_list) != 0) {
if (mpt->shutdwn_recovery == 0) {
@@ -3670,7 +3604,6 @@
}
mpt->recovery_thread = NULL;
wakeup(&mpt->recovery_thread);
- MPT_UNLOCK(mpt);
#if __FreeBSD_version >= 500000
mtx_unlock(&Giant);
#endif
@@ -4118,18 +4051,14 @@
xpt_freeze_simq(mpt->sim, 1);
ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
tgt->ccb->ccb_h.status |= CAM_RELEASE_SIMQ;
- MPTLOCK_2_CAMLOCK(mpt);
xpt_done(ccb);
- CAMLOCK_2_MPTLOCK(mpt);
return;
default:
mpt_prt(mpt, "ccb %p flags 0x%x tag 0x%08x had bad request "
"starting I/O\n", ccb, csio->ccb_h.flags, csio->tag_id);
mpt_tgt_dump_req_state(mpt, cmd_req);
mpt_set_ccb_status(ccb, CAM_REQ_CMP_ERR);
- MPTLOCK_2_CAMLOCK(mpt);
xpt_done(ccb);
- CAMLOCK_2_MPTLOCK(mpt);
return;
}
@@ -4149,9 +4078,7 @@
}
ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
mpt_set_ccb_status(ccb, CAM_REQUEUE_REQ);
- MPTLOCK_2_CAMLOCK(mpt);
xpt_done(ccb);
- CAMLOCK_2_MPTLOCK(mpt);
return;
}
ccb->ccb_h.status = CAM_SIM_QUEUED | CAM_REQ_INPROG;
@@ -4225,7 +4152,6 @@
"nxtstate=%d\n", csio, csio->tag_id, csio->dxfer_len,
tgt->resid, ccb->ccb_h.flags, req, req->serno, tgt->state);
- MPTLOCK_2_CAMLOCK(mpt);
if ((ccb->ccb_h.flags & CAM_SCATTER_VALID) == 0) {
if ((ccb->ccb_h.flags & CAM_DATA_PHYS) == 0) {
int error;
@@ -4265,7 +4191,6 @@
(*cb)(req, sgs, csio->sglist_cnt, 0);
}
}
- CAMLOCK_2_MPTLOCK(mpt);
} else {
uint8_t *sp = NULL, sense[MPT_SENSE_SIZE];
@@ -4282,9 +4207,7 @@
ccb->ccb_h.status, tgt->resid, tgt->bytes_xfered);
mpt_set_ccb_status(ccb, CAM_REQ_CMP);
ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
- MPTLOCK_2_CAMLOCK(mpt);
xpt_done(ccb);
- CAMLOCK_2_MPTLOCK(mpt);
return;
}
if (ccb->ccb_h.flags & CAM_SEND_SENSE) {
@@ -4490,9 +4413,7 @@
if (ccb) {
ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
mpt_set_ccb_status(ccb, CAM_REQUEUE_REQ);
- MPTLOCK_2_CAMLOCK(mpt);
xpt_done(ccb);
- CAMLOCK_2_MPTLOCK(mpt);
} else {
mpt_prt(mpt,
"could not allocate status request- dropping\n");
@@ -4667,9 +4588,7 @@
}
tgt->ccb = (union ccb *) inot;
inot->ccb_h.status = CAM_MESSAGE_RECV|CAM_DEV_QFRZN;
- MPTLOCK_2_CAMLOCK(mpt);
xpt_done((union ccb *)inot);
- CAMLOCK_2_MPTLOCK(mpt);
}
static void
@@ -4948,9 +4867,7 @@
itag, atiop->tag_id, tgt->reply_desc, tgt->resid);
}
- MPTLOCK_2_CAMLOCK(mpt);
xpt_done((union ccb *)atiop);
- CAMLOCK_2_MPTLOCK(mpt);
}
static void
@@ -5058,9 +4975,7 @@
mpt->outofbeer = 0;
mpt_lprt(mpt, MPT_PRT_DEBUG, "THAWQ\n");
}
- MPTLOCK_2_CAMLOCK(mpt);
xpt_done(ccb);
- CAMLOCK_2_MPTLOCK(mpt);
break;
}
/*
@@ -5144,9 +5059,7 @@
mpt->outofbeer = 0;
mpt_lprt(mpt, MPT_PRT_DEBUG, "THAWQ\n");
}
- MPTLOCK_2_CAMLOCK(mpt);
xpt_done(ccb);
- CAMLOCK_2_MPTLOCK(mpt);
}
break;
}
==== //depot/projects/mjexp/sys/dev/mpt/mpt_pci.c#10 (text+ko) ====
@@ -551,7 +551,6 @@
goto bad;
}
- MPT_LOCK_SETUP(mpt);
/* Disable interrupts at the part */
mpt_disable_ints(mpt);
@@ -591,12 +590,9 @@
/* Initialize the hardware */
if (mpt->disabled == 0) {
- MPT_LOCK(mpt);
if (mpt_attach(mpt) != 0) {
- MPT_UNLOCK(mpt);
goto bad;
}
- MPT_UNLOCK(mpt);
} else {
mpt_prt(mpt, "device disabled at user request\n");
goto bad;
@@ -607,12 +603,9 @@
if (mpt->eh == NULL) {
mpt_prt(mpt, "shutdown event registration failed\n");
- MPT_LOCK(mpt);
(void) mpt_detach(mpt);
- MPT_UNLOCK(mpt);
goto bad;
}
- KASSERT(MPT_OWNED(mpt) == 0, ("leaving attach with device locked"));
return (0);
bad:
@@ -620,7 +613,6 @@
mpt_free_bus_resources(mpt);
mpt_unlink_peer(mpt);
- MPT_LOCK_DESTROY(mpt);
/*
* but return zero to preserve unit numbering
@@ -660,7 +652,6 @@
mpt->pci_reg);
mpt->pci_reg = 0;
}
- MPT_LOCK_DESTROY(mpt);
}
@@ -675,7 +666,6 @@
mpt = (struct mpt_softc*)device_get_softc(dev);
if (mpt) {
- MPT_LOCK(mpt);
mpt_disable_ints(mpt);
mpt_detach(mpt);
mpt_reset(mpt, /*reinit*/FALSE);
@@ -685,7 +675,6 @@
if (mpt->eh != NULL) {
EVENTHANDLER_DEREGISTER(shutdown_final, mpt->eh);
}
- MPT_UNLOCK(mpt);
}
return(0);
}
@@ -702,9 +691,7 @@
mpt = (struct mpt_softc *)device_get_softc(dev);
if (mpt) {
int r;
- MPT_LOCK(mpt);
r = mpt_shutdown(mpt);
- MPT_UNLOCK(mpt);
return (r);
}
return(0);
@@ -963,9 +950,6 @@
mpt_pci_intr(void *arg)
{
struct mpt_softc *mpt;
-
mpt = (struct mpt_softc *)arg;
- MPT_LOCK(mpt);
mpt_intr(mpt);
- MPT_UNLOCK(mpt);
}
==== //depot/projects/mjexp/sys/dev/mpt/mpt_raid.c#4 (text+ko) ====
@@ -289,9 +289,7 @@
csa.event_enable = AC_FOUND_DEVICE;
csa.callback = mpt_raid_async;
csa.callback_arg = mpt;
- MPTLOCK_2_CAMLOCK(mpt);
xpt_action((union ccb *)&csa);
- CAMLOCK_2_MPTLOCK(mpt);
if (csa.ccb_h.status != CAM_REQ_CMP) {
mpt_prt(mpt, "mpt_raid_attach: Unable to register "
"CAM async handler.\n");
@@ -327,9 +325,7 @@
csa.event_enable = 0;
csa.callback = mpt_raid_async;
csa.callback_arg = mpt;
- MPTLOCK_2_CAMLOCK(mpt);
xpt_action((union ccb *)&csa);
- CAMLOCK_2_MPTLOCK(mpt);
}
static void
@@ -663,7 +659,6 @@
#endif
mpt = (struct mpt_softc *)arg;
firstrun = 1;
- MPT_LOCK(mpt);
while (mpt->shutdwn_raid == 0) {
if (mpt->raid_wakeup == 0) {
@@ -684,9 +679,7 @@
*/
if (firstrun) {
firstrun = 0;
- MPTLOCK_2_CAMLOCK(mpt);
xpt_release_simq(mpt->phydisk_sim, TRUE);
- CAMLOCK_2_MPTLOCK(mpt);
}
if (mpt->raid_rescan != 0) {
@@ -708,15 +701,12 @@
ccb->ccb_h.func_code = XPT_SCAN_BUS;
ccb->ccb_h.cbfcnp = mpt_cam_rescan_callback;
ccb->crcn.flags = CAM_FLAG_NONE;
- MPTLOCK_2_CAMLOCK(mpt);
xpt_action(ccb);
- CAMLOCK_2_MPTLOCK(mpt);
}
}
}
mpt->raid_thread = NULL;
wakeup(&mpt->raid_thread);
- MPT_UNLOCK(mpt);
#if __FreeBSD_version >= 500000
mtx_unlock(&Giant);
#endif
@@ -1560,9 +1550,7 @@
struct mpt_softc *mpt;
mpt = (struct mpt_softc *)arg;
- MPT_LOCK(mpt);
mpt_raid_wakeup(mpt);
- MPT_UNLOCK(mpt);
}
void
@@ -1615,7 +1603,6 @@
&& rate != MPT_RAID_RESYNC_RATE_NC)
return (EINVAL);
- MPT_LOCK(mpt);
mpt->raid_resync_rate = rate;
RAID_VOL_FOREACH(mpt, mpt_vol) {
if ((mpt_vol->flags & MPT_RVF_ACTIVE) == 0) {
@@ -1623,7 +1610,6 @@
}
mpt_verify_resync_rate(mpt, mpt_vol);
}
- MPT_UNLOCK(mpt);
return (0);
}
@@ -1635,7 +1621,6 @@
if (vol_queue_depth > 255 || vol_queue_depth < 1)
return (EINVAL);
- MPT_LOCK(mpt);
mpt->raid_queue_depth = vol_queue_depth;
RAID_VOL_FOREACH(mpt, mpt_vol) {
struct cam_path *path;
@@ -1646,21 +1631,17 @@
mpt->raid_rescan = 0;
- MPTLOCK_2_CAMLOCK(mpt);
error = xpt_create_path(&path, xpt_periph,
cam_sim_path(mpt->sim),
mpt_vol->config_page->VolumeID,
/*lun*/0);
if (error != CAM_REQ_CMP) {
- CAMLOCK_2_MPTLOCK(mpt);
mpt_vol_prt(mpt, mpt_vol, "Unable to allocate path!\n");
continue;
}
mpt_adjust_queue_depth(mpt, mpt_vol, path);
xpt_free_path(path);
- CAMLOCK_2_MPTLOCK(mpt);
}
- MPT_UNLOCK(mpt);
return (0);
}
@@ -1670,9 +1651,7 @@
struct mpt_raid_volume *mpt_vol;
int force_full_resync;
- MPT_LOCK(mpt);
if (mwce == mpt->raid_mwce_setting) {
- MPT_UNLOCK(mpt);
return (0);
}
@@ -1715,7 +1694,6 @@
mpt_verify_mwce(mpt, mpt_vol);
}
mpt->raid_mwce_set = 1;
- MPT_UNLOCK(mpt);
return (0);
}
More information about the p4-projects
mailing list