]> git.baikalelectronics.ru Git - kernel.git/commitdiff
dmaengine: ioat: stop mod_timer from resurrecting deleted timer in __cleanup()
authorDave Jiang <dave.jiang@intel.com>
Mon, 19 Sep 2022 16:58:42 +0000 (09:58 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 11:22:43 +0000 (13:22 +0200)
[ Upstream commit b354de9a744c0853fb227bcb1244a2e3c94d1ed0 ]

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: 04a42d9ca7df ("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>
drivers/dma/ioat/dma.c

index 8e2a4d1f0be53363ba773847c7ed4cda18202ecf..997839c2130e4e9503e9c5395785ff5125b51a96 100644 (file)
@@ -653,7 +653,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 */
@@ -679,7 +679,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);
                }
        }
@@ -876,7 +876,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);
 }
 
 void ioat_timer_event(struct timer_list *t)