Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754564AbbEUAe2 (ORCPT ); Wed, 20 May 2015 20:34:28 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:47893 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752819AbbEUAeY (ORCPT ); Wed, 20 May 2015 20:34:24 -0400 X-AuditID: cbfec7f4-f79c56d0000012ee-3d-555d280d941f From: Krzysztof Kozlowski To: Dan Williams , Vinod Koul , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski , stable@vger.kernel.org, Dinh Nguyen Subject: [PATCH] dmaengine: pl330: Fix hang on dmaengine_terminate_all on certain boards Date: Thu, 21 May 2015 09:34:09 +0900 Message-id: <1432168449-18850-1-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrGJMWRmVeSWpSXmKPExsVy+t/xa7q8GrGhBi9PMVtMn3qB0WLVpzXM Fqun/mW1eP3C0OLyrjlsFgs2PmK0eNm3n8WB3WPxnpdMHv3XJrF79G1ZxejxeZNcAEsUl01K ak5mWWqRvl0CV8bpzy/ZCybzVZztnMzawDiRp4uRk0NCwESiufcLG4QtJnHh3nogm4tDSGAp o8SO592MIAkhgf+MElMn1IHYbALGEpuXLwErEhHoZJT4OPkkK0iCWaBS4tOt/ewgtrBAlMTB SSeZQWwWAVWJc1MhNvAKuEvcPbyFGWKbnMTJY5NZJzByL2BkWMUomlqaXFCclJ5rqFecmFtc mpeul5yfu4kREhpfdjAuPmZ1iFGAg1GJh/fEoehQIdbEsuLK3EOMEhzMSiK859bHhArxpiRW VqUW5ccXleakFh9ilOZgURLnnbvrfYiQQHpiSWp2ampBahFMlomDU6qBkfGyGJukjQzjglN/ yvVOVXxbM2XSFaaawzcC9XYuYJa78ofnmaXO1+8Ft64L7l+/e07vGxGGHGfrh/VW29dzmPdd /Jz/IzP6xVIWkQdzOoRsJ5x8N/trw3PzbTW+DKtmVX7MVP8teyNK/pzpNq/bE0t9w5O3frLv qvYQ+Gz6zDnMes4h0cisrUosxRmJhlrMRcWJAOy4MDEJAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2007 Lines: 54 The pl330 device could hang infinitely on certain boards when DMA channels are terminated. It was caused by lack of runtime resume when executing pl330_terminate_all() which calls the _stop() function. _stop() accesses device register and can loop infinitely while checking for device state. The hang was confirmed by Dinh Nguyen on Altera SOCFPGA Cyclone V board during boot. It can be also triggered with: $ echo 1 > /sys/module/dmatest/parameters/iterations $ echo dma1chan0 > /sys/module/dmatest/parameters/channel $ echo 1 > /sys/module/dmatest/parameters/run $ sleep 1 $ cat /sys/module/dmatest/parameters/run Reported-by: Dinh Nguyen Signed-off-by: Krzysztof Kozlowski Fixes: ae43b3289186 ("ARM: 8202/1: dmaengine: pl330: Add runtime Power Management support v12") Cc: Cc: Dinh Nguyen --- drivers/dma/pl330.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index a7d9d3029b14..340f9e607cd8 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -2127,6 +2127,7 @@ static int pl330_terminate_all(struct dma_chan *chan) struct pl330_dmac *pl330 = pch->dmac; LIST_HEAD(list); + pm_runtime_get_sync(pl330->ddma.dev); spin_lock_irqsave(&pch->lock, flags); spin_lock(&pl330->lock); _stop(pch->thread); @@ -2151,6 +2152,8 @@ static int pl330_terminate_all(struct dma_chan *chan) list_splice_tail_init(&pch->work_list, &pl330->desc_pool); list_splice_tail_init(&pch->completed_list, &pl330->desc_pool); spin_unlock_irqrestore(&pch->lock, flags); + pm_runtime_mark_last_busy(pl330->ddma.dev); + pm_runtime_put_autosuspend(pl330->ddma.dev); return 0; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/