Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1165720ybm; Tue, 21 May 2019 09:34:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyg+VyPxnfq0M2WIp+Mm3rL4KtJLVQUtV+TPDKzBej4VvQ1AWgx5O/1yaRgAvXpsXAOLULa X-Received: by 2002:aa7:8083:: with SMTP id v3mr24566802pff.135.1558456498496; Tue, 21 May 2019 09:34:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558456498; cv=none; d=google.com; s=arc-20160816; b=J8zt559qr4kbuyFyOARprPV5YCLoP3+6gPP51EPUxiJ44VuMGCi4jWUoZ6YVjE4ljv sTDHwTsYqMmrIeTBWhEKU5pdh1h/yhat8OWxV3ySrfDU0juI+fEChbNK5RB77dx8UT23 6rvebtFpzBybnLRXM8+rO4+bMjVbqsLSWfLi3ZywdHNDC16W99eH5e/6R00I6ZFRK2Gy 3xWCh0JK9EMVfsXiQ6wAqgiQD80qSUMbjgXnmaoJ1Le305SskKlgd4DJbaCkj+2/0E8A yC9mIvcxPXGfwL0K1+RIBf4AXDvYrc2qQY6emHGsgBLyfZhLcyPkRzVHe9uYyBIZjGIS EtPA== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=CyiKs5cfIEIKfXpx3b3DK4d29hAOIk0KdCLWxqGTyA0=; b=zhFzzMraGsb5WfhrqkANV/nyTLJAEfgzMJFzmnyeLiv+8yV9Sr/zpYcLkM+23GG6Vy ZIX56PG8sg2INf7i24+0/5YagJi4R6d0+e650X3dBux4SSGVGr6D5zyt9BM1StRvBoJB iSHhY5fkfZS4mUVj7OjOE5TJXaClX/tZ+hvsv2liss8Rt6oBtL+jgpQmitF8G557du5H 4koYv10VlhwmPP8bedaUSNwiQAdTuVLhTuX2DjgnXqGKiU4PkksdiInn6VaY4C+Khfu7 +tL9EkmD2JWnZBD6O+1JMlgRcCP4UOkBRz8ZqUe81zXhnZ0Ezu5Rg3ZEAx075V535QyF +gBQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m3si21469978pld.29.2019.05.21.09.34.43; Tue, 21 May 2019 09:34:58 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728899AbfEUQci (ORCPT + 99 others); Tue, 21 May 2019 12:32:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52130 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728055AbfEUQci (ORCPT ); Tue, 21 May 2019 12:32:38 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0D9CD5947D; Tue, 21 May 2019 16:32:30 +0000 (UTC) Received: from redhat.com (unknown [10.20.6.178]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B0CEB1001E6C; Tue, 21 May 2019 16:32:26 +0000 (UTC) Date: Tue, 21 May 2019 12:32:24 -0400 From: Jerome Glisse To: Daniel Vetter Cc: DRI Development , Intel Graphics Development , LKML , Linux MM , Chris Wilson , Andrew Morton , David Rientjes , Michal Hocko , Christian =?iso-8859-1?Q?K=F6nig?= , Greg Kroah-Hartman , Mike Rapoport , Daniel Vetter Subject: Re: [PATCH 4/4] mm, notifier: Add a lockdep map for invalidate_range_start Message-ID: <20190521163224.GE3836@redhat.com> References: <20190520213945.17046-1-daniel.vetter@ffwll.ch> <20190520213945.17046-4-daniel.vetter@ffwll.ch> <20190521154059.GC3836@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 21 May 2019 16:32:37 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 21, 2019 at 06:00:36PM +0200, Daniel Vetter wrote: > On Tue, May 21, 2019 at 5:41 PM Jerome Glisse wrote: > > > > On Mon, May 20, 2019 at 11:39:45PM +0200, Daniel Vetter wrote: > > > This is a similar idea to the fs_reclaim fake lockdep lock. It's > > > fairly easy to provoke a specific notifier to be run on a specific > > > range: Just prep it, and then munmap() it. > > > > > > A bit harder, but still doable, is to provoke the mmu notifiers for > > > all the various callchains that might lead to them. But both at the > > > same time is really hard to reliable hit, especially when you want to > > > exercise paths like direct reclaim or compaction, where it's not > > > easy to control what exactly will be unmapped. > > > > > > By introducing a lockdep map to tie them all together we allow lockdep > > > to see a lot more dependencies, without having to actually hit them > > > in a single challchain while testing. > > > > > > Aside: Since I typed this to test i915 mmu notifiers I've only rolled > > > this out for the invaliate_range_start callback. If there's > > > interest, we should probably roll this out to all of them. But my > > > undestanding of core mm is seriously lacking, and I'm not clear on > > > whether we need a lockdep map for each callback, or whether some can > > > be shared. > > > > I need to read more on lockdep but it is legal to have mmu notifier > > invalidation within each other. For instance when you munmap you > > might split a huge pmd and it will trigger a second invalidate range > > while the munmap one is not done yet. Would that trigger the lockdep > > here ? > > Depends how it's nesting. I'm wrapping the annotation only just around > the individual mmu notifier callback, so if the nesting is just > - munmap starts > - invalidate_range_start #1 > - we noticed that there's a huge pmd we need to split > - invalidate_range_start #2 > - invalidate_reange_end #2 > - invalidate_range_end #1 > - munmap is done Yeah this is how it looks. All the callback from range_start #1 would happens before range_start #2 happens so we should be fine. > > But if otoh it's ok to trigger the 2nd invalidate range from within an > mmu_notifier->invalidate_range_start callback, then lockdep will be > pissed about that. No that would be illegal for a callback to do that. There is no existing callback that would do that at least AFAIK. So we can just say that it is illegal. I would not see the point. > > > Worst case i can think of is 2 invalidate_range_start chain one after > > the other. I don't think you can triggers a 3 levels nesting but maybe. > > Lockdep has special nesting annotations. I think it'd be more an issue > of getting those funneled through the entire call chain, assuming we > really need that. I think we are fine. So this patch looks good. Reviewed-by: J?r?me Glisse