Skip to contentSkip to conversation

x86: poll waiting for I/OAT DMA channel status

PATCH In review Dimitri Sivanich 2 participants 2 messages May 6, 2011 – May 26, 2011 dmaengine

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: poll waiting for I/OAT DMA channel status

For certain system configurations a 5 usec udelay before checking I/OAT DMA channel status is sometimes not sufficient, resulting in a false failure status and unnecessary freeing of channel resources. Conversely, for many configurations 5 usec is longer than necessary.

Loop for up to 20 usec waiting for successful status before failing.

___

 drivers/dma/ioat/dma_v2.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/dma/ioat/dma_v2.c +6 -2
Index: linux/drivers/dma/ioat/dma_v2.c
===================================================================
@@ -507,6 +507,7 @@ int ioat2_alloc_chan_resources(struct dm
 	struct ioat_ring_ent **ring;
 	u64 status;
 	int order;
+	int i = 0;
 
 	/* have we already been set up? */
 	if (ioat->ring)
@@ -547,8 +548,11 @@ int ioat2_alloc_chan_resources(struct dm
 	ioat2_start_null_desc(ioat);
 
 	/* check that we got off the ground */
-	udelay(5);
-	status = ioat_chansts(chan);
+	do {
+		udelay(1);
+		status = ioat_chansts(chan);
+	} while (i++ < 20 && !is_ioat_active(status) && !is_ioat_idle(status));
+
 	if (is_ioat_active(status) || is_ioat_idle(status)) {
 		set_bit(IOAT_RUN, &chan->state);
 		return 1 << ioat->alloc_order;
#1 lore raw
Quoted 9 lines · Dimitri Sivanich

For certain system configurations a 5 usec udelay before checking I/OAT DMA channel status is sometimes not sufficient, resulting in a false failure status and unnecessary freeing of channel resources.  Conversely, for many configurations 5 usec is longer than necessary.

Loop for up to 20 usec waiting for successful status before failing.

___

Applied, but for future reference fix your scripts to use "---" instead of "___" for the separator after the Signed-off-by otherwise the diffstat information gets included in the changelog when apply the patch with "git am".

--
Dan