Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3157865pxk; Tue, 15 Sep 2020 11:31:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDY+EGElQQavmlgLXhIn6kRdIiuOSBekO7ZwUJPBb+g8QdwU454iB8IIvmsLKJHGCK/9fd X-Received: by 2002:aa7:cf93:: with SMTP id z19mr24419116edx.187.1600194667904; Tue, 15 Sep 2020 11:31:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600194667; cv=none; d=google.com; s=arc-20160816; b=PR+lPma7jMJzcEm1szgPzcmmHeM6EltWpYGljIovS2w2GXpPgVtSp36mpV6qC/9S+i pdlz58CNyPEVtqfGq78240VMw4yATlaM4MdQxBaubFFtHGw9ImMemy8uiK/CeThb/Tmb F6cgLQHW4aS3B4lroXqIANS/lPQfy/hK5eM+olH/eRnbh9S8zcvMCXcLp/40iEJPTFhh Vc1WBEpOhLcaFNfnjLWwWv9/eaHiAW8ERIMnc33oXcPg8lJRkCDGidgibXdi3t5FDS8X 8RFW1hwtmVtGVdbp/7K1mLDUHeVVYuvfb1QayDHSfZngcv6NNwNYWtpxxp9P310ErJMP 33xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=QH0oevRAXAfKjkr8xwGWq7ufd7Zmd6cGXZiCflHDesA=; b=b02k8hIj+z2dBHMdxcoZdEQxEvnu6DB/1uCQGMD+TPV41vaAqXEHvnSm5fScUEgXht YQw/8+alaiCANZ0pNIIMpTthNQoPANnD7CHZVtqoy3QU9788kOtxIVKSUTwCVVICZiZO jp80VicuucjqqSp8TwjvoDLxXKfw1PiwTy4iSLJDLf+0OPabj310hu2062s18QAJRM1/ 9VrebRSBWbAf2T/ltlk+P1D2n0g1kVdKnQh0eZKyTF5CsML/chpW3sQ7vkDvkNMWuVaF +U9RkK20v5iAPIL+mUye1UMmRPXUVSv+SzthStUtcz+YwmWNwMk+Ov7Ub2qSTJvYtYlC 70FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=a5D8w8T9; 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 r26si10782366eja.484.2020.09.15.11.30.45; Tue, 15 Sep 2020 11:31:07 -0700 (PDT) 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=@ziepe.ca header.s=google header.b=a5D8w8T9; 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 S1728040AbgIOS3l (ORCPT + 99 others); Tue, 15 Sep 2020 14:29:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727431AbgIOS3g (ORCPT ); Tue, 15 Sep 2020 14:29:36 -0400 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74B7AC06174A for ; Tue, 15 Sep 2020 11:29:36 -0700 (PDT) Received: by mail-io1-xd44.google.com with SMTP id j2so5197669ioj.7 for ; Tue, 15 Sep 2020 11:29:36 -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:in-reply-to; bh=QH0oevRAXAfKjkr8xwGWq7ufd7Zmd6cGXZiCflHDesA=; b=a5D8w8T9XU1Z5Sg3El875tpdfLEgvabG4sAGeB37Wr1WfMICFJ1rqI8EuyKuvKFyqh ctfGnliM0miH9CluA8q6wGyqcv8uoRUwKJv4avYtqpZD4YJzJvlGvHh7shIPeYLjqfgE YWl+Ati9kVlc7YjQcKkn5lzOIe8Uj0vt1ho1m5QvYhc2Zg+nCk6WumnncLPwfApQaP1F yG2TXV8o1w0tAlJFQs0tVe0boOSeXBXHzCsx258y4QSFvQAYGV8CAz/85XFxMjNvjqXu Xw8I17Y/orn+PMg2qFeslypqX86SNsS23BXpBGNhN7R1tKvT2A/i8kTfmSrXRM2T9Nyb U5og== 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=QH0oevRAXAfKjkr8xwGWq7ufd7Zmd6cGXZiCflHDesA=; b=lQswLdshwSNkrdAjWmzVE2Cf7ytCCQFwVKm6yopCK8eDzQK2jdllC/ZDb2qiRrZ3Rk flfNO2vmt8hDWKRl0MZ5mccplSFOG1iRxnLp+WhE0UeTeGkXYmjyYnDBHtWXuTruIO2z mhJ20p71JoFJa1262wvtH61SFefnpe+K9/jule885GZglkuf8ybHdzcj0pA4MBR3u45O o/qh0SLJxqrNI11ORnC9CI/YHvbcikRd7PAcFf0yzCE8i22eVkIf5f75jwpc33JRMxbd lD2fYp+1jeusYuAqqhgZYP8tLBcrqhRSBUMHnocpLrBkUAYt9ZSIDvrqkrzMM3p9EDMg 3pCw== X-Gm-Message-State: AOAM530Rz34pa+H1X+8f35cUWVXhmELo3+DqITDsTe/uTDPrpc3kCzOa N7AYa3mmEUzmLpWuqgKfrVI6UQ== X-Received: by 2002:a05:6638:24c1:: with SMTP id y1mr18589650jat.119.1600194575776; Tue, 15 Sep 2020 11:29:35 -0700 (PDT) Received: from ziepe.ca ([206.223.160.26]) by smtp.gmail.com with ESMTPSA id p17sm9234963ilj.81.2020.09.15.11.29.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2020 11:29:34 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kIFht-006eMK-OT; Tue, 15 Sep 2020 15:29:33 -0300 Date: Tue, 15 Sep 2020 15:29:33 -0300 From: Jason Gunthorpe To: Peter Xu Cc: Linus Torvalds , Leon Romanovsky , Linux-MM , Linux Kernel Mailing List , "Maya B . Gokhale" , Yang Shi , Marty Mcfadden , Kirill Shutemov , Oleg Nesterov , Jann Horn , Jan Kara , Kirill Tkhai , Andrea Arcangeli , Christoph Hellwig , Andrew Morton Subject: Re: [PATCH 1/4] mm: Trial do_wp_page() simplification Message-ID: <20200915182933.GM1221970@ziepe.ca> References: <20200821234958.7896-2-peterx@redhat.com> <20200914143829.GA1424636@nvidia.com> <20200914183436.GD30881@xz-x1> <20200914211515.GA5901@xz-x1> <20200914225542.GO904879@nvidia.com> <20200914232851.GH1221970@ziepe.ca> <20200915145040.GA2949@xz-x1> <20200915160553.GJ1221970@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200915160553.GJ1221970@ziepe.ca> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 15, 2020 at 01:05:53PM -0300, Jason Gunthorpe wrote: > On Tue, Sep 15, 2020 at 10:50:40AM -0400, Peter Xu wrote: > > On Mon, Sep 14, 2020 at 08:28:51PM -0300, Jason Gunthorpe wrote: > > > Yes, this stuff does pin_user_pages_fast() and MADV_DONTFORK > > > together. It sets FOLL_FORCE and FOLL_WRITE to get an exclusive copy > > > of the page and MADV_DONTFORK was needed to ensure that a future fork > > > doesn't establish a COW that would break the DMA by moving the > > > physical page over to the fork. DMA should stay with the process that > > > called pin_user_pages_fast() (Is MADV_DONTFORK still needed with > > > recent years work to GUP/etc? It is a pretty terrible ancient thing) > > > > ... Now I'm more confused on what has happened. > > I'm going to try to confirm that the MADV_DONTFORK is actually being > done by userspace properly, more later. It turns out the test is broken and does not call MADV_DONTFORK when doing forks - it is an opt-in it didn't do. It looks to me like this patch makes it much more likely that the COW break after page pinning will end up moving the pinned physical page to the fork while before it was not very common. Does that make sense? Given that the tests are wrong it seems like broken userspace, however, it also worked reliably for a fairly long time. I'm waiting for confirmation that adding the missing MADV_DONTFORKS restores all tests to success even with this patch. Regards, Jason