Index: cam_sim.h =================================================================== --- cam_sim.h (revision 227580) +++ cam_sim.h (working copy) @@ -104,7 +104,8 @@ u_int32_t flags; #define CAM_SIM_REL_TIMEOUT_PENDING 0x01 #define CAM_SIM_MPSAFE 0x02 -#define CAM_SIM_ON_DONEQ 0x04 +#define CAM_SIM_ON_DONEQ 0x04 +#define CAM_SIM_POLLED 0x08 struct callout callout; struct cam_devq *devq; /* Device Queue to use for this SIM */ int refcount; /* References to the SIM. */ Index: cam_xpt.c =================================================================== --- cam_xpt.c (revision 227580) +++ cam_xpt.c (working copy) @@ -2957,6 +2957,9 @@ mtx_assert(sim->mtx, MA_OWNED); + /* Don't use ISR for this SIM while polling. */ + sim->flags |= CAM_SIM_POLLED; + /* * Steal an opening so that no other queued requests * can get it before us while we simulate interrupts. @@ -2996,6 +2999,9 @@ } else { start_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; } + + /* Use CAM ISR for this SIM again. */ + sim->flags &= ~CAM_SIM_POLLED; } /* @@ -4224,7 +4230,7 @@ TAILQ_INSERT_TAIL(&sim->sim_doneq, &done_ccb->ccb_h, sim_links.tqe); done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX; - if ((sim->flags & CAM_SIM_ON_DONEQ) == 0) { + if ((sim->flags & (CAM_SIM_ON_DONEQ | CAM_SIM_POLLED)) == 0) { mtx_lock(&cam_simq_lock); first = TAILQ_EMPTY(&cam_simq); TAILQ_INSERT_TAIL(&cam_simq, sim, links);