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 22EE3C7EE26 for ; Tue, 23 May 2023 10:56:37 +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=sfWld+5SfzYl+ViajoxaBkwk50/cPX0svVLWEupfNes=; b=iITFrh48pneSmv 0SC5HYrisuKcCtzTdjdo7iKwa4AASfwRcoA/SvgWV1A08e3gQJuFTfU0BAUfR7XdHZND94gYiSf5Q NuakKP3tK4ETQSvl0ICGbDSrg79aoXeKpE8GQCl83oHDfp8Ltizu4PCcxel3p+qhxOKqm1HJtUIPH lchaE6XP34eEbib5IdTBkdbKpaqeSFJCCz2PV/haLQ1tmLNXBqo7azuz9g+0dzEBfYqNvXhlLMG2m JimOENk3adW9vx+7deEzyIUNeJWfVZeiAef25dwYSgOmVTEUFFOJDeYEnhUdHL1z2SMMLi3tbXamt DEPlqNGNZmPWRg2wdwtA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q1Pga-009zz3-2r; Tue, 23 May 2023 10:56:12 +0000 Received: from pandora.armlinux.org.uk ([78.32.30.218]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1PgX-009zU9-10 for linux-arm-kernel@lists.infradead.org; Tue, 23 May 2023 10:56:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type: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-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=nNaVVitAdqly0HV3wb/gpkjgT9kyHVKcL6u7vHyYEuo=; b=tZQeapXf+QATFM4a3PS6TRgoJc 1ccZwWLDnCgasphlRBVwQmZ5rT6ozj6PDDHRoqmMnKjszz4T9KdpIhwmDxHrUnDq7KA4s0OxTd4xq j/XftNjnyOMUEf+itf+JgO2LT8lUEbLQqWYcEdyyZK0L+orUCxF+qQvytMUMi0mrqrv4K+/3J6xOO VBDpnlw2klvY+vydmdriPp4tPQXLng08oq/Q0us4pRTPh23lKlfUzjUmmsT/FAWy4V5DpdDM0FWZt Rj7dPHCUywOtL8+88Gj/QUIdzlT5PW7kE0bLAqBvhzzRZd1tQZ//Ii4nVnGBtl9COM82vPKbHic6f rtqgDUdw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:49026) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q1PcK-0000ET-9C; Tue, 23 May 2023 11:51:48 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1q1PcH-0000Vk-28; Tue, 23 May 2023 11:51:45 +0100 Date: Tue, 23 May 2023 11:51:45 +0100 From: "Russell King (Oracle)" To: Helge Deller Cc: Bart Van Assche , Linux SCSI List , linux-aio@kvack.org, linux-parisc , "linux-arm-kernel@lists.infradead.org" Subject: Re: spinlock recursion in aio_complete() Message-ID: References: <5057d550-c3f4-be34-d3e6-390790051232@gmx.de> <89053bf1-6bc3-3778-7662-14d15bd778a3@acm.org> <8bd7faad-abf4-f7b3-03c9-e06f9b5d2148@gmx.de> <077b00a6-9587-2e28-3f8a-44871f9428ca@acm.org> <5e684a22-dcc1-095f-ac18-fd1b3bf81cd6@gmx.de> <4d786f73-8c6f-4fd1-cdd6-42f2d59d6120@gmx.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4d786f73-8c6f-4fd1-cdd6-42f2d59d6120@gmx.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230523_035609_347013_2958B0AE X-CRM114-Status: GOOD ( 20.48 ) 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-1" 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 Tue, May 23, 2023 at 12:24:04PM +0200, Helge Deller wrote: > On 5/22/23 23:22, Helge Deller wrote: > > > > It hangs in fs/aio.c:1128, function aio_complete(), in this call: > > > > =A0=A0=A0=A0=A0spin_lock_irqsave(&ctx->completion_lock, flags); > > > = > > > All code that I found and that obtains ctx->completion_lock disables = IRQs. > > > It is not clear to me how this spinlock can be locked recursively? Is= it > > > sure that the "spinlock recursion" report is correct? > > = > > Yes, it seems correct. > > [...] > = > Bart, thanks to your suggestions I was able to narrow down the problem! > = > I got LOCKDEP working on parisc, which then reports: > raw_local_irq_restore() called with IRQs enabled > for the spin_unlock_irqrestore() in function aio_complete(), which should= n't happen. > = > Finally, I found that parisc's flush_dcache_page() re-enables the IRQs > which leads to the spinlock hang in aio_complete(). > = > So, this is NOT a bug in aio or scsci, but we need fix in the the arch co= de. You can find some of the background to this at: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/?id= =3D16ceff2d5dc9f0347ab5a08abff3f4647c2fee04 which introduced flush_dcache_mmap_lock(). It looks like Hugh had questions over whether this should be _irqsave() rather than _irq() but I guess at the time all callers had interrupts enabled, and it's only recently that someone came up with the idea of calling flush_dcache_page() with interrupts disabled. Adding another arg to flush_dcache_mmap_lock() to save the flags may be doable, but requires a patch that touches not only architectures that have a private implementation, but also various code in mm/. -- = RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel