Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4068729ybl; Tue, 20 Aug 2019 06:35:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEyzRiTAt5s+Y7YFq7gIq3M1B+DPeru2rG+eJkAL24YsAlG8oK0lrl0lNAAT2Zj0jdJsMJ X-Received: by 2002:a17:90a:c20f:: with SMTP id e15mr25870421pjt.123.1566308148516; Tue, 20 Aug 2019 06:35:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566308148; cv=none; d=google.com; s=arc-20160816; b=f5QDog9UwzJGhgHSaXKbXIQI7IhB7gjibPBpWa4WqVV/qIrTes+CzVAvVO6V4Z9PpT gG/WIeP4PgmZtWwgaxMIJ4vGALJAAefA1tHjlsflFyVykYjx4+AVYXpHopaGyTQttrGI 46/MofuKWh0X1Ja/AizwXMWOY5hcJ5/1y5swW9TbpW/Rtz4b3HDXLDLrgZu8+O4BWsTL jQaPZnap/6+cAPOeor89QIgU6FcCISl1HipEjXbBxn11WpjaqRb4yN2BvlYbeXqdOY99 ndpAClJqKzcfLMpVvOQ8v/it9JoSbKSk6b7KZVYTmk/MgO86hm3ZwRgRpyFGfD+KElRn 6jng== 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:dkim-signature; bh=xkla8yZpkWsn7BQhjD5NVqgPEeC/v8sq4Q+tGQW7NAA=; b=OQXrjdmjVwkjHvQhhBh8YGufzZt9n2qAxCPLs/FuI2+KoTgSN+R5wnQgHha7DwWV+9 AJNnKwukEGKDArWVmeKexs1Lm9aQWD2s/MA/7xfZnApVjKm9yJbx5762mov+Zq+8SW7A SC9Fg+Z1yCE69y/MDbF8RePSdbv/fc0D8K1y57qLjP80q4oNkf+28IhLfHfIDcqP77GJ m0zCLKBcbRUAVp7aG5aQLbKUwDhUzwCHQMq7MYaUtxHoELRGAaN7DE2EPwa783DOjnpq hFDINllLwW6JhR0iD+oN2gIk8xeDIJZzCWGn5kKC8GPVmEhS1dOyX3KVYJDzIJwQblko zANg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=EPfWbdLD; 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 g8si13138190pfk.201.2019.08.20.06.35.32; Tue, 20 Aug 2019 06:35:48 -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=pass header.i=@ziepe.ca header.s=google header.b=EPfWbdLD; 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 S1730034AbfHTNeU (ORCPT + 99 others); Tue, 20 Aug 2019 09:34:20 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:34292 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729949AbfHTNeU (ORCPT ); Tue, 20 Aug 2019 09:34:20 -0400 Received: by mail-qt1-f194.google.com with SMTP id q4so6000439qtp.1 for ; Tue, 20 Aug 2019 06:34:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=xkla8yZpkWsn7BQhjD5NVqgPEeC/v8sq4Q+tGQW7NAA=; b=EPfWbdLDIn9vYVNO92ekXg+Aqpk0N5AXlzR+0ptOOJgqHA7T2kwzvvGoWZuIvAfr/3 0teKv2tf6kXm8zvOpJTZOgVyZgQEWvFiIxWu2cHJekpwmLDQC47QSg31UJZq5zb6Zu2R 2IMDu+hVU12h9dIC7m/oQKnPEg4M1wIExBMafHRztS8uRKUSSBuZoFGd+3SaDkI6kpo9 vvV6E/GjnRwfaJI3KJtUSJ1QIWuQ+GlNO4j01Dn9gcdYYIUQ/8xiMeu1LW4OuDyU/Q+B Nol5QsZWTj23vCJ3rkWepIYMWSEfA+1YPrUaB+2ZG3+Rn8BlPBDbWfse0wb2WYK0ODxI VHsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=xkla8yZpkWsn7BQhjD5NVqgPEeC/v8sq4Q+tGQW7NAA=; b=GjRJPDZX+i1pOoomiBbK+ksGNVFlUwJ91xwTXGCoTSw0lQ+Md7623VBz7Db6lyzdrX LtekCSJnd+99YqpaxFpqwgriAyg1fsR/Mlqn6IK22wecbXm5guQDQG7ipIaiy+RZjAC1 G5ucXfbtiXi9HqtboH53ybOTGFWuS9ihGME9FzFocbVQEPYGE3tpYnz+xBLv8qQRVb25 FLu2e0dYU2QLilUEO5TeyWRfKFoUFcCBdf6w0vQSUxHFFbn/GjlqrPhQStnDJB8EoiBF SPPyk0n7Mn2KlK3Ov2z6GwrHUdZYWLXsfMegiG+74ziCzQUbfOfyjGutmCpbCS4VXZbx ZA+g== X-Gm-Message-State: APjAAAWYGEgjHD62ouoMVBxYEShb1CJl9xE7NxXyw8Km2jDukro08ygp wOH9RCwrgp4rHvhSbLKQpcElJQ== X-Received: by 2002:ac8:53d3:: with SMTP id c19mr26516722qtq.225.1566308058877; Tue, 20 Aug 2019 06:34:18 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-55-100.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.55.100]) by smtp.gmail.com with ESMTPSA id a23sm2037193qtj.5.2019.08.20.06.34.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 20 Aug 2019 06:34:18 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1i04HC-0000ct-4x; Tue, 20 Aug 2019 10:34:18 -0300 Date: Tue, 20 Aug 2019 10:34:18 -0300 From: Jason Gunthorpe To: Daniel Vetter Cc: LKML , Linux MM , DRI Development , Intel Graphics Development , Andrew Morton , Michal Hocko , David Rientjes , Christian =?utf-8?B?S8O2bmln?= , =?utf-8?B?SsOpcsO0bWU=?= Glisse , Daniel Vetter Subject: Re: [PATCH 4/4] mm, notifier: Catch sleeping/blocking for !blockable Message-ID: <20190820133418.GG29246@ziepe.ca> References: <20190820081902.24815-1-daniel.vetter@ffwll.ch> <20190820081902.24815-5-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190820081902.24815-5-daniel.vetter@ffwll.ch> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 20, 2019 at 10:19:02AM +0200, Daniel Vetter wrote: > We need to make sure implementations don't cheat and don't have a > possible schedule/blocking point deeply burried where review can't > catch it. > > I'm not sure whether this is the best way to make sure all the > might_sleep() callsites trigger, and it's a bit ugly in the code flow. > But it gets the job done. > > Inspired by an i915 patch series which did exactly that, because the > rules haven't been entirely clear to us. > > v2: Use the shiny new non_block_start/end annotations instead of > abusing preempt_disable/enable. > > v3: Rebase on top of Glisse's arg rework. > > v4: Rebase on top of more Glisse rework. > > Cc: Jason Gunthorpe > Cc: Andrew Morton > Cc: Michal Hocko > Cc: David Rientjes > Cc: "Christian König" > Cc: Daniel Vetter > Cc: "Jérôme Glisse" > Cc: linux-mm@kvack.org > Reviewed-by: Christian König > Reviewed-by: Jérôme Glisse > Signed-off-by: Daniel Vetter > mm/mmu_notifier.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c > index 538d3bb87f9b..856636d06ee0 100644 > +++ b/mm/mmu_notifier.c > @@ -181,7 +181,13 @@ int __mmu_notifier_invalidate_range_start(struct mmu_notifier_range *range) > id = srcu_read_lock(&srcu); > hlist_for_each_entry_rcu(mn, &range->mm->mmu_notifier_mm->list, hlist) { > if (mn->ops->invalidate_range_start) { > - int _ret = mn->ops->invalidate_range_start(mn, range); > + int _ret; > + > + if (!mmu_notifier_range_blockable(range)) > + non_block_start(); > + _ret = mn->ops->invalidate_range_start(mn, range); > + if (!mmu_notifier_range_blockable(range)) > + non_block_end(); If someone Acks all the sched changes then I can pick this for hmm.git, but I still think the existing pre-emption debugging is fine for this use case. Also, same comment as for the lockdep map, this needs to apply to the non-blocking range_end also. Anyhow, since this series has conflicts with hmm.git it would be best to flow through the whole thing through that tree. If there are no remarks on the first two patches I'll grab them in a few days. Regards, Jason