From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0B8DACE7A81 for ; Mon, 25 Sep 2023 09:27:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=e01wL69J9HjNbj/xMc61bmaGv2aIJ93zfRyA3K9JrVk=; b=ZgI5BkTHC2SnsI URTw+tpl936A9c9lsM709O98rlsEJ0jGh0MrJGHlELJ7PppT68isRf7mgdSwNMQRKwzzvAQ9ATD48 8vo/Og4j1Bi5ZKF6s5GVGTA+pcpV77I6lBLyRB8YpnN3NwKHK0KQR8EtX9u0Vqmxpq/kdC+8fB6mp hsEBSi/udda8dkorkOtWLkIbtaERZE2AjgwS5rvzUspZVhGGiBHQiru7yn6hMaCT/0mcIXr5Ft3bh 3xH6wFiuxz3D3HxEkEURbkpkyNFufo7/hO0U/xSBpVeBy3T5mn8shthrxvkbw/MZiov7aeC28draZ tEhaT4JlbsJcIKOv+x4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qkhs8-00Dqt5-2C; Mon, 25 Sep 2023 09:27:20 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qkhs5-00DqsS-1W for linux-arm-kernel@lists.infradead.org; Mon, 25 Sep 2023 09:27:18 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qkhrx-0000ed-7D; Mon, 25 Sep 2023 11:27:09 +0200 Received: from [2a0a:edc0:2:b01:1d::c0] (helo=ptx.whiteo.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qkhrw-008poP-I8; Mon, 25 Sep 2023 11:27:08 +0200 Received: from sha by ptx.whiteo.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1qkhrw-00BOJa-FQ; Mon, 25 Sep 2023 11:27:08 +0200 Date: Mon, 25 Sep 2023 11:27:08 +0200 From: Sascha Hauer To: Uwe =?iso-8859-15?Q?Kleine-K=F6nig?= Cc: Tim van der Staaij | Zign , Fabio Estevam , "linux-kernel@vger.kernel.org" , Vinod Koul , Pengutronix Kernel Team , "dmaengine@vger.kernel.org" , Shawn Guo , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH] dmaengine: imx-sdma: fix deadlock in interrupt handler Message-ID: <20230925092708.GX637806@pengutronix.de> References: <20230925092004.natij4i364yupevi@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230925092004.natij4i364yupevi@pengutronix.de> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230925_022717_505995_A9040ACA X-CRM114-Status: GOOD ( 27.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Sep 25, 2023 at 11:20:04AM +0200, Uwe Kleine-K=F6nig wrote: > Hello, > = > On Thu, Sep 21, 2023 at 09:57:11AM +0000, Tim van der Staaij | Zign wrote: > > dev_warn internally acquires the lock that is already held when > > sdma_update_channel_loop is called. Therefore it is acquired twice and > > this is detected as a deadlock. Temporarily release the lock while > > logging to avoid this. > > = > > Signed-off-by: Tim van der Staaij > > Link: https://lore.kernel.org/all/AM0PR08MB308979EC3A8A53AE6E2D3408802C= A@AM0PR08MB3089.eurprd08.prod.outlook.com/ > > --- > > drivers/dma/imx-sdma.c | 3 +++ > > 1 file changed, 3 insertions(+) > > = > > diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c > > index 51012bd39900..3a7cd783a567 100644 > > --- a/drivers/dma/imx-sdma.c > > +++ b/drivers/dma/imx-sdma.c > > @@ -904,7 +904,10 @@ static void sdma_update_channel_loop(struct sdma_c= hannel *sdmac) > > * owned buffer is available (i.e. BD_DONE was set too late). > > */ > > if (sdmac->desc && !is_sdma_channel_enabled(sdmac->sdma, sdmac->chann= el)) { > > + spin_unlock(&sdmac->vc.lock); > > dev_warn(sdmac->sdma->dev, "restart cyclic channel %d\n", sdmac->cha= nnel); > > + spin_lock(&sdmac->vc.lock); > > + > = > I don't know if Sascha's patch helps I do ;) I inserted a dev_info() into the imx-sdma driver and got said circular locking warning. With my patch applied it's gone. Nevertheless I would wait for Tims feedback and resend it with some more people on Cc. I never used lockdep_set_subclass() and I am not sure if it's legal to put it into the UART startup function like I did. Sascha -- = Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel