1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-05 09:14:03 +00:00

Fix panic, when due to some kind of congestion on FIS-based switching

port multiplier some command triggers false positive timeout, but then
completes normally.

MFC after:	2 weeks
This commit is contained in:
Alexander Motin 2010-09-16 12:39:50 +00:00
parent 2c9879e8d3
commit bf12976c76
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=212732
3 changed files with 24 additions and 15 deletions

View File

@ -1854,6 +1854,7 @@ ahci_end_transaction(struct ahci_slot *slot, enum ahci_err_type et)
device_t dev = slot->dev; device_t dev = slot->dev;
struct ahci_channel *ch = device_get_softc(dev); struct ahci_channel *ch = device_get_softc(dev);
union ccb *ccb = slot->ccb; union ccb *ccb = slot->ccb;
int lastto;
bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map, bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map,
BUS_DMASYNC_POSTWRITE); BUS_DMASYNC_POSTWRITE);
@ -1955,11 +1956,6 @@ ahci_end_transaction(struct ahci_slot *slot, enum ahci_err_type et)
ch->oslots &= ~(1 << slot->slot); ch->oslots &= ~(1 << slot->slot);
ch->rslots &= ~(1 << slot->slot); ch->rslots &= ~(1 << slot->slot);
ch->aslots &= ~(1 << slot->slot); ch->aslots &= ~(1 << slot->slot);
if (et != AHCI_ERR_TIMEOUT) {
if (ch->toslots == (1 << slot->slot))
xpt_release_simq(ch->sim, TRUE);
ch->toslots &= ~(1 << slot->slot);
}
slot->state = AHCI_SLOT_EMPTY; slot->state = AHCI_SLOT_EMPTY;
slot->ccb = NULL; slot->ccb = NULL;
/* Update channel stats. */ /* Update channel stats. */
@ -1970,6 +1966,13 @@ ahci_end_transaction(struct ahci_slot *slot, enum ahci_err_type et)
ch->numtslots--; ch->numtslots--;
ch->numtslotspd[ccb->ccb_h.target_id]--; ch->numtslotspd[ccb->ccb_h.target_id]--;
} }
/* Cancel timeout state if request completed normally. */
if (et != AHCI_ERR_TIMEOUT) {
lastto = (ch->toslots == (1 << slot->slot));
ch->toslots &= ~(1 << slot->slot);
if (lastto)
xpt_release_simq(ch->sim, TRUE);
}
/* If it was first request of reset sequence and there is no error, /* If it was first request of reset sequence and there is no error,
* proceed to second request. */ * proceed to second request. */
if ((ccb->ccb_h.func_code == XPT_ATA_IO) && if ((ccb->ccb_h.func_code == XPT_ATA_IO) &&

View File

@ -1552,6 +1552,7 @@ mvs_end_transaction(struct mvs_slot *slot, enum mvs_err_type et)
device_t dev = slot->dev; device_t dev = slot->dev;
struct mvs_channel *ch = device_get_softc(dev); struct mvs_channel *ch = device_get_softc(dev);
union ccb *ccb = slot->ccb; union ccb *ccb = slot->ccb;
int lastto;
//device_printf(dev, "cmd done status %d\n", et); //device_printf(dev, "cmd done status %d\n", et);
bus_dmamap_sync(ch->dma.workrq_tag, ch->dma.workrq_map, bus_dmamap_sync(ch->dma.workrq_tag, ch->dma.workrq_map,
@ -1634,11 +1635,6 @@ mvs_end_transaction(struct mvs_slot *slot, enum mvs_err_type et)
ch->oslots &= ~(1 << slot->slot); ch->oslots &= ~(1 << slot->slot);
ch->rslots &= ~(1 << slot->slot); ch->rslots &= ~(1 << slot->slot);
ch->aslots &= ~(1 << slot->slot); ch->aslots &= ~(1 << slot->slot);
if (et != MVS_ERR_TIMEOUT) {
if (ch->toslots == (1 << slot->slot))
xpt_release_simq(ch->sim, TRUE);
ch->toslots &= ~(1 << slot->slot);
}
slot->state = MVS_SLOT_EMPTY; slot->state = MVS_SLOT_EMPTY;
slot->ccb = NULL; slot->ccb = NULL;
/* Update channel stats. */ /* Update channel stats. */
@ -1658,6 +1654,13 @@ mvs_end_transaction(struct mvs_slot *slot, enum mvs_err_type et)
ch->numpslots--; ch->numpslots--;
ch->basic_dma = 0; ch->basic_dma = 0;
} }
/* Cancel timeout state if request completed normally. */
if (et != MVS_ERR_TIMEOUT) {
lastto = (ch->toslots == (1 << slot->slot));
ch->toslots &= ~(1 << slot->slot);
if (lastto)
xpt_release_simq(ch->sim, TRUE);
}
/* If it was our READ LOG command - process it. */ /* If it was our READ LOG command - process it. */
if (ch->readlog) { if (ch->readlog) {
mvs_process_read_log(dev, ccb); mvs_process_read_log(dev, ccb);

View File

@ -1179,6 +1179,7 @@ siis_end_transaction(struct siis_slot *slot, enum siis_err_type et)
device_t dev = slot->dev; device_t dev = slot->dev;
struct siis_channel *ch = device_get_softc(dev); struct siis_channel *ch = device_get_softc(dev);
union ccb *ccb = slot->ccb; union ccb *ccb = slot->ccb;
int lastto;
mtx_assert(&ch->mtx, MA_OWNED); mtx_assert(&ch->mtx, MA_OWNED);
bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map, bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map,
@ -1262,11 +1263,6 @@ siis_end_transaction(struct siis_slot *slot, enum siis_err_type et)
ch->oslots &= ~(1 << slot->slot); ch->oslots &= ~(1 << slot->slot);
ch->rslots &= ~(1 << slot->slot); ch->rslots &= ~(1 << slot->slot);
ch->aslots &= ~(1 << slot->slot); ch->aslots &= ~(1 << slot->slot);
if (et != SIIS_ERR_TIMEOUT) {
if (ch->toslots == (1 << slot->slot))
xpt_release_simq(ch->sim, TRUE);
ch->toslots &= ~(1 << slot->slot);
}
slot->state = SIIS_SLOT_EMPTY; slot->state = SIIS_SLOT_EMPTY;
slot->ccb = NULL; slot->ccb = NULL;
/* Update channel stats. */ /* Update channel stats. */
@ -1275,6 +1271,13 @@ siis_end_transaction(struct siis_slot *slot, enum siis_err_type et)
(ccb->ataio.cmd.flags & CAM_ATAIO_FPDMA)) { (ccb->ataio.cmd.flags & CAM_ATAIO_FPDMA)) {
ch->numtslots[ccb->ccb_h.target_id]--; ch->numtslots[ccb->ccb_h.target_id]--;
} }
/* Cancel timeout state if request completed normally. */
if (et != SIIS_ERR_TIMEOUT) {
lastto = (ch->toslots == (1 << slot->slot));
ch->toslots &= ~(1 << slot->slot);
if (lastto)
xpt_release_simq(ch->sim, TRUE);
}
/* If it was our READ LOG command - process it. */ /* If it was our READ LOG command - process it. */
if (ch->readlog) { if (ch->readlog) {
siis_process_read_log(dev, ccb); siis_process_read_log(dev, ccb);