Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CHROMIUM: dmaengine: tegra-adma: fix race between tasklet/terminate_a…
…ll (take 2) Commit 92cd07d ("CHROMIUM: dmaengine: tegra-adma: fix race between tasklet/terminate_all") attempted to fix a race condition between the tegra_adma_tasklet() and a call to tegra_adma_terminate_all() that would result in a kernel crash. This change added a call to tasklet_kill() to tegra_adma_terminate_all() to stop the tasklet if it was running in order to the crash. However, this triggered another kernel panic, when tegra_adma_terminate_all() was called from an interrupt context and tasklet_kill() then attempted to sleep. Commit 19218f4 ("CHROMIUM: dmaengine: tegra-adma: Avoid tasklet from self-destructing") workaround this new crash, but this still means that the crash from the original problem may still occur. On inspecting the most recent crash logs, it appears that the original crash is caused when the tasklet calling the DMA callback which then calls tegra_adma_terminate_all(). If the cb_count in the tegra_adma_tasklet() is greater than 1, when tegra_adma_terminate_all() is called, then it is possible for the DMA callback to be called again after the call to terminate the DMA transfers has completed. To prevent this store the current callback count in the ADMA channel data structure and force the count to zero if we are terminating the DMA transfers. BUG=chrome-os-partner:46247 TEST=Audio playback Change-Id: I0585f13e3386c07dd9fc420da5457300be71cfdc Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Reviewed-on: https://chromium-review.googlesource.com/305641 Commit-Ready: Anatol Pomazau <anatol@google.com> Tested-by: Anatol Pomazau <anatol@google.com> Reviewed-by: Anatol Pomazau <anatol@google.com> Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
- Loading branch information