Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp631429pxu; Thu, 7 Jan 2021 14:02:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzS4i8aUtwBgZ8YsP4zEQkq/RmllFqAo8F284KoR2xygH43hIO/kuOcsov9orfRcuJ0+sSa X-Received: by 2002:a17:907:98ec:: with SMTP id ke12mr611605ejc.554.1610056974644; Thu, 07 Jan 2021 14:02:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610056974; cv=none; d=google.com; s=arc-20160816; b=DRwaTOGlVmp0DL42e9GqrEHVUEso11teKoilCwz/4BaeIMvBn7dMZ7m93N2pJ6wz50 HkonsEy+u/Crx+4/EvBe43ceqR1beKwayN5yWf/cCVGDBzp5Sn0QSPfABLCLum/3bK6V Lgo3hAoicgzvzFte7641tv/PkmAXWKPM591xNCU8MF3+nDGX2tXiPyOqmVZlO+x55w18 on2KeZNkAQOqK+i3UM55M3++ts0oCs/jA0ngnnakOLjJbRdDtp7574ai+5Hpm4fzykdn XPWjS4p4VNpvXS11kLcMV1JSmtEXul30yfUcapzft5zfiD7iN3wTCCbbVU/KIkzfQ9qV /uOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=7yW+3vajLGH+6lau4Q23t7xOzJcMOieZX8ybzR0BAfk=; b=UZ1rBn05UQk1vyoM+zlu7WOacLshb00Gi3P37aJKpgLPViVuI+tMiNT/2rTRaSBXZ+ IqPZKPxEzj9eyMxJjvK+7sNcg2A8EBbJtUag86LJ29mLkFkwrUPv8mipWSgmD2IbRnxk aFhJl341PMOkscTlEt904wGTvFU7vln6Fwr2LTYP4v+Ull9jAbPfVH/e65YbEm3DPjg4 pgzyEFtk15+aBLzgacNcMmYhEJtY0VAxHkbdQoJ4n9AJ/D9CB+QXAU9cHZ1dUmw2rTwH 6ak71yG5wGkv+yGfQoT7RXzP5HQkqmhAxky6hMh0y+B3olbsYdpMZC76HUb5K7ahYx9W uN+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Ier3MNYK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cy28si2737785edb.535.2021.01.07.14.02.29; Thu, 07 Jan 2021 14:02:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Ier3MNYK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726864AbhAGWBg (ORCPT + 99 others); Thu, 7 Jan 2021 17:01:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726326AbhAGWBf (ORCPT ); Thu, 7 Jan 2021 17:01:35 -0500 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F414FC0612F4 for ; Thu, 7 Jan 2021 14:00:54 -0800 (PST) Received: by mail-lf1-x134.google.com with SMTP id o13so18274473lfr.3 for ; Thu, 07 Jan 2021 14:00:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7yW+3vajLGH+6lau4Q23t7xOzJcMOieZX8ybzR0BAfk=; b=Ier3MNYKecyOt6NN3c4HC+zbSyJNg5S/LMzTJRu9UzjfRfd4yCgJJajS1vHgj/pDZM duBpzqUn+N0s2xULB/3TJqG0SEFi4UIGolIVBAEOY5Uu5Yvl8eZwCESToBDTsyCUBfok eXLpLnkORwHroIjZ/lNheQln8l8l4nBN2sj8g= 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=7yW+3vajLGH+6lau4Q23t7xOzJcMOieZX8ybzR0BAfk=; b=fYhgZdzF+4q7UhB+pkArKI0+hngxuwhOC6R22dVprXh9ESMJHEqEJuCohobu54hGus MccH+AiFiKi82fZJmymfA8vtqlACLbeaItwCQkkr1n9O2lnSJ3zv0Wz0kGcNoTfcYUL/ KR/DMO1wnNrF3kTMjZnvtvqovfSqnwoXmu7KzHdmu1sRyxnMZF6AKIdN/cw/jSE+2wyk sxr0eTkBQCVyhc0UEEJOfn+jKSAEZodaUS5qkR3adDEGL6n9Rr8OxAV2IQ9wcpPcQDCw mwiSoQKeWBD8EYUaLn63JhdCxXpZ7T7qFGCwoHCRtkupINrDbpGlIN34M8Fgdt1Tkoo5 2m/A== X-Gm-Message-State: AOAM533FN2vQPrvWHKrW4K0ktVtDFwvegYKyPeltbZsqPiy8ysnJhJ4x F2UOvtspsvD4i/8ABb5tNl4+rS3CvMhaLg== X-Received: by 2002:a05:651c:200a:: with SMTP id s10mr200482ljo.492.1610056852941; Thu, 07 Jan 2021 14:00:52 -0800 (PST) Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com. [209.85.167.41]) by smtp.gmail.com with ESMTPSA id h21sm1581749lji.89.2021.01.07.14.00.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Jan 2021 14:00:52 -0800 (PST) Received: by mail-lf1-f41.google.com with SMTP id m12so18217567lfo.7 for ; Thu, 07 Jan 2021 14:00:51 -0800 (PST) X-Received: by 2002:a2e:6f17:: with SMTP id k23mr213194ljc.411.1610056851206; Thu, 07 Jan 2021 14:00:51 -0800 (PST) MIME-Version: 1.0 References: <20210107200402.31095-1-aarcange@redhat.com> <20210107200402.31095-3-aarcange@redhat.com> <4100a6f5-ab0b-f7e5-962f-ea1dbcb1e47e@nvidia.com> In-Reply-To: <4100a6f5-ab0b-f7e5-962f-ea1dbcb1e47e@nvidia.com> From: Linus Torvalds Date: Thu, 7 Jan 2021 14:00:35 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/2] mm: soft_dirty: userfaultfd: introduce wrprotect_tlb_flush_pending To: John Hubbard Cc: Andrea Arcangeli , Linux-MM , Linux Kernel Mailing List , Yu Zhao , Andy Lutomirski , Peter Xu , Pavel Emelyanov , Mike Kravetz , Mike Rapoport , Minchan Kim , Will Deacon , Peter Zijlstra , Hugh Dickins , "Kirill A. Shutemov" , Matthew Wilcox , Oleg Nesterov , Jann Horn , Kees Cook , Leon Romanovsky , Jason Gunthorpe , Jan Kara , Kirill Tkhai Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 7, 2021 at 1:53 PM John Hubbard wrote: > > > > > Now, I do agree that from a QoI standpoint, it would be really lovely > > if we actually enforced it. I'm not entirely sure we can, but maybe it > > would be reasonable to use that > > > > mm->has_pinned && page_maybe_dma_pinned(page) > > > > at least as the beginning of a heuristic. > > > > In fact, I do think that "page_maybe_dma_pinned()" could possibly be > > made stronger than it is. Because at *THAT* point, we might say "we > > What exactly did you have in mind, to make it stronger? I think the > answer is in this email but I don't quite see it yet... Literally just adding a " && page_mapcount(page) == 1" in there (probably best done inside page_maybe_dma_pinned() itself) > Direct IO pins, on the other hand, are more transient. We can probably live > without tagging Direct IO pages as FOLL_PIN. I think. Yes. I think direct-IO writes should be able to just do a transient GUP, and if it causes a COW fault that isn't coherent, that's the correct semantics, I think (ie the direct-IO will see the original data, the COW faulter will get it's own private copy to make changes to). I think pinning should be primarily limited to things that _require_ coherency (ie you pin because you're going to do some active two-way communication using that page) Does that match your thinking? Linus