mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-23 12:11:08 +01:00
Add two functions xpt_batch_start() and xpt_batch_done() to the CAM SIM KPI
to allow drivers to handle request completion directly without passing them to the CAM SWI thread removing extra context switch. Modify all ATA/SATA drivers to use them. Reviewed by: gibbs, ken MFC after: 2 weeks
This commit is contained in:
parent
7af1242a34
commit
711f661393
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=235333
@ -106,6 +106,7 @@ struct cam_sim {
|
|||||||
#define CAM_SIM_MPSAFE 0x02
|
#define CAM_SIM_MPSAFE 0x02
|
||||||
#define CAM_SIM_ON_DONEQ 0x04
|
#define CAM_SIM_ON_DONEQ 0x04
|
||||||
#define CAM_SIM_POLLED 0x08
|
#define CAM_SIM_POLLED 0x08
|
||||||
|
#define CAM_SIM_BATCH 0x10
|
||||||
struct callout callout;
|
struct callout callout;
|
||||||
struct cam_devq *devq; /* Device Queue to use for this SIM */
|
struct cam_devq *devq; /* Device Queue to use for this SIM */
|
||||||
int refcount; /* References to the SIM. */
|
int refcount; /* References to the SIM. */
|
||||||
|
@ -4332,7 +4332,8 @@ xpt_done(union ccb *done_ccb)
|
|||||||
TAILQ_INSERT_TAIL(&sim->sim_doneq, &done_ccb->ccb_h,
|
TAILQ_INSERT_TAIL(&sim->sim_doneq, &done_ccb->ccb_h,
|
||||||
sim_links.tqe);
|
sim_links.tqe);
|
||||||
done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX;
|
done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX;
|
||||||
if ((sim->flags & (CAM_SIM_ON_DONEQ | CAM_SIM_POLLED)) == 0) {
|
if ((sim->flags & (CAM_SIM_ON_DONEQ | CAM_SIM_POLLED |
|
||||||
|
CAM_SIM_BATCH)) == 0) {
|
||||||
mtx_lock(&cam_simq_lock);
|
mtx_lock(&cam_simq_lock);
|
||||||
first = TAILQ_EMPTY(&cam_simq);
|
first = TAILQ_EMPTY(&cam_simq);
|
||||||
TAILQ_INSERT_TAIL(&cam_simq, sim, links);
|
TAILQ_INSERT_TAIL(&cam_simq, sim, links);
|
||||||
@ -4344,6 +4345,25 @@ xpt_done(union ccb *done_ccb)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
xpt_batch_start(struct cam_sim *sim)
|
||||||
|
{
|
||||||
|
|
||||||
|
KASSERT((sim->flags & CAM_SIM_BATCH) == 0, ("Batch flag already set"));
|
||||||
|
sim->flags |= CAM_SIM_BATCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
xpt_batch_done(struct cam_sim *sim)
|
||||||
|
{
|
||||||
|
|
||||||
|
KASSERT((sim->flags & CAM_SIM_BATCH) != 0, ("Batch flag was not set"));
|
||||||
|
sim->flags &= ~CAM_SIM_BATCH;
|
||||||
|
if (!TAILQ_EMPTY(&sim->sim_doneq) &&
|
||||||
|
(sim->flags & CAM_SIM_ON_DONEQ) == 0)
|
||||||
|
camisr_runqueue(&sim->sim_doneq);
|
||||||
|
}
|
||||||
|
|
||||||
union ccb *
|
union ccb *
|
||||||
xpt_alloc_ccb()
|
xpt_alloc_ccb()
|
||||||
{
|
{
|
||||||
|
@ -51,6 +51,8 @@ void xpt_release_devq_rl(struct cam_path *path, cam_rl rl,
|
|||||||
u_int count, int run_queue);
|
u_int count, int run_queue);
|
||||||
int xpt_sim_opened(struct cam_sim *sim);
|
int xpt_sim_opened(struct cam_sim *sim);
|
||||||
void xpt_done(union ccb *done_ccb);
|
void xpt_done(union ccb *done_ccb);
|
||||||
|
void xpt_batch_start(struct cam_sim *sim);
|
||||||
|
void xpt_batch_done(struct cam_sim *sim);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _CAM_CAM_XPT_SIM_H */
|
#endif /* _CAM_CAM_XPT_SIM_H */
|
||||||
|
@ -1457,7 +1457,9 @@ ahci_ch_intr_locked(void *data)
|
|||||||
struct ahci_channel *ch = device_get_softc(dev);
|
struct ahci_channel *ch = device_get_softc(dev);
|
||||||
|
|
||||||
mtx_lock(&ch->mtx);
|
mtx_lock(&ch->mtx);
|
||||||
|
xpt_batch_start(ch->sim);
|
||||||
ahci_ch_intr(data);
|
ahci_ch_intr(data);
|
||||||
|
xpt_batch_done(ch->sim);
|
||||||
mtx_unlock(&ch->mtx);
|
mtx_unlock(&ch->mtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,9 +544,11 @@ ata_interrupt(void *data)
|
|||||||
struct ata_channel *ch = (struct ata_channel *)data;
|
struct ata_channel *ch = (struct ata_channel *)data;
|
||||||
|
|
||||||
mtx_lock(&ch->state_mtx);
|
mtx_lock(&ch->state_mtx);
|
||||||
|
xpt_batch_start(ch->sim);
|
||||||
#endif
|
#endif
|
||||||
ata_interrupt_locked(data);
|
ata_interrupt_locked(data);
|
||||||
#ifdef ATA_CAM
|
#ifdef ATA_CAM
|
||||||
|
xpt_batch_done(ch->sim);
|
||||||
mtx_unlock(&ch->state_mtx);
|
mtx_unlock(&ch->state_mtx);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -654,7 +654,9 @@ mvs_ch_intr_locked(void *data)
|
|||||||
struct mvs_channel *ch = device_get_softc(dev);
|
struct mvs_channel *ch = device_get_softc(dev);
|
||||||
|
|
||||||
mtx_lock(&ch->mtx);
|
mtx_lock(&ch->mtx);
|
||||||
|
xpt_batch_start(ch->sim);
|
||||||
mvs_ch_intr(data);
|
mvs_ch_intr(data);
|
||||||
|
xpt_batch_done(ch->sim);
|
||||||
mtx_unlock(&ch->mtx);
|
mtx_unlock(&ch->mtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -830,7 +830,9 @@ siis_ch_intr_locked(void *data)
|
|||||||
struct siis_channel *ch = device_get_softc(dev);
|
struct siis_channel *ch = device_get_softc(dev);
|
||||||
|
|
||||||
mtx_lock(&ch->mtx);
|
mtx_lock(&ch->mtx);
|
||||||
|
xpt_batch_start(ch->sim);
|
||||||
siis_ch_intr(data);
|
siis_ch_intr(data);
|
||||||
|
xpt_batch_done(ch->sim);
|
||||||
mtx_unlock(&ch->mtx);
|
mtx_unlock(&ch->mtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user