From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC81BC4707F for ; Wed, 26 May 2021 00:36:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5BF4F6142D for ; Wed, 26 May 2021 00:36:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5BF4F6142D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 90BD96B0036; Tue, 25 May 2021 20:36:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8BB066B006E; Tue, 25 May 2021 20:36:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 734036B0070; Tue, 25 May 2021 20:36:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0142.hostedemail.com [216.40.44.142]) by kanga.kvack.org (Postfix) with ESMTP id 39CE46B0036 for ; Tue, 25 May 2021 20:36:24 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id C43558249980 for ; Wed, 26 May 2021 00:36:23 +0000 (UTC) X-FDA: 78181515846.27.E3C85DB Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf19.hostedemail.com (Postfix) with ESMTP id A632C90009E2 for ; Wed, 26 May 2021 00:36:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621989382; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/QQCbsE9nrJN8+nNyi5jRwRh60Z9Mhr/wKU96F+K8Wk=; b=RrLwR9QFzAsylhuTaeQA3ah9MQBoOoV/68/QF0VjN82MJvNKYm8Kgi8Zc8cl5RHtG592fx c2UR8xpFkCyt1GCmaRWWLGanzoUrf1TzwY3bomuZ+jfZDJrUdSLxzZ5IXHhEm0a21ILo3X K0v+hFtGS4f2CGwg5EufDxoB8qaSJNU= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-318-9ccNwqPFPMamvQw-K0nJ6A-1; Tue, 25 May 2021 20:36:21 -0400 X-MC-Unique: 9ccNwqPFPMamvQw-K0nJ6A-1 Received: by mail-qk1-f197.google.com with SMTP id o14-20020a05620a0d4eb02903a5eee61155so20865412qkl.9 for ; Tue, 25 May 2021 17:36:21 -0700 (PDT) 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:in-reply-to; bh=/QQCbsE9nrJN8+nNyi5jRwRh60Z9Mhr/wKU96F+K8Wk=; b=qOwU7AikgqPeejKrOVOtElRSoMeVXyyJ7D9fHrYicWtaDX1zntrK4U4rf8Lh1beie2 hlMwRbUkp9qJFwoITl502sD3nlLRYFjw2D8sTTaaSdsyyAIbCvlMiy1GGOFQcD6jmF50 EP09oi+7mFjo/VTNxoGS/t7ZLwJQW1rrL8ZUvmisFSq+i39B4yohZUI76J0tLmSbdTCT 8BTnOEDEJDMstqfphwUzW5RT2lekCnJjUcqhsCyORKukJbs6oWFDHWgYE28VtC5nYs0p eavI+ZT31H8pVflE27uNSeydy8ArDEYndzDQby5v0EmOZrAiCzBnIVwT8t5vCHq+I6G1 sXlA== X-Gm-Message-State: AOAM530HClscJJeJkGFzDwf+5hZM4SRCyqVXONsnl4bfmsieDq7v/SHp AqGCZpX/a02DYtRnFuY6VwJmqYNcHlL6rtAE/ZUUabEyepUqiFeKpkXnFYzXxgNeLIRcmS/qk+U 7pLTeCPvA1dE= X-Received: by 2002:ae9:edc9:: with SMTP id c192mr35574946qkg.312.1621989380820; Tue, 25 May 2021 17:36:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDlNUzm3gb3pSpCP2Aln5V5qEqEPNKVi6kDoAZ8azpepBiFQgjGScdd+xeQ75TMGddkTcnLw== X-Received: by 2002:ae9:edc9:: with SMTP id c192mr35574911qkg.312.1621989380538; Tue, 25 May 2021 17:36:20 -0700 (PDT) Received: from t490s (bras-base-toroon474qw-grc-72-184-145-4-219.dsl.bell.ca. [184.145.4.219]) by smtp.gmail.com with ESMTPSA id t13sm497164qtn.63.2021.05.25.17.36.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 17:36:19 -0700 (PDT) Date: Tue, 25 May 2021 20:36:18 -0400 From: Peter Xu To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mike Kravetz , Mike Rapoport , Axel Rasmussen , Andrea Arcangeli , Hugh Dickins , "Kirill A . Shutemov" , Jerome Glisse Subject: Re: [PATCH 2/6] mm/userfaultfd: Fix uffd-wp special cases for fork() Message-ID: References: <20210428225030.9708-1-peterx@redhat.com> <20210428225030.9708-3-peterx@redhat.com> <20210525171558.3b223a89c16bdf002f3e83cf@linux-foundation.org> MIME-Version: 1.0 In-Reply-To: <20210525171558.3b223a89c16bdf002f3e83cf@linux-foundation.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=RrLwR9QF; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf19.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com X-Stat-Signature: nafkpgnjumfqt1ahh4z1gfag85o514hk X-Rspamd-Queue-Id: A632C90009E2 X-Rspamd-Server: rspam02 X-HE-Tag: 1621989375-816147 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, May 25, 2021 at 05:15:58PM -0700, Andrew Morton wrote: > This run afoul of Alistair's "mm: Device exclusive memory access", > https://lkml.kernel.org/r/20210524132725.12697-8-apopple@nvidia.com > > `vma' is now undeclared. I think this? > > --- a/mm/memory.c~mm-userfaultfd-fix-uffd-wp-special-cases-for-fork-fix > +++ a/mm/memory.c > @@ -850,8 +850,8 @@ copy_nonpresent_pte(struct mm_struct *ds > * exclusive entries currently only support private writable > * (ie. COW) mappings. > */ > - VM_BUG_ON(!is_cow_mapping(vma->vm_flags)); > - if (try_restore_exclusive_pte(src_mm, src_pte, vma, addr)) > + VM_BUG_ON(!is_cow_mapping(dst_vma->vm_flags)); This one looks good, as both src_vma/dst_vma should have the same flags related to is_cow. > + if (try_restore_exclusive_pte(src_mm, src_pte, dst_vma, addr)) Should this be s/dst_vma/src_vma/ perhaps? Alistairs please correct me otherwise, as it tries to restore the pte for src mm not dst (the child). I haven't yet got time to look at the new series, planning to do it tomorrow maybe.. but I see that it's already queued in -mm. Andrew, we do have chance to go back if necessary, right? I haven't looked at the rest, but I think try_restore_exclusive_pte() can at least drop the *mm pointer as it's never used (even if we need, we've got vma->vm_mm too).. -- Peter Xu