Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2585860rdb; Fri, 22 Sep 2023 03:06:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IELVMocBnd7IpojrRioi1325TZrZ4uT8ELo8wZh6mngy+bgC6u0hUB9gS0hXzUDYPARie+F X-Received: by 2002:a05:6358:341a:b0:134:de8b:17f0 with SMTP id h26-20020a056358341a00b00134de8b17f0mr9577090rwd.19.1695377162221; Fri, 22 Sep 2023 03:06:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695377162; cv=none; d=google.com; s=arc-20160816; b=ZaHCtcJbkyn+CAEPjPhsx4S0Cej6dL1Qwl5N79vxggmIIrAHktfoAP2tt6I1v9N+Rz 0R3dxA72xCs8MoIqS3w6Pr7konIlOd5/bH88CQcO4skTr5eUTtlzEB6VtWPgGt49LsMn WyHvLj6yzfYrks8t1aKLhqADlezUogtPg2IyAH4qXD4B25DGPkuh1F2D65zvLYOEbB4d S0FAH1cLNU6Nn5Y7mAM79KVdJrbcRS54TeDzpQ7x7C3TbC4e1+lFiXH8dLx2XEVm4OWL bNeagw8i1Sh6jopiEeTzfbxBp69l6DVtRbfRvq3gvozN9wSSz7CEcjlZnx5++nOvHZqL fzTQ== 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-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=emUkw0IPnwFY9YJ6Lz3VhJBECkxNu1YX1RF6hzAUzj8=; fh=fOjd6ApTT5N4TW2aAC3xKkL28+pAWJvJ/DZYvXrey+Q=; b=HwUnAnzBPykyh/8Wxss444HtQks+vEdGZUwyA1QCpiJs/f3lubLp0fGsLTCIU13dno 3wLS6LmDXvT+uTVAle/SbOyz9iXE+CL5k5YybfT6sG8qLHg6NPt5lKc24oCJ7kqAnglu I+j4quMv7iRtX/+8XxJZBdmTQNtoj7GTXNd0i1YlOTYyD+lj40H7ZSnR/SFNmZ5yF8E2 TEmPPrXskbVfuXPxGMRJ3v25jGHFVXHxyKJ6F6TpDavvGb/A+UqVh+8bTQXGsSeQUD8P VYGsCeiINgYFoiAkobbML6PlJCmE++gomyciNp0FefzLPPFIad4oeHs154OUky5cusr1 rcGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id f7-20020a63f747000000b00578bb6fe9c5si3376850pgk.445.2023.09.22.03.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 03:06:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 1EBF4804253C; Fri, 22 Sep 2023 02:50:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232775AbjIVJu4 (ORCPT + 99 others); Fri, 22 Sep 2023 05:50:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232667AbjIVJuv (ORCPT ); Fri, 22 Sep 2023 05:50:51 -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 981E619D for ; Fri, 22 Sep 2023 02:50:40 -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 1qjcnx-0007Ns-Ak; Fri, 22 Sep 2023 11:50:33 +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 1qjcnw-0088Hm-6G; Fri, 22 Sep 2023 11:50:32 +0200 Received: from sha by ptx.whiteo.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1qjcnw-00AwJ0-3Y; Fri, 22 Sep 2023 11:50:32 +0200 Date: Fri, 22 Sep 2023 11:50:32 +0200 From: Sascha Hauer To: Tim van der Staaij | Zign Cc: Shawn Guo , "linux-kernel@vger.kernel.org" , Vinod Koul , Pengutronix Kernel Team , "dmaengine@vger.kernel.org" , Fabio Estevam , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH] dmaengine: imx-sdma: fix deadlock in interrupt handler Message-ID: <20230922095032.GU637806@pengutronix.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Fri, 22 Sep 2023 02:50:58 -0700 (PDT) Hi Tim, 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); This is strange. Why and how does dev_warn() call back into the SDMA driver? We shouldn't merge this without having a clue what exactly goes wrong here. Please provide the corresponding lockdep output. 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 |