ioatdma: fix race between updating ioat->head and IOAT_COMPLETION_PENDING
authorDave Jiang <dave.jiang@intel.com>
Thu, 7 Feb 2013 21:38:32 +0000 (14:38 -0700)
committerVinod Koul <vinod.koul@intel.com>
Tue, 12 Feb 2013 16:27:21 +0000 (08:27 -0800)
commit4dec23d7718e6f1f5e1773698d112025169e7d49
tree2d39626f26b0b8cbbdcb246188ec5b2c7494fd8d
parentcfdf5b6cc5985014a7ce891093f4fd0ae2d27ca6
ioatdma: fix race between updating ioat->head and IOAT_COMPLETION_PENDING

There is a race that can hit during __cleanup() when the ioat->head pointer is
incremented during descriptor submission. The __cleanup() can clear the
PENDING flag when it does not see any active descriptors. This causes new
submitted descriptors to be ignored because the COMPLETION_PENDING flag is
cleared. This was introduced when code was adapted from ioatdma v1 to ioatdma
v2. For v2 and v3, IOAT_COMPLETION_PENDING flag will be abandoned and a new
flag IOAT_CHAN_ACTIVE will be utilized. This flag will also be protected under
the prep_lock when being modified in order to avoid the race.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Dan Williams <djbw@fb.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/ioat/dma.h
drivers/dma/ioat/dma_v2.c
drivers/dma/ioat/dma_v3.c