1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-11 09:50:12 +00:00

aacraid: reduce max I/O size to avoid DMA issues

Reserve one page for the DMA subsystem, that may need it when the I/O
buffer is not page aligned.

Without this change, writes with the maximum allowed size failed, if:
- physical memory was fragmented, making it necessary to use one DMA
  segment for each page
- the buffer to be written was not page aligned, causing the DMA
  subsystem to need one extra segment

In the scenario above, the DMA subsystem would run out of segments,
resulting in a write with no SG segments, that would fail.

Reviewed by:		imp
MFC after:		2 weeks
Sponsored by:		Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision:	https://reviews.freebsd.org/D30798
This commit is contained in:
Leandro Lupori 2021-06-21 15:04:43 -03:00
parent 79617645c6
commit 9c2c635319
3 changed files with 11 additions and 3 deletions

View File

@ -579,7 +579,7 @@ aac_alloc(struct aac_softc *sc)
BUS_SPACE_MAXADDR_32BIT, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */
NULL, NULL, /* filter, filterarg */
sc->aac_max_sectors << 9, /* maxsize */
AAC_MAXIO_SIZE(sc), /* maxsize */
sc->aac_sg_tablesize, /* nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
BUS_DMA_ALLOCNOW, /* flags */
@ -1807,7 +1807,7 @@ aac_init(struct aac_softc *sc)
}
ip->MaxIoCommands = sc->aac_max_fibs;
ip->MaxIoSize = sc->aac_max_sectors << 9;
ip->MaxIoSize = AAC_MAXIO_SIZE(sc);
ip->MaxFibSize = sc->aac_max_fib_size;
aac_adapter_init_tole(ip);

View File

@ -1011,7 +1011,7 @@ aac_cam_action(struct cam_sim *sim, union ccb *ccb)
cpi->max_lun = 7; /* Per the controller spec */
cpi->initiator_id = camsc->inf->InitiatorBusId;
cpi->bus_id = camsc->inf->BusNumber;
cpi->maxio = sc->aac_max_sectors << 9;
cpi->maxio = AAC_MAXIO_SIZE(sc);
/*
* Resetting via the passthrough or parallel bus scan

View File

@ -470,6 +470,14 @@ struct aac_softc
u_int32_t FwDebugBufferSize; /* FW Debug Buffer size */
};
/*
* Max. I/O size in bytes.
* Reserve one page for the DMA subsystem, that may need it when the
* I/O buffer is not page aligned.
*/
#define AAC_MAXIO_SIZE(sc) MIN(((sc)->aac_max_sectors << 9) - PAGE_SIZE, \
maxphys)
/*
* Event callback mechanism for the driver
*/