From patchwork Mon Aug 26 20:14:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11115497 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B3AD1399 for ; Mon, 26 Aug 2019 20:14:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 67C6C21883 for ; Mon, 26 Aug 2019 20:14:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="jWs+/c0l" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 67C6C21883 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A39BC6B0277; Mon, 26 Aug 2019 16:14:36 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 94A086B0279; Mon, 26 Aug 2019 16:14:36 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 813176B027A; Mon, 26 Aug 2019 16:14:36 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0079.hostedemail.com [216.40.44.79]) by kanga.kvack.org (Postfix) with ESMTP id 52B036B0277 for ; Mon, 26 Aug 2019 16:14:36 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id EEFCB824CA3B for ; Mon, 26 Aug 2019 20:14:35 +0000 (UTC) X-FDA: 75865681710.20.smoke09_45357b3d29514 X-Spam-Summary: 2,0,0,0f2878c2c7de5ba5,d41d8cd98f00b204,daniel.vetter@ffwll.ch,:linux-kernel@vger.kernel.org::dri-devel@lists.freedesktop.org:daniel.vetter@ffwll.ch:jgg@ziepe.ca:chris@chris-wilson.co.uk:akpm@linux-foundation.org:rientjes@google.com:jglisse@redhat.com:mhocko@suse.com:christian.koenig@amd.com:gregkh@linuxfoundation.org:rppt@linux.vnet.ibm.com:jgg@mellanox.com:daniel.vetter@intel.com,RULES_HIT:41:152:355:379:541:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1431:1437:1515:1516:1518:1535:1541:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2559:2562:3138:3139:3140:3141:3142:3352:3865:3867:3870:3871:3874:4250:4321:5007:6261:6653:6742:7903:10004:10400:10450:10455:11026:11658:11914:12043:12296:12297:12438:12517:12519:12555:12895:12986:13069:13311:13357:13846:13894:13972:14096:14097:14181:14394:14659:14721:19904:19999:21080:21444:21451:21627:30054:30064,0,RBL:209.85.208.68:@ffwll.ch:.lbl8.mailshell.net-62.8.0.100 66.201.201.201,CacheIP:none,Bayesian:0.5,0. 5,0.5,Ne X-HE-Tag: smoke09_45357b3d29514 X-Filterd-Recvd-Size: 5043 Received: from mail-ed1-f68.google.com (mail-ed1-f68.google.com [209.85.208.68]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Mon, 26 Aug 2019 20:14:35 +0000 (UTC) Received: by mail-ed1-f68.google.com with SMTP id s15so28186504edx.0 for ; Mon, 26 Aug 2019 13:14:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=43MMkU2nAs7jtnMnw+TAIk5AMkJWGIqIB3w6SHg2dOA=; b=jWs+/c0l0gQqLqnonUguMXmcEgRnSUc9uFPRnBjVNs1Nfg/BKnOJH3T6iKhSC9eb6q dpAfCEkDXZ40OJ02lIV0O9i7OYhqlEmJrKDApByW1yfFG3TBOGtD29nnDadAmOX0w/3a ohtG4NM02aYnLMkZ4fScN1kWA5UKzPn2mVZA0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=43MMkU2nAs7jtnMnw+TAIk5AMkJWGIqIB3w6SHg2dOA=; b=i04T0ht5jY2Cj8+T3cYIt+pteC6ldAG8MyvXKR0pZtjDQ80MR3xvPLHM2kTrzxoekK +KHAlbg0h0iKExDU7sfGb/gPwfME/wl1q3GvTY1Q/OECYjIDQ2om/Bp4Bvy6Z4A7/TWM 6uNrplEltBuZ39W7pFte23VjZh/hlxxNMXjZqXI6BdgZkjMFtQMyuBhYpwUDQxUBQWym YivvCNnU8EiVvxfvov1HspCzSHMWClf3wCQmfwWBwGib9/VYbGm+/ch4KBT0KpLqp5ZI i29cz0mQdxfS5rRAtu8wwGKsT4ZHdjrtMZwKfbnNKDTl4Qc9exLKExHX7vjm6oElckpV dOLg== X-Gm-Message-State: APjAAAXTYidP/GBQvX6mcYdVap82JjJgYYRGgw4MwBg7Abw1XboHSRXG JWssDXmaolq675MEe2BekWzfpw== X-Google-Smtp-Source: APXvYqz1alL5dlGwBBuOouoL2tngfggzrmMx20gafiZ6V+aQeNinylzwLOpzJO1HhOF4TDXl6u3nsA== X-Received: by 2002:a50:d0cc:: with SMTP id g12mr19859322edf.201.1566850474445; Mon, 26 Aug 2019 13:14:34 -0700 (PDT) Received: from phenom.ffwll.local (212-51-149-96.fiber7.init7.net. [212.51.149.96]) by smtp.gmail.com with ESMTPSA id j25sm3000780ejb.49.2019.08.26.13.14.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2019 13:14:33 -0700 (PDT) From: Daniel Vetter To: LKML Cc: Linux MM , DRI Development , Daniel Vetter , Jason Gunthorpe , Chris Wilson , Andrew Morton , David Rientjes , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Michal Hocko , =?utf-8?q?Christian_K=C3=B6nig?= , Greg Kroah-Hartman , Mike Rapoport , Jason Gunthorpe , Daniel Vetter Subject: [PATCH 2/5] mm, notifier: Prime lockdep Date: Mon, 26 Aug 2019 22:14:22 +0200 Message-Id: <20190826201425.17547-3-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190826201425.17547-1-daniel.vetter@ffwll.ch> References: <20190826201425.17547-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: We want to teach lockdep that mmu notifiers can be called from direct reclaim paths, since on many CI systems load might never reach that level (e.g. when just running fuzzer or small functional tests). Motivated by a discussion with Jason. I've put the annotation into mmu_notifier_register since only when we have mmu notifiers registered is there any point in teaching lockdep about them. Also, we already have a kmalloc(, GFP_KERNEL), so this is safe. Cc: Jason Gunthorpe Cc: Chris Wilson Cc: Andrew Morton Cc: David Rientjes Cc: "Jérôme Glisse" Cc: Michal Hocko Cc: "Christian König" Cc: Greg Kroah-Hartman Cc: Daniel Vetter Cc: Mike Rapoport Cc: linux-mm@kvack.org Reviewed-by: Jason Gunthorpe Signed-off-by: Daniel Vetter --- mm/mmu_notifier.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c index d48d3b2abd68..0523555933c9 100644 --- a/mm/mmu_notifier.c +++ b/mm/mmu_notifier.c @@ -259,6 +259,13 @@ int __mmu_notifier_register(struct mmu_notifier *mn, struct mm_struct *mm) lockdep_assert_held_write(&mm->mmap_sem); BUG_ON(atomic_read(&mm->mm_users) <= 0); + if (IS_ENABLED(CONFIG_LOCKDEP)) { + fs_reclaim_acquire(GFP_KERNEL); + lock_map_acquire(&__mmu_notifier_invalidate_range_start_map); + lock_map_release(&__mmu_notifier_invalidate_range_start_map); + fs_reclaim_release(GFP_KERNEL); + } + mn->mm = mm; mn->users = 1;