]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
ioat: Allocate memory for ring resize sanely
authorConrad Meyer <cem@FreeBSD.org>
Mon, 26 Oct 2015 03:30:38 +0000 (03:30 +0000)
committerConrad Meyer <cem@FreeBSD.org>
Mon, 26 Oct 2015 03:30:38 +0000 (03:30 +0000)
commitbf8553ea3853b2d67d361c308e56365bc5b72d42
tree2657f9f034ac4d0b7b998d94f4f5b3f011fd295d
parent65e4f8adce80cc272b4e817db0adc8f7ca1f9af1
ioat: Allocate memory for ring resize sanely

Add a new flag for DMA operations, DMA_NO_WAIT.  It behaves much like
other NOWAIT flags -- if queueing an operation would sleep, abort and
return NULL instead.

When growing the internal descriptor ring, the memory allocation is
performed outside of all locks.  A lock-protected flag is used to avoid
duplicated work.  Threads that cannot sleep and attempt to queue
operations when the descriptor ring is full allocate a larger ring with
M_NOWAIT, or bail if that fails.

ioat_reserve_space() could become an external API if is important to
callers that they have room for a sequence of operations, or that those
operations succeed each other directly in the hardware ring.

This patch splits the internal head index (->head) from the hardware's
head-of-chain (DMACOUNT) register (->hw_head).  In the future, for
simplicity's sake, we could drop the 'ring' array entirely and just use
a linked list (with head and tail pointers rather than indices).

Suggested by: Witness
Sponsored by: EMC / Isilon Storage Division
sys/dev/ioat/ioat.c
sys/dev/ioat/ioat.h
sys/dev/ioat/ioat_internal.h