Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1081171rdh; Mon, 25 Sep 2023 02:41:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEgw4Qy3JqvjoPe6NvocIuxy+xKlrnIblWcY3q4q7oj2QqAlFeBAl70DbWzWsPEFT+83kTl X-Received: by 2002:a17:902:8210:b0:1c3:2ee6:3802 with SMTP id x16-20020a170902821000b001c32ee63802mr3557196pln.47.1695634862456; Mon, 25 Sep 2023 02:41:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695634862; cv=none; d=google.com; s=arc-20160816; b=MDUIXVei2Nw6LvC6DEF/ef3AyBPwZxnNWH/ZIOEjZO+5LlQmbT/8s5ZYAXbGijgQ8X UudAJv9KX2Zvq8Ry4vJJM8Xe2vCHw1nY9F2uJ/NLM4YZgScXaGGZrkDDmkuZiYHjY9qH JMSDs/7M5vAXBLLei6NmNLbnTLUX0emcoJxM068woABnic4WIHqq36Zq8+99m4x9usbb 9DQnhC8AyJapmtFtq2xrVhCiTJLa/OmqnZx01eCeqv7czLoSs3Fx+j7MpfhYmFxvWsj7 wPyc7xUXUI1ecRVHDrt5iYwOZqMN3QPhsmOO1uwBPIRpFx+8v25EDk5HWiKslNR/fC3j Kw4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Xy8aDpTWdev/2IK3fLC6m+4sZD1ioPrrcXZgqPMP7cM=; fh=kq7TdMGGLp2QsspTsxMNbn/tU731nOSkLpt6kr5QYXg=; b=WFO3Ka5MO33Ew6S/p56jG2VpBwm5gfSeOl00mCt8DfkN6E1SHiYN8xu4SlygzRKNDt STtTuVkm8u3HUZqq/XXV36fivZ8HzeEBV3o8R3nZ10emXxF0YkKHcY3PR9EY/WWdrvOe RO9u/pHrTYTd/pajWQRi0kWhrrseyHdcN/myxPl34o5ulfezaJftBt6vWpzeMr49JdX2 XcHP0pS0YHDzezhpYLDZkOfr0LcubufRN9ssOSyrneFDjKbRta50DvWjN49BqtAPpUwP k1OkcpiQYuY2fDlVmO1bUK0bQc8LfO3B/NZU5MLI3RLwaSovJsaf/52mI5o+vlEAkxkV homg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id e5-20020a170902ef4500b001c61bdd8e89si2045825plx.150.2023.09.25.02.41.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 02:41:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id BAD5A80E068C; Mon, 25 Sep 2023 02:27:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233182AbjIYJ1T (ORCPT + 99 others); Mon, 25 Sep 2023 05:27:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230061AbjIYJ1R (ORCPT ); Mon, 25 Sep 2023 05:27:17 -0400 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97EC3AB for ; Mon, 25 Sep 2023 02:27:11 -0700 (PDT) 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-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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-kernel@vger.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 25 Sep 2023 02:27:20 -0700 (PDT) On Mon, Sep 25, 2023 at 11:20:04AM +0200, Uwe Kleine-K?nig 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/AM0PR08MB308979EC3A8A53AE6E2D3408802CA@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_channel *sdmac) > > * owned buffer is available (i.e. BD_DONE was set too late). > > */ > > if (sdmac->desc && !is_sdma_channel_enabled(sdmac->sdma, sdmac->channel)) { > > + spin_unlock(&sdmac->vc.lock); > > dev_warn(sdmac->sdma->dev, "restart cyclic channel %d\n", sdmac->channel); > > + 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 |