Skip to content

Commit

Permalink
ioat: close potential BUG_ON race in the descriptor cleanup path
Browse files Browse the repository at this point in the history
Since ioat_cleanup_preamble() and the update of the last completed
descriptor are not synchronized there is a chance that two cleanup threads
can see descriptors to clean.  If the first cleans up all pending
descriptors then the second will trigger the BUG_ON.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
  • Loading branch information
Dan Williams committed Mar 4, 2010
1 parent 281befa commit aa75db0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/dma/ioat/dma_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ static void __cleanup(struct ioat2_dma_chan *ioat, unsigned long phys_complete)
seen_current = true;
}
ioat->tail += i;
BUG_ON(!seen_current); /* no active descs have written a completion? */
BUG_ON(active && !seen_current); /* no active descs have written a completion? */

chan->last_completion = phys_complete;
if (ioat->head == ioat->tail) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/dma/ioat/dma_v3.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ static void __cleanup(struct ioat2_dma_chan *ioat, unsigned long phys_complete)
}
}
ioat->tail += i;
BUG_ON(!seen_current); /* no active descs have written a completion? */
BUG_ON(active && !seen_current); /* no active descs have written a completion? */
chan->last_completion = phys_complete;
if (ioat->head == ioat->tail) {
dev_dbg(to_dev(chan), "%s: cancel completion timeout\n",
Expand Down

0 comments on commit aa75db0

Please sign in to comment.