Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5165202pxb; Wed, 26 Jan 2022 06:16:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJy0z696xsUsXn0dVVPngO/HgQyxAnO6J3Vt5JwhR05MVmsrsYMR1lWQCWxl+7O7OZRI3FTy X-Received: by 2002:a17:903:245:b0:149:d2a3:ddbf with SMTP id j5-20020a170903024500b00149d2a3ddbfmr23361580plh.3.1643206581382; Wed, 26 Jan 2022 06:16:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643206581; cv=none; d=google.com; s=arc-20160816; b=q5fuE68ud4dJV3njDRLKK/JCGl38tXdiaUbvJcXaNAOS3jk7hSI2GHQY4abJsRjoFE GlH5WtpjQD5QtWmyK2VvgspdahuTXEBnMh7vEZFJV4PHp2BGZFyCM9qi1zqRFzg37YsE uBxmsbBiifIrh9UYAyrw/ELVtY4yEgpx500r75jspPxJ4wmXEBfpCv227YFdi6ZNtEOw Jw8zh+iJGGKdnr51tWOLDk9OoTQcQMYP53KuL+p2z5mp02ItRTf4bHHgnXdmsvMecgwx deq0rBwtjw/E6p2l15K3pAgZJ1AxaqDduyfMGOJzUR0qlpLG8P8uq07rDdlEJu0ziILS lqiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=tBUOkoZyUpJIBTjqA10IJ9NkWZS9c3Z+ZbYxrwhLt1I=; b=FkLXJ7y2pmRX3TV94aazDd8TLwhjRGieu6NuWJ44YrXEdlTvBW26TJs0oja3CyaFPk V7SZ4knZbtSKj7kIj9NZadbWAf8qoXkCIGsrDnW5zXOeCxLNgunrwL2kgDJNUHtswJlo ac1NicI46QQu8TI8c43i+XOsuxYw+my7qzIRoWGB5sJU/IsmYYPfuYp94wTqiXXYB8TO cxeITYe4FnLOD6cxiSxBWVB8rYG6CbwigwL77GNUI/v7m6dhFdaGBidFM9Yibzr2fWf9 b4Kp2/BO8e/axDPkNXdskTT/1oP+13oO2Xt6DsP9cmMJ9jrKaC3Gik++qL/9HG/zPXCe H2Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=cfIVlgBx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h22si19843696pgi.833.2022.01.26.06.16.09; Wed, 26 Jan 2022 06:16:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=cfIVlgBx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235546AbiAZBJG (ORCPT + 99 others); Tue, 25 Jan 2022 20:09:06 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42272 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231271AbiAZBJF (ORCPT ); Tue, 25 Jan 2022 20:09:05 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EEBCCB81B99; Wed, 26 Jan 2022 01:09:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43C1BC340E0; Wed, 26 Jan 2022 01:09:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1643159342; bh=D6r77K7QjaFLL+Ex50/C3+VaPdgBBea9XHVhawpPP5E=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=cfIVlgBxdxoEmDlzxN8MLdZiDeqfVMs3F9R44x1EEDi+FAcc219spoDmj/bUz+Llv h5JdE3MYN7DlL3+6DvlIKyfve25qK4t/2jBcjqDCi5sYv2yBNTNSHibXSD3wYTXTIt MuNS0xHZw3u41EGgehRxBHDemS/y4UWPqGR1HW3E= Date: Tue, 25 Jan 2022 17:09:00 -0800 From: Andrew Morton To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, kexec@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Baoquan He , Vivek Goyal , Dave Young , "Paul E. McKenney" , Josh Triplett , Peter Zijlstra , Boqun Feng Subject: Re: [PATCH v2] proc/vmcore: fix possible deadlock on concurrent mmap and read Message-Id: <20220125170900.472fdb649312e77a4a60d9da@linux-foundation.org> In-Reply-To: <20220119193417.100385-1-david@redhat.com> References: <20220119193417.100385-1-david@redhat.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 19 Jan 2022 20:34:17 +0100 David Hildenbrand wrote: > Lockdep noticed that there is chance for a deadlock if we have > concurrent mmap, concurrent read, and the addition/removal of a > callback. > > As nicely explained by Boqun: > > " > Lockdep warned about the above sequences because rw_semaphore is a fair > read-write lock, and the following can cause a deadlock: > > TASK 1 TASK 2 TASK 3 > ====== ====== ====== > down_write(mmap_lock); > down_read(vmcore_cb_rwsem) > down_write(vmcore_cb_rwsem); // blocked > down_read(vmcore_cb_rwsem); // cannot get the lock because of the fairness > down_read(mmap_lock); // blocked I'm wondering about cc:stable. It's hard to believe that this is likely to be observed in real life. But the ongoing reports of lockdep splats will be irritating.