From owner-p4-projects@FreeBSD.ORG Fri Apr 20 22:21:15 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 197D016A404; Fri, 20 Apr 2007 22:21:15 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C231F16A402 for ; Fri, 20 Apr 2007 22:21:14 +0000 (UTC) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id B10C413C46E for ; Fri, 20 Apr 2007 22:21:14 +0000 (UTC) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l3KMLEfP045693 for ; Fri, 20 Apr 2007 22:21:14 GMT (envelope-from scottl@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l3KMLEl9045688 for perforce@freebsd.org; Fri, 20 Apr 2007 22:21:14 GMT (envelope-from scottl@freebsd.org) Date: Fri, 20 Apr 2007 22:21:14 GMT Message-Id: <200704202221.l3KMLEl9045688@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to scottl@freebsd.org using -f From: Scott Long To: Perforce Change Reviews Cc: Subject: PERFORCE change 118499 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Apr 2007 22:21:15 -0000 http://perforce.freebsd.org/chv.cgi?CH=118499 Change 118499 by scottl@scottl-x64 on 2007/04/20 22:20:44 IFC Affected files ... .. //depot/projects/scottl-camlock/src/sys/cam/cam_periph.c#22 integrate .. //depot/projects/scottl-camlock/src/sys/cam/cam_periph.h#14 integrate .. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#60 integrate .. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_da.c#34 integrate .. //depot/projects/scottl-camlock/src/sys/dev/cxgb/cxgb_sge.c#4 integrate .. //depot/projects/scottl-camlock/src/sys/dev/cxgb/sys/uipc_mvec.c#4 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/envy24.c#6 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/envy24ht.c#4 integrate .. //depot/projects/scottl-camlock/src/sys/fs/devfs/devfs_vnops.c#13 integrate .. //depot/projects/scottl-camlock/src/sys/kern/sched_ule.c#15 integrate .. //depot/projects/scottl-camlock/src/sys/kern/uipc_syscalls.c#19 integrate .. //depot/projects/scottl-camlock/src/sys/netgraph/ng_ppp.c#8 integrate .. //depot/projects/scottl-camlock/src/sys/netinet/tcp.h#8 integrate .. //depot/projects/scottl-camlock/src/sys/netinet/tcp_input.c#19 integrate .. //depot/projects/scottl-camlock/src/sys/netinet/tcp_output.c#13 integrate .. //depot/projects/scottl-camlock/src/sys/netinet/tcp_syncache.c#18 integrate .. //depot/projects/scottl-camlock/src/sys/netinet/tcp_var.h#16 integrate .. //depot/projects/scottl-camlock/src/sys/powerpc/powerpc/nexus.c#5 integrate Differences ... ==== //depot/projects/scottl-camlock/src/sys/cam/cam_periph.c#22 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/cam/cam_periph.c,v 1.66 2007/04/16 19:42:23 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/cam/cam_periph.c,v 1.68 2007/04/19 23:34:51 scottl Exp $"); #include #include @@ -131,7 +131,6 @@ lun_id_t lun_id; cam_status status; u_int init_level; - int s; init_level = 0; /* @@ -200,7 +199,6 @@ if (status != CAM_REQ_CMP) goto failure; - s = splsoftcam(); cur_periph = TAILQ_FIRST(&(*p_drv)->units); while (cur_periph != NULL && cur_periph->unit_number < periph->unit_number) @@ -213,8 +211,6 @@ (*p_drv)->generation++; } - splx(s); - init_level++; status = periph_ctor(periph, arg); @@ -228,9 +224,7 @@ /* Initialized successfully */ break; case 3: - s = splsoftcam(); TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links); - splx(s); xpt_remove_periph(periph); /* FALLTHROUGH */ case 2: @@ -258,24 +252,25 @@ { struct periph_driver **p_drv; struct cam_periph *periph; - int s; + xpt_lock_buses(); for (p_drv = periph_drivers; *p_drv != NULL; p_drv++) { if (name != NULL && (strcmp((*p_drv)->driver_name, name) != 0)) continue; - s = splsoftcam(); TAILQ_FOREACH(periph, &(*p_drv)->units, unit_links) { if (xpt_path_comp(periph->path, path) == 0) { - splx(s); + xpt_unlock_buses(); return(periph); } } - splx(s); - if (name != NULL) + if (name != NULL) { + xpt_unlock_buses(); return(NULL); + } } + xpt_unlock_buses(); return(NULL); } @@ -372,11 +367,9 @@ { struct cam_periph *periph; char *periph_name; - int s; int i, val, dunit, r; const char *dname, *strval; - s = splsoftcam(); periph_name = p_drv->driver_name; for (;;newunit++) { @@ -422,7 +415,6 @@ if (r != 0) break; } - splx(s); return (newunit); } @@ -480,8 +472,7 @@ /* * We only call this routine the first time a peripheral is - * invalidated. The oninvalidate() routine is always called at - * splsoftcam(). + * invalidated. */ if (((periph->flags & CAM_PERIPH_INVALID) == 0) && (periph->periph_oninval != NULL)) @@ -550,26 +541,6 @@ } /* - * Wait interruptibly for an exclusive lock. - */ -void -cam_periph_lock(struct cam_periph *periph) -{ - - mtx_lock(periph->sim->mtx); -} - -/* - * Unlock and wake up any waiters. - */ -void -cam_periph_unlock(struct cam_periph *periph) -{ - - mtx_unlock(periph->sim->mtx); -} - -/* * Map user virtual pointers into kernel virtual address space, so we can * access the memory. This won't work on physical pointers, for now it's * up to the caller to check for that. (XXX KDM -- should we do that here @@ -808,9 +779,7 @@ { struct mtx *mtx; struct cam_sim *sim; - int s; - s = splsoftcam(); sim = xpt_path_sim(ccb->ccb_h.path); if (sim->mtx == &Giant) mtx = NULL; @@ -819,8 +788,6 @@ if ((ccb->ccb_h.pinfo.index != CAM_UNQUEUED_INDEX) || ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INPROG)) msleep(&ccb->ccb_h.cbfcnp, mtx, PRIBIO, "cbwait", 0); - - splx(s); } int @@ -1225,11 +1192,8 @@ { struct timeval delta; struct timeval duration_tv; - int s; - s = splclock(); microtime(&delta); - splx(s); timevalsub(&delta, event_time); duration_tv.tv_sec = duration_ms / 1000; duration_tv.tv_usec = (duration_ms % 1000) * 1000; ==== //depot/projects/scottl-camlock/src/sys/cam/cam_periph.h#14 (text+ko) ==== @@ -25,13 +25,14 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/cam/cam_periph.h,v 1.17 2007/04/15 08:49:09 scottl Exp $ + * $FreeBSD: src/sys/cam/cam_periph.h,v 1.18 2007/04/19 22:46:26 scottl Exp $ */ #ifndef _CAM_CAM_PERIPH_H #define _CAM_CAM_PERIPH_H 1 #include +#include #ifdef _KERNEL @@ -138,8 +139,6 @@ char *name, cam_periph_type type, struct cam_path *, ac_callback_t *, ac_code, void *arg); struct cam_periph *cam_periph_find(struct cam_path *path, char *name); -void cam_periph_lock(struct cam_periph *periph); -void cam_periph_unlock(struct cam_periph *periph); cam_status cam_periph_acquire(struct cam_periph *periph); void cam_periph_release(struct cam_periph *periph); int cam_periph_hold(struct cam_periph *periph, int priority); @@ -177,5 +176,17 @@ int cam_periph_error(union ccb *ccb, cam_flags camflags, u_int32_t sense_flags, union ccb *save_ccb); +static __inline void +cam_periph_lock(struct cam_periph *periph) +{ + mtx_lock(periph->sim->mtx); +} + +static __inline void +cam_periph_unlock(struct cam_periph *periph) +{ + mtx_unlock(periph->sim->mtx); +} + #endif /* _KERNEL */ #endif /* _CAM_CAM_PERIPH_H */ ==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#60 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/cam/cam_xpt.c,v 1.180 2007/04/19 14:45:37 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/cam/cam_xpt.c,v 1.182 2007/04/19 23:34:51 scottl Exp $"); #include #include @@ -1210,7 +1210,7 @@ * we never return a status of CAM_GDEVLIST_LIST_CHANGED. It is * (or rather should be) impossible for the device peripheral driver * list to change since we look at the whole thing in one pass, and - * we do it with splcam protection. + * we do it with lock protection. * */ case CAMGETPASSTHRU: { @@ -1222,13 +1222,12 @@ u_int cur_generation; int base_periph_found; int splbreaknum; - int s; ccb = (union ccb *)addr; unit = ccb->cgdl.unit_number; name = ccb->cgdl.periph_name; /* - * Every 100 devices, we want to drop our spl protection to + * Every 100 devices, we want to drop our lock protection to * give the software interrupt handler a chance to run. * Most systems won't run into this check, but this should * avoid starvation in the software interrupt handler in @@ -1250,7 +1249,7 @@ } /* Keep the list from changing while we traverse it */ - s = splcam(); + mtx_lock(&xsoftc.xpt_topo_lock); ptstartover: cur_generation = xsoftc.xpt_generation; @@ -1260,7 +1259,7 @@ break; if (*p_drv == NULL) { - splx(s); + mtx_unlock(&xsoftc.xpt_topo_lock); ccb->ccb_h.status = CAM_REQ_CMP_ERR; ccb->cgdl.status = CAM_GDEVLIST_ERROR; *ccb->cgdl.periph_name = '\0'; @@ -1282,8 +1281,8 @@ if (periph->unit_number == unit) { break; } else if (--splbreaknum == 0) { - splx(s); - s = splcam(); + mtx_unlock(&xsoftc.xpt_topo_lock); + mtx_lock(&xsoftc.xpt_topo_lock); splbreaknum = 100; if (cur_generation != xsoftc.xpt_generation) goto ptstartover; @@ -1372,7 +1371,7 @@ "your kernel config file\n"); } } - splx(s); + mtx_unlock(&xsoftc.xpt_topo_lock); break; } default: @@ -1428,7 +1427,7 @@ TAILQ_REMOVE(&queue, &ccb->ccb_h, sim_links.tqe); sim = ccb->ccb_h.path->bus->sim; - mtx_lock(sim->mtx); + CAM_SIM_LOCK(sim); ccb->ccb_h.func_code = XPT_SCAN_BUS; ccb->ccb_h.cbfcnp = xptdone; @@ -1436,7 +1435,7 @@ cam_periph_runccb(ccb, NULL, 0, 0, NULL); xpt_free_path(ccb->ccb_h.path); xpt_free_ccb(ccb); - mtx_unlock(sim->mtx); + CAM_SIM_UNLOCK(sim); } } } @@ -1592,25 +1591,22 @@ status = CAM_REQ_CMP; if (device != NULL) { - int s; - /* * Make room for this peripheral * so it will fit in the queue * when it's scheduled to run */ - s = splsoftcam(); status = camq_resize(&device->drvq, device->drvq.array_size + 1); device->generation++; SLIST_INSERT_HEAD(periph_head, periph, periph_links); - - splx(s); } - atomic_add_int(&xsoftc.xpt_generation, 1); + mtx_lock(&xsoftc.xpt_topo_lock); + xsoftc.xpt_generation++; + mtx_unlock(&xsoftc.xpt_topo_lock); return (status); } @@ -1625,24 +1621,21 @@ device = periph->path->device; if (device != NULL) { - int s; struct periph_list *periph_head; periph_head = &device->periphs; /* Release the slot for this peripheral */ - s = splsoftcam(); camq_resize(&device->drvq, device->drvq.array_size - 1); device->generation++; SLIST_REMOVE(periph_head, periph, cam_periph, periph_links); - - splx(s); } - atomic_add_int(&xsoftc.xpt_generation, 1); - + mtx_lock(&xsoftc.xpt_topo_lock); + xsoftc.xpt_generation++; + mtx_unlock(&xsoftc.xpt_topo_lock); } @@ -1655,7 +1648,6 @@ u_int speed; u_int freq; u_int mb; - int s; mtx_assert(periph->sim->mtx, MA_OWNED); @@ -1664,7 +1656,6 @@ * To ensure that this is printed in one piece, * mask out CAM interrupts. */ - s = splsoftcam(); printf("%s%d at %s%d bus %d target %d lun %d\n", periph->periph_name, periph->unit_number, path->bus->sim->sim_name, @@ -1780,7 +1771,6 @@ if (announce_string != NULL) printf("%s%d: %s\n", periph->periph_name, periph->unit_number, announce_string); - splx(s); } static dev_match_ret @@ -2661,9 +2651,9 @@ next_bus = TAILQ_NEXT(bus, links); mtx_unlock(&xsoftc.xpt_topo_lock); - mtx_lock(bus->sim->mtx); + CAM_SIM_LOCK(bus->sim); retval = tr_func(bus, arg); - mtx_unlock(bus->sim->mtx); + CAM_SIM_UNLOCK(bus->sim); if (retval == 0) return(retval); mtx_lock(&xsoftc.xpt_topo_lock); @@ -2984,13 +2974,11 @@ void xpt_action(union ccb *start_ccb) { - int iopl; CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("xpt_action\n")); start_ccb->ccb_h.status = CAM_REQ_INPROG; - iopl = splsoftcam(); switch (start_ccb->ccb_h.func_code) { case XPT_SCSI_IO: { @@ -3044,18 +3032,15 @@ { struct cam_path *path; struct cam_sim *sim; - int s; int runq; path = start_ccb->ccb_h.path; - s = splsoftcam(); sim = path->bus->sim; if (SIM_DEAD(sim)) { /* The SIM has gone; just execute the CCB directly. */ cam_ccbq_send_ccb(&path->device->ccbq, start_ccb); (*(sim->sim_action))(sim, start_ccb); - splx(s); break; } @@ -3064,7 +3049,6 @@ runq = xpt_schedule_dev_sendq(path->bus, path->device); else runq = 0; - splx(s); if (runq != 0) xpt_run_dev_sendq(path->bus); break; @@ -3111,7 +3095,6 @@ case XPT_ABORT: { union ccb* abort_ccb; - int s; abort_ccb = start_ccb->cab.abort_ccb; if (XPT_FC_IS_DEV_QUEUED(abort_ccb)) { @@ -3124,9 +3107,7 @@ abort_ccb->ccb_h.status = CAM_REQ_ABORTED|CAM_DEV_QFRZN; xpt_freeze_devq(abort_ccb->ccb_h.path, 1); - s = splcam(); xpt_done(abort_ccb); - splx(s); start_ccb->ccb_h.status = CAM_REQ_CMP; break; } @@ -3189,10 +3170,8 @@ case XPT_GDEV_TYPE: { struct cam_ed *dev; - int s; dev = start_ccb->ccb_h.path->device; - s = splcam(); if ((dev->flags & CAM_DEV_UNCONFIGURED) != 0) { start_ccb->ccb_h.status = CAM_DEV_NOT_THERE; } else { @@ -3211,16 +3190,13 @@ bcopy(dev->serial_num, cgd->serial_num, dev->serial_num_len); } - splx(s); break; } case XPT_GDEV_STATS: { struct cam_ed *dev; - int s; dev = start_ccb->ccb_h.path->device; - s = splcam(); if ((dev->flags & CAM_DEV_UNCONFIGURED) != 0) { start_ccb->ccb_h.status = CAM_DEV_NOT_THERE; } else { @@ -3243,7 +3219,6 @@ cgds->last_reset = bus->last_reset; cgds->ccb_h.status = CAM_REQ_CMP; } - splx(s); break; } case XPT_GDEVLIST: @@ -3252,7 +3227,6 @@ struct periph_list *periph_head; struct ccb_getdevlist *cgdl; u_int i; - int s; struct cam_ed *device; int found; @@ -3262,7 +3236,6 @@ /* * Don't want anyone mucking with our data. */ - s = splcam(); device = start_ccb->ccb_h.path->device; periph_head = &device->periphs; cgdl = &start_ccb->cgdl; @@ -3276,7 +3249,6 @@ if ((cgdl->index != 0) && (cgdl->generation != device->generation)) { cgdl->status = CAM_GDEVLIST_LIST_CHANGED; - splx(s); break; } @@ -3297,7 +3269,6 @@ } if (found == 0) { cgdl->status = CAM_GDEVLIST_ERROR; - splx(s); break; } @@ -3309,23 +3280,17 @@ cgdl->index++; cgdl->generation = device->generation; - splx(s); cgdl->ccb_h.status = CAM_REQ_CMP; break; } case XPT_DEV_MATCH: { - int s; dev_pos_type position_type; struct ccb_dev_match *cdm; cdm = &start_ccb->cdm; /* - * Prevent EDT changes while we traverse it. - */ - s = splcam(); - /* * There are two ways of getting at information in the EDT. * The first way is via the primary EDT tree. It starts * with a list of busses, then a list of targets on a bus, @@ -3372,8 +3337,6 @@ break; } - splx(s); - if (cdm->status == CAM_DEV_MATCH_ERROR) start_ccb->ccb_h.status = CAM_REQ_CMP_ERR; else @@ -3459,7 +3422,6 @@ { struct ccb_relsim *crs; struct cam_ed *dev; - int s; crs = &start_ccb->crs; dev = crs->ccb_h.path->device; @@ -3469,8 +3431,6 @@ break; } - s = splcam(); - if ((crs->release_flags & RELSIM_ADJUST_OPENINGS) != 0) { if (INQ_DATA_TQ_ENABLED(&dev->inq_data)) { @@ -3540,8 +3500,7 @@ start_ccb->ccb_h.flags |= CAM_DEV_QFREEZE; } } - splx(s); - + if ((start_ccb->ccb_h.flags & CAM_DEV_QFREEZE) == 0) { xpt_release_devq(crs->ccb_h.path, /*count*/1, @@ -3561,9 +3520,6 @@ break; case XPT_DEBUG: { #ifdef CAMDEBUG - int s; - - s = splcam(); #ifdef CAM_DEBUG_DELAY cam_debug_delay = CAM_DEBUG_DELAY; #endif @@ -3590,7 +3546,6 @@ cam_dpath = NULL; start_ccb->ccb_h.status = CAM_REQ_CMP; } - splx(s); #else /* !CAMDEBUG */ start_ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; #endif /* CAMDEBUG */ @@ -3609,13 +3564,11 @@ start_ccb->ccb_h.status = CAM_PROVIDE_FAIL; break; } - splx(iopl); } void xpt_polled_action(union ccb *start_ccb) { - int s; u_int32_t timeout; struct cam_sim *sim; struct cam_devq *devq; @@ -3628,7 +3581,6 @@ dev = start_ccb->ccb_h.path->device; mtx_assert(sim->mtx, MA_OWNED); - s = splcam(); /* * Steal an opening so that no other queued requests @@ -3669,7 +3621,6 @@ } else { start_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; } - splx(s); } /* @@ -3681,14 +3632,12 @@ { struct cam_ed *device; union ccb *work_ccb; - int s; int runq; mtx_assert(perph->sim->mtx, MA_OWNED); CAM_DEBUG(perph->path, CAM_DEBUG_TRACE, ("xpt_schedule\n")); device = perph->path->device; - s = splsoftcam(); if (periph_is_queued(perph)) { /* Simply reorder based on new priority */ CAM_DEBUG(perph->path, CAM_DEBUG_SUBTRACE, @@ -3702,7 +3651,6 @@ } else if (SIM_DEAD(perph->path->bus->sim)) { /* The SIM is gone so just call periph_start directly. */ work_ccb = xpt_get_ccb(perph->path->device); - splx(s); if (work_ccb == NULL) return; /* XXX */ xpt_setup_ccb(&work_ccb->ccb_h, perph->path, new_priority); @@ -3718,7 +3666,6 @@ camq_insert(&device->drvq, &perph->pinfo); runq = xpt_schedule_dev_allocq(perph->path->bus, device); } - splx(s); if (runq != 0) { CAM_DEBUG(perph->path, CAM_DEBUG_SUBTRACE, (" calling xpt_run_devq\n")); @@ -3733,8 +3680,7 @@ * return 1 meaning the device queue should be run. If we * were already queued, implying someone else has already * started the queue, return 0 so the caller doesn't attempt - * to run the queue. Must be run at either splsoftcam - * (or splcam since that encompases splsoftcam). + * to run the queue. */ static int xpt_schedule_dev(struct camq *queue, cam_pinfo *pinfo, @@ -3778,7 +3724,6 @@ xpt_run_dev_allocq(struct cam_eb *bus) { struct cam_devq *devq; - int s; CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("xpt_run_dev_allocq\n")); devq = bus->sim->devq; @@ -3791,7 +3736,6 @@ devq->alloc_openings, devq->alloc_active)); - s = splsoftcam(); devq->alloc_queue.qfrozen_cnt++; while ((devq->alloc_queue.entries > 0) && (devq->alloc_openings > 0) @@ -3821,7 +3765,6 @@ devq->alloc_openings--; devq->alloc_active++; drv = (struct cam_periph*)camq_remove(drvq, CAMQ_HEAD); - splx(s); xpt_setup_ccb(&work_ccb->ccb_h, drv->path, drv->pinfo.priority); CAM_DEBUG_PRINT(CAM_DEBUG_XPT, @@ -3840,43 +3783,32 @@ break; } - /* Raise IPL for possible insertion and test at top of loop */ - s = splsoftcam(); - if (drvq->entries > 0) { /* We have more work. Attempt to reschedule */ xpt_schedule_dev_allocq(bus, device); } } devq->alloc_queue.qfrozen_cnt--; - splx(s); } static void xpt_run_dev_sendq(struct cam_eb *bus) { struct cam_devq *devq; - int s; CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("xpt_run_dev_sendq\n")); devq = bus->sim->devq; - s = splcam(); devq->send_queue.qfrozen_cnt++; - splx(s); - s = splsoftcam(); while ((devq->send_queue.entries > 0) && (devq->send_openings > 0)) { struct cam_ed_qinfo *qinfo; struct cam_ed *device; union ccb *work_ccb; struct cam_sim *sim; - int ospl; - ospl = splcam(); if (devq->send_queue.qfrozen_cnt > 1) { - splx(ospl); break; } @@ -3889,7 +3821,6 @@ * to run it. */ if (device->qfrozen_cnt > 0) { - splx(ospl); continue; } @@ -3899,7 +3830,6 @@ work_ccb = cam_ccbq_peek_ccb(&device->ccbq, CAMQ_HEAD); if (work_ccb == NULL) { printf("device on run queue with no ccbs???\n"); - splx(ospl); continue; } @@ -3918,7 +3848,6 @@ &work_ccb->ccb_h, xpt_links.stqe); - splx(ospl); continue; } else { /* @@ -3933,7 +3862,6 @@ cam_ccbq_remove_ccb(&device->ccbq, work_ccb); cam_ccbq_send_ccb(&device->ccbq, work_ccb); - splx(ospl); devq->send_openings--; devq->send_active++; @@ -3946,12 +3874,8 @@ * The client wants to freeze the queue * after this CCB is sent. */ - ospl = splcam(); device->qfrozen_cnt++; - splx(ospl); } - - splx(s); /* In Target mode, the peripheral driver knows best... */ if (work_ccb->ccb_h.func_code == XPT_SCSI_IO) { @@ -3975,16 +3899,9 @@ sim = work_ccb->ccb_h.path->bus->sim; (*(sim->sim_action))(sim, work_ccb); - ospl = splcam(); devq->active_dev = NULL; - splx(ospl); - /* Raise IPL for possible insertion and test at top of loop */ - s = splsoftcam(); } - splx(s); - s = splcam(); devq->send_queue.qfrozen_cnt--; - splx(s); } /* @@ -4068,12 +3985,12 @@ bus = xpt_find_bus(path_id); if (bus != NULL) { need_unlock = 1; - mtx_lock(bus->sim->mtx); + CAM_SIM_LOCK(bus->sim); } } status = xpt_compile_path(path, periph, path_id, target_id, lun_id); if (need_unlock) - mtx_unlock(bus->sim->mtx); + CAM_SIM_UNLOCK(bus->sim); if (status != CAM_REQ_CMP) { free(path, M_CAMXPT); path = NULL; @@ -4090,7 +4007,6 @@ struct cam_et *target; struct cam_ed *device; cam_status status; - int s; status = CAM_REQ_CMP; /* Completed without error */ target = NULL; /* Wildcarded */ @@ -4100,7 +4016,6 @@ * We will potentially modify the EDT, so block interrupts * that may attempt to create cam paths. */ - s = splcam(); bus = xpt_find_bus(path_id); if (bus == NULL) { status = CAM_PATH_INVALID; @@ -4134,7 +4049,6 @@ } } } - splx(s); /* * Only touch the user's data if we are successful. @@ -4359,7 +4273,6 @@ void xpt_release_ccb(union ccb *free_ccb) { - int s; struct cam_path *path; struct cam_ed *device; struct cam_eb *bus; @@ -4370,7 +4283,6 @@ device = path->device; bus = path->bus; sim = bus->sim; - s = splsoftcam(); mtx_assert(sim->mtx, MA_OWNED); @@ -4383,7 +4295,6 @@ xpt_links.sle); } if (sim->devq == NULL) { - splx(s); return; } sim->devq->alloc_openings++; @@ -4393,7 +4304,6 @@ && (device->drvq.entries > 0)) { xpt_schedule_dev_allocq(bus, device); } - splx(s); if (dev_allocq_is_runnable(sim->devq)) xpt_run_dev_allocq(bus); } @@ -4415,7 +4325,6 @@ struct cam_eb *new_bus; struct cam_eb *old_bus; struct ccb_pathinq cpi; - int s; mtx_assert(sim->mtx, MA_OWNED); @@ -4440,7 +4349,6 @@ new_bus->flags = 0; new_bus->refcount = 1; /* Held until a bus_deregister event */ new_bus->generation = 0; - s = splcam(); mtx_lock(&xsoftc.xpt_topo_lock); old_bus = TAILQ_FIRST(&xsoftc.xpt_busses); while (old_bus != NULL @@ -4452,7 +4360,6 @@ TAILQ_INSERT_TAIL(&xsoftc.xpt_busses, new_bus, links); xsoftc.bus_generation++; mtx_unlock(&xsoftc.xpt_topo_lock); - splx(s); /* Notify interested parties */ if (sim->path_id != CAM_XPT_PATH_ID) { @@ -4614,7 +4521,6 @@ struct cam_eb *bus; struct cam_et *target, *next_target; struct cam_ed *device, *next_device; - int s; mtx_assert(path->bus->sim->mtx, MA_OWNED); @@ -4624,20 +4530,14 @@ * Most async events come from a CAM interrupt context. In * a few cases, the error recovery code at the peripheral layer, * which may run from our SWI or a process context, may signal - * deferred events with a call to xpt_async. Ensure async - * notifications are serialized by blocking cam interrupts. + * deferred events with a call to xpt_async. */ - s = splcam(); bus = path->bus; if (async_code == AC_BUS_RESET) { - int s; - - s = splclock(); /* Update our notion of when the last reset occurred */ microtime(&bus->last_reset); - splx(s); } for (target = TAILQ_FIRST(&bus->et_entries); @@ -4652,12 +4552,8 @@ continue; if (async_code == AC_SENT_BDR) { - int s; - /* Update our notion of when the last reset occurred */ - s = splclock(); microtime(&path->target->last_reset); - splx(s); } for (device = TAILQ_FIRST(&target->ed_entries); @@ -4686,7 +4582,6 @@ if (bus != xpt_periph->path->bus) xpt_async_bcast(&xpt_periph->path->device->asyncs, async_code, path, async_arg); - splx(s); } static void @@ -4780,12 +4675,10 @@ u_int32_t xpt_freeze_devq(struct cam_path *path, u_int count) { - int s; struct ccb_hdr *ccbh; mtx_assert(path->bus->sim->mtx, MA_OWNED); - s = splcam(); path->device->qfrozen_cnt += count; /* @@ -4797,14 +4690,13 @@ * freezes the queue. To completly close the * hole, controller drives must check to see * if a ccb's status is still CAM_REQ_INPROG - * under spl protection just before they queue + * just before they queue * the CCB. See ahc_action/ahc_freeze_devq for * an example. */ ccbh = TAILQ_LAST(&path->device->ccbq.active_ccbs, ccb_hdr_tailq); if (ccbh && ccbh->status == CAM_REQ_INPROG) ccbh->status = CAM_REQUEUE_REQ; >>> TRUNCATED FOR MAIL (1000 lines) <<<