Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp7178019ybh; Thu, 8 Aug 2019 11:20:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxahgDudndy22ISBb7Z4ZsqWD9F1ogMuiDy6p3UZ7O8Eh8a4Va+vCZotTTjCezQvehx4DHp X-Received: by 2002:a17:902:8a8a:: with SMTP id p10mr15333217plo.88.1565288409291; Thu, 08 Aug 2019 11:20:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565288409; cv=none; d=google.com; s=arc-20160816; b=SnhjTv0Aza+9gcX5EpGNEZi8fZgdIFVK/1GOjIc8+hiR2wJAm8fwBa5pZQ4g538H4K H8WxboPoCzVX9QhpMbUMOig9pPzIB4Z+3KAZjcPkuD3Nh2+XiLaZ+0r0a+Nag8qi00gw ad1svJeQ1G3S8Fj/al0WGLwEhY9Py5t/ocW7AKyJu2WpvHhpcxFdL9YENerh0tgkHPWD vNBN826guTeBeLQJQx/wODEUhkYYt6CARJ/xK01EFALWz4gq2lAi7J7iSGfahscV3eDS YPMVYgx9K7BtltV3pnM24XcX915B+d5rUyLT/Gsi+ss4cdjIXrbWQijmnTkUJZQWzmzB tYKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=XHC/DXG/AsJJpTqq+/d9d6/Y4cRytjPRBDIPDxq1Cy8=; b=lMpvI3zfmVyS9klZQ0z3OPgp8ukkDnFBXOZSvxppsyw10YxmqinpuD1t5YnuAnGnfV OyANNsPyi7xiS+3TYEcvSbH5Fl/eV2/yLQqhqB2B0lAJOZhQeb4SHy4JwWEGufUWdJfD RgMMvvmwDgaeZcchXk6ZVWAsqSK1gXxbkC8O6ljTZejwEY9SSPdLvr3ns2TMqdo3rSbc SMAkNz3jM9AuRQI4u6XWdX8C+JhXAuuM8PFC/fw6raeKQVJwrEtbJNDuXIVNW9B7bBIk fA+n+0IatNBgJKFJ95GFIVzWHv3NyzKpfPKuKGupIMWkBRsQkPBC7eNrQ5K2wdclZULQ Wwog== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=DYL+FtPK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y71si49717626pgd.271.2019.08.08.11.19.52; Thu, 08 Aug 2019 11:20:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=DYL+FtPK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390119AbfHHSS3 (ORCPT + 99 others); Thu, 8 Aug 2019 14:18:29 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:34518 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731038AbfHHSS2 (ORCPT ); Thu, 8 Aug 2019 14:18:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding: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=XHC/DXG/AsJJpTqq+/d9d6/Y4cRytjPRBDIPDxq1Cy8=; b=DYL+FtPKnBxAd1YCNMrIj6xkY eKutNn+BNnoaI3sMq4H+QMbxmgy9VXDqKFZPqganM0B80hcGGXKzySE46O3LFTkiBDmqvBZh2aOUs /iT6efBCnhCEBDnxSyaAb9xiqCJaHm1KkQO8wAY3DUZrlpXceJIRZHphT5Y2dNYWp64JvSCk1OG24 wVrehRnbwmRLcsrhP4/2LH7SO23gmhofLVJC/Txjkmyyu1SCALyZwAJ089a3NiUww5OuZL/uENZxm 9+ilgWbtvtjDr2GsbzCWKRlM+mz/Jikh65vgXwbLen0E3jqcn9WG0d9ERZsx/7DnfisQGbbP63wyt ZDBzuXLNA==; Received: from willy by bombadil.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1hvmzX-0005jr-2Q; Thu, 08 Aug 2019 18:18:23 +0000 Date: Thu, 8 Aug 2019 11:18:22 -0700 From: Matthew Wilcox To: Christoph Hellwig Cc: Linus Torvalds , Andrew Morton , Thomas =?iso-8859-1?Q?Hellstr=F6m?= , Jerome Glisse , Jason Gunthorpe , Steven Price , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] pagewalk: use lockdep_assert_held for locking validation Message-ID: <20190808181822.GK5482@bombadil.infradead.org> References: <20190808154240.9384-1-hch@lst.de> <20190808154240.9384-4-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190808154240.9384-4-hch@lst.de> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 08, 2019 at 06:42:40PM +0300, Christoph Hellwig wrote: > Use lockdep to check for held locks instead of using home grown > asserts. > > @@ -319,7 +319,7 @@ int walk_page_range(struct mm_struct *mm, unsigned long start, > if (!walk.mm) > return -EINVAL; > > - VM_BUG_ON_MM(!rwsem_is_locked(&walk.mm->mmap_sem), walk.mm); > + lockdep_assert_held(&walk.mm->mmap_sem); It occurs to me that this is exactly the pattern that lockdep_pin_lock() was designed for. I'm pretty sure things will go badly if any callee unlocks then relocks the lock.