Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp649130ybl; Wed, 21 Aug 2019 03:29:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqxObw8Bn6enW0jLOI/Sup3EfJVeJ1oFHsDfDaO9C4IL9JdB0Vjik8Tyy5OxdENQiUiMR0Eh X-Received: by 2002:a63:1e06:: with SMTP id e6mr9030826pge.185.1566383397124; Wed, 21 Aug 2019 03:29:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566383397; cv=none; d=google.com; s=arc-20160816; b=KEh7xcEtho9v21nu+Z6tfF+J/1Qi/MHDXEnBd7QhQ7ROYVlfEekPKAEJ8bwVwUO+k9 FhkF/DMJt8Etz9SJMEEQEz194Ig2mKqmMI/LW2tBivbo7BDOfKvN58CU7Rzzr8mgdpAI m4NUpmwF0YyKnh2oV61LrTQG0+r2VX4MA2IiESMQ3g/iiOdqaljTcjZF2kKAjkQ9KWt0 yCR8wShpnU7X0ZK1TA34eIdGWJhzpljJsjwPBc4fH8jxFPYA99V2mddRkc9lb77jgiAU VsAbyWTD1pzbI0fDcbPetupQcnL09BfijjgT8ahAhCIGwKYac7F7WfyLbOInhDqoPD4u AZcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=jrMnd9Dw4BIbl105NPubLNKMx+vt1yB2bVw1jRY/PoI=; b=KaUvf4oiPqUZGXlevxh8U0Lt1GyZmB4Vk8Gp685jV93dyHpcV8VDdUQ49CCbpMjNbD Up6IBU2DdQOV+sGFzillLPKeBDQJW+EATfyoWqZiji18DBK43WYi1ytVcLNrHklko2BW axIV6FrXCiawSc8PBh+z6uwSRLN0/h0q5tuBaWSIs/C8EPXFGcGFeDk6Lf4mECM6iVnl Bq0HF33oybsAp2gc2fUwf8O3PmzxVxcpLn4RKeYjQfMBvO28u4bYvz/WcTYCFwx9qXR2 xTqXNJuj6YA6qT29fBun9KHTJPCuGJZe6gyGTV6UA+hasQnHKxx8f8sEZe/gINzNbmM/ rNSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=RWdDCknA; 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 y16si13276278plp.70.2019.08.21.03.29.42; Wed, 21 Aug 2019 03:29:57 -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=@ffwll.ch header.s=google header.b=RWdDCknA; 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 S1727017AbfHUJeT (ORCPT + 99 others); Wed, 21 Aug 2019 05:34:19 -0400 Received: from mail-oi1-f194.google.com ([209.85.167.194]:41393 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726239AbfHUJeT (ORCPT ); Wed, 21 Aug 2019 05:34:19 -0400 Received: by mail-oi1-f194.google.com with SMTP id g7so1085290oia.8 for ; Wed, 21 Aug 2019 02:34:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jrMnd9Dw4BIbl105NPubLNKMx+vt1yB2bVw1jRY/PoI=; b=RWdDCknAmMlPEQ9u6yUMbaKojAWU9G+zSGrTlsA+5Fkb6D5PPhV3wXAdyHPQHxX3o2 vq6qCQtWx7WMlW8Wcwk/fdYFN48LUhyp1O9fbzd3V40UTaKzdmNXguxv3DgFH0nqPlyM j37eomYfP4oBSb5y02UJPiGrztvAL9IJTDwk4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jrMnd9Dw4BIbl105NPubLNKMx+vt1yB2bVw1jRY/PoI=; b=F8JC6JCUJii1/1AHV438y3COkjhbqhYPXjGhSZOOGC8UyzyItV0NMebcKE4UHs4dHH +TGgo0VTH+ySWM1/E6PkMIj97snDDSV67FKXzxopBvwmyjro1oqwT1ifDR64bCb1ozyI mEQaa2K/vn7aYkVQ5uH6aUAzhFjupFSpw2Xi+Qu/DInRyoVpYFpze1hKUeI2AmPibktx tIr5k8Hsy5W9h9qCzYWpiSFqF6uP16b/FVE/ayDKDHpJejHpq4YXs8votXCrBYwuTIRr j28XCPGs4HYasBR7KGOLnE8USH0QUS6PLDic+Iza212b5t/tSIGI5dIumw+FoIJvJH+V Jycw== X-Gm-Message-State: APjAAAVG9Fl8koXd2okhFURv7tuu0jXY486g4G8Za+qYMFL68cJ2/x95 z9iQTN6boDlIj15WD8RYbfO4F5Isgm7wQ5HM+mzlbA== X-Received: by 2002:aca:da08:: with SMTP id r8mr2776211oig.101.1566380058381; Wed, 21 Aug 2019 02:34:18 -0700 (PDT) MIME-Version: 1.0 References: <20190820081902.24815-1-daniel.vetter@ffwll.ch> <20190820081902.24815-5-daniel.vetter@ffwll.ch> <20190820133418.GG29246@ziepe.ca> <20190820151810.GG11147@phenom.ffwll.local> <20190820152712.GH29246@ziepe.ca> In-Reply-To: <20190820152712.GH29246@ziepe.ca> From: Daniel Vetter Date: Wed, 21 Aug 2019 11:34:06 +0200 Message-ID: Subject: Re: [PATCH 4/4] mm, notifier: Catch sleeping/blocking for !blockable To: Jason Gunthorpe Cc: LKML , Linux MM , DRI Development , Intel Graphics Development , Andrew Morton , Michal Hocko , David Rientjes , =?UTF-8?Q?Christian_K=C3=B6nig?= , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Daniel Vetter Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 21, 2019 at 9:33 AM Jason Gunthorpe wrote: > > On Tue, Aug 20, 2019 at 05:18:10PM +0200, Daniel Vetter wrote: > > > > 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? > > AFAIK no. All callers of invalidate_range_start/end pairs do so a few > lines apart and don't change their locking in between - thus since > start can block so can end. > > Would love to know if that is not true?? Yeah I reviewed them, I think I mixed up a discussion I had a while ago with Jerome. It's a bit tricky to follow in the code since in some places ->invalidate_range and ->invalidate_range_end seem to be called from the same place, in others not at all. > Similarly I've also been idly wondering if we should add a > 'might_sleep()' to invalidate_rangestart/end() to make this constraint > clear & tested to the mm side? Hm, sounds like a useful idea. Since in general you wont test with mmu notifiers, but they could happen, and then they will block for at least some mutex usually. I'll throw that as an idea on top for the next round. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch