From patchwork Tue Aug 20 08:19:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11103271 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 A6399112C for ; Tue, 20 Aug 2019 08:19:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 71BDF23AC8 for ; Tue, 20 Aug 2019 08:19:16 +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="H3IaTIIK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 71BDF23AC8 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 718F46B000E; Tue, 20 Aug 2019 04:19:13 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 67E246B0010; Tue, 20 Aug 2019 04:19:13 -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 5719C6B0269; Tue, 20 Aug 2019 04:19:13 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0162.hostedemail.com [216.40.44.162]) by kanga.kvack.org (Postfix) with ESMTP id 2EB0E6B000E for ; Tue, 20 Aug 2019 04:19:13 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id D91996C2D for ; Tue, 20 Aug 2019 08:19:12 +0000 (UTC) X-FDA: 75842106144.18.leg41_1626500992f0d X-Spam-Summary: 2,0,0,978cbe459e45f00e,d41d8cd98f00b204,daniel.vetter@ffwll.ch,:linux-kernel@vger.kernel.org::dri-devel@lists.freedesktop.org:intel-gfx@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: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:5007:6261:6653:6742:7903:10004:10400:10450:10455:11026:11658:11914:12043:12296:12297:12438:12517:12519:12555:12895:13069:13311:13357:13846:13894:13972:14096:14097:14181:14394:14659:14721:19904:19999:21080:21444:21451:21627:30054:30055:30064,0,RBL:209.85.208.65:@ffwll.ch:.lbl8.mailshell.net-62.8.0.100 66.201.201.201,CacheIP:none,Bayes ian:0.5, X-HE-Tag: leg41_1626500992f0d X-Filterd-Recvd-Size: 5053 Received: from mail-ed1-f65.google.com (mail-ed1-f65.google.com [209.85.208.65]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Tue, 20 Aug 2019 08:19:12 +0000 (UTC) Received: by mail-ed1-f65.google.com with SMTP id x19so5328226eda.12 for ; Tue, 20 Aug 2019 01:19:11 -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=HRs5HpBA3qSqFe5qnt1LL6h0B7I2hzSM+r7A2DpfdeU=; b=H3IaTIIKcnZxd8XaCn8QCH9mcrNGjOx/ak2ybd66H0ki331clYHFNQzkO0bKWcuXsr Mq6+jU/jrdI7HQWeHyhaTDSfFkUDTPsmPa++H2SDWnl1ZAvHNh4YpUIn825O4i0/plh8 z09eHCYqJKERfRBDZg/Pr+cpNjod1qv2vMJ8w= 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=HRs5HpBA3qSqFe5qnt1LL6h0B7I2hzSM+r7A2DpfdeU=; b=MOly1xQAuQ9lDXdmc9hCk6E0Z9YmQE0sxTdzCIRwcnIoBEIcyzBKRNuNRfh70TDBn7 JukuaxudTwHoDjTBDn7C/mG2IFnmT6DtmO1teyuAK7wHLM47PyJa5TWO2O5VOSzOzkG+ /Oxof98NBvVvjfXXLcf4e2BFtyoCIeAzEjrGa+qirMS82FDEX71csfERYpOAVR7Qc/16 PU/uX+o9azSLHeBj2FQfTEJUtfzP91IPUZl7sbXD69h12hcFXb9d3CVWG0PfGcgc4ElK WwnjzOkjF1nTuRa3cvCHL9UIgqqud5Xol1202xY35H2viXxL1Ic5K906t9T7+SWy3d4N GnaA== X-Gm-Message-State: APjAAAXdWYrIFa65+5DnHWWBvMDoRBlokeZ+4XC9Eb7GApIOLH9+2OCY c++gCkeTqRNKFBZ50FK/0skOPQ== X-Google-Smtp-Source: APXvYqzwk/VVcEGb/uEJb+MjHFqWnLqThVvSK3PFeDiC0L0cxhC/+XJhzn783w4kD3r5dKVWby8hcQ== X-Received: by 2002:aa7:c498:: with SMTP id m24mr12784881edq.277.1566289150887; Tue, 20 Aug 2019 01:19:10 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id fj15sm2469623ejb.78.2019.08.20.01.19.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2019 01:19:10 -0700 (PDT) From: Daniel Vetter To: LKML Cc: Linux MM , DRI Development , Intel Graphics 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 , Daniel Vetter Subject: [PATCH 2/4] mm, notifier: Prime lockdep Date: Tue, 20 Aug 2019 10:19:00 +0200 Message-Id: <20190820081902.24815-3-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20190820081902.24815-1-daniel.vetter@ffwll.ch> References: <20190820081902.24815-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 Signed-off-by: Daniel Vetter Reviewed-by: Jason Gunthorpe --- mm/mmu_notifier.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c index d12e3079e7a4..538d3bb87f9b 100644 --- a/mm/mmu_notifier.c +++ b/mm/mmu_notifier.c @@ -256,6 +256,13 @@ static int do_mmu_notifier_register(struct mmu_notifier *mn, 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); + } + ret = -ENOMEM; mmu_notifier_mm = kmalloc(sizeof(struct mmu_notifier_mm), GFP_KERNEL); if (unlikely(!mmu_notifier_mm))