Skip to content

Commit

Permalink
dmaengine: ioat: stop mod_timer from resurrecting deleted timer in __…
Browse files Browse the repository at this point in the history
…cleanup()

[ Upstream commit 898ec89 ]

User reports observing timer event report channel halted but no error
observed in CHANERR register. The driver finished self-test and released
channel resources. Debug shows that __cleanup() can call
mod_timer() after the timer has been deleted and thus resurrect the
timer. While harmless, it causes suprious error message to be emitted.
Use mod_timer_pending() call to prevent deleted timer from being
resurrected.

Fixes: 3372de5 ("dmaengine: ioatdma: removal of dma_v3.c and relevant ioat3 references")
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/166360672197.3851724.17040290563764838369.stgit@djiang5-desk3.ch.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
davejiang authored and gregkh committed Oct 21, 2022
1 parent 2a853c2 commit fad8b6b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/dma/ioat/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ static void __cleanup(struct ioatdma_chan *ioat_chan, dma_addr_t phys_complete)
if (active - i == 0) {
dev_dbg(to_dev(ioat_chan), "%s: cancel completion timeout\n",
__func__);
mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT);
mod_timer_pending(&ioat_chan->timer, jiffies + IDLE_TIMEOUT);
}

/* microsecond delay by sysfs variable per pending descriptor */
Expand All @@ -682,7 +682,7 @@ static void ioat_cleanup(struct ioatdma_chan *ioat_chan)

if (chanerr &
(IOAT_CHANERR_HANDLE_MASK | IOAT_CHANERR_RECOVER_MASK)) {
mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT);
mod_timer_pending(&ioat_chan->timer, jiffies + IDLE_TIMEOUT);
ioat_eh(ioat_chan);
}
}
Expand Down Expand Up @@ -879,7 +879,7 @@ static void check_active(struct ioatdma_chan *ioat_chan)
}

if (test_and_clear_bit(IOAT_CHAN_ACTIVE, &ioat_chan->state))
mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT);
mod_timer_pending(&ioat_chan->timer, jiffies + IDLE_TIMEOUT);
}

static void ioat_reboot_chan(struct ioatdma_chan *ioat_chan)
Expand Down

0 comments on commit fad8b6b

Please sign in to comment.