Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4197204ybl; Tue, 20 Aug 2019 08:19:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBLpKKHWc/5NI8AMo3K1tu7+TBymVkLHWhNzUZl8iwqp0p9YaDknQQzZeH1MbpZQVp8OQz X-Received: by 2002:a62:7912:: with SMTP id u18mr32070165pfc.254.1566314399393; Tue, 20 Aug 2019 08:19:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566314399; cv=none; d=google.com; s=arc-20160816; b=AVKCuKC3ye+8+iqgU+PVH6pc11JCYcaWpADOpUWkpodQzEaqIeiGDNgfFseG04geDU ek0S5zG5991l4lcodDbJuspT0yLDPkTF7Aoy8kfZIZwdBF1I9o/afMSnbzSi39LXCKTD jOgczoZaeGkRLp02QdBRSPigSkq5ozk59EpzDw8sOecP0AENrl47Q+2Bb+6DyX9Qcj3b p2oQOPeFRodkl4crZ5E0sVrbawsvZg4yNEo6bJc5500oRFA/ZKojwRv1in8uJzspypCa QJ0XM6J0/7bSRaekTBSC9KYMfDHfR8y45NQ0LmdCBNPfPrfUnzClnEykCevUxxcCXGCQ /FxA== 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:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=WWDlGa28vuh6oyYZfImriVv5lKQQ+IIy5I7j/w5T4Gg=; b=rOnyS1L2unSI7rMqTNY8YlVnMGgdJ902pFBQSK5Q5SrIuN9K1sQ1WoVgxxcaDP3lWG YOSIlw8hTXOa2qzgErhffzuveANbDkGLBKfHi5R+MwvpKpt6PieOMT/Hy9TO2k0tXYsO p4zPKCHM/6qCsdwvprv/jbiFeLNFaGmyuZaLg1P9W1FsA8reJAVs2bE8QqxXLpZxLIf9 +zHBs1d+6+pzk+GeMIkxRqERwcjmuVQuZLJ10Yr1OPczIyu0I2R6e2+VUZ3Tq/nq3IwD 2ciNzjawdktStd4JhQLHR46L8QDwQjkMaoVQlQ7Ef83kxRzxhEWsaC2XDrcJ4NAcGILY E9XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=aYdoPW4M; 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 z10si197426pjp.1.2019.08.20.08.19.43; Tue, 20 Aug 2019 08:19:59 -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=@ffwll.ch header.s=google header.b=aYdoPW4M; 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 S1730106AbfHTPSQ (ORCPT + 99 others); Tue, 20 Aug 2019 11:18:16 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:37985 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729956AbfHTPSQ (ORCPT ); Tue, 20 Aug 2019 11:18:16 -0400 Received: by mail-ed1-f66.google.com with SMTP id r12so6735222edo.5 for ; Tue, 20 Aug 2019 08:18:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=WWDlGa28vuh6oyYZfImriVv5lKQQ+IIy5I7j/w5T4Gg=; b=aYdoPW4Mvo6YtazOhtnc4ypyhm+qnjOhOXk3ZP2Z58IiJkGhlIoOoy4vFST6kEbhnd V1wp+g3K8u0R1/NnJLA6jmPSQTsJFvmcgGqg9sx+I4Ybv+Atic0BqKdJYciuXoPn4GTu MVJmP+fAaX12IxRXdt8Yz7aCXLWYef4u5coho= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=WWDlGa28vuh6oyYZfImriVv5lKQQ+IIy5I7j/w5T4Gg=; b=Irj58nLHp37R5tBangVXBP2qFolYm4WBxSFJq+tpQ5neAAXjMY9HiCXApvp0bHuTHp 60B/CSmmpF3Lh72OKX2QA5LH02thAN31kjV4CoFBFQflSBD7XCUYcl1iICVKScXS+Uwt UkFOlJyxZDHyqrJszNXyQhC2Te+QdPTf34kx9qAwUIwWuAB7f+pXinn1Ew3oXX2NHnAW RjT8tOXI07P3TRGWNOhmLYxltpdYKyulpoLn1+sCPqYLdWMdqjn1EO/glqZ88p3TVMoZ 41jFxdDpcOmLSfUpGbD4LqTJgt+med+pD7SvOPwCk/FHtz1bvoOHH9lR4DuNY0Q3mZj9 g8zg== X-Gm-Message-State: APjAAAUXpInyQ3qq9Sak/q1cwrBTLxE4KWP7TvEXFYhEnC/IPPHwgvU1 jYHBHjDuQEmaNYEli+jU+v7n7A== X-Received: by 2002:a17:906:cc81:: with SMTP id oq1mr26923934ejb.124.1566314293557; Tue, 20 Aug 2019 08:18:13 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id oa21sm2669585ejb.60.2019.08.20.08.18.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2019 08:18:12 -0700 (PDT) Date: Tue, 20 Aug 2019 17:18:10 +0200 From: Daniel Vetter To: Jason Gunthorpe Cc: Daniel Vetter , LKML , Linux MM , DRI Development , Intel Graphics Development , Andrew Morton , Michal Hocko , David Rientjes , Christian =?iso-8859-1?Q?K=F6nig?= , =?iso-8859-1?B?Suly9G1l?= Glisse , Daniel Vetter Subject: Re: [PATCH 4/4] mm, notifier: Catch sleeping/blocking for !blockable Message-ID: <20190820151810.GG11147@phenom.ffwll.local> Mail-Followup-To: Jason Gunthorpe , LKML , Linux MM , DRI Development , Intel Graphics Development , Andrew Morton , Michal Hocko , David Rientjes , Christian =?iso-8859-1?Q?K=F6nig?= , =?iso-8859-1?B?Suly9G1l?= Glisse , Daniel Vetter References: <20190820081902.24815-1-daniel.vetter@ffwll.ch> <20190820081902.24815-5-daniel.vetter@ffwll.ch> <20190820133418.GG29246@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190820133418.GG29246@ziepe.ca> X-Operating-System: Linux phenom 5.2.0-2-amd64 User-Agent: Mutt/1.10.1 (2018-07-13) 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:34:18AM -0300, Jason Gunthorpe wrote: > 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. Ok, I'll ping Peter Z. for an ack, iirc he was involved. > Also, same comment as for the lockdep map, this needs to apply to the > non-blocking range_end also. Hm, I thought the page table locks we're holding there already prevent any sleeping, so would be redundant? But reading through code I think that's not guaranteed, so yeah makes sense to add it for invalidate_range_end too. I'll respin once I have the ack/nack from scheduler people. > 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. Thanks, Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch