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=-7.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 90A48C9DD08 for ; Tue, 27 Oct 2020 00:35:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 31501216FD for ; Tue, 27 Oct 2020 00:35:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="NR7kcevs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 31501216FD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 459366B005C; Mon, 26 Oct 2020 20:35:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 408396B005D; Mon, 26 Oct 2020 20:35:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2F9446B006E; Mon, 26 Oct 2020 20:35:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0063.hostedemail.com [216.40.44.63]) by kanga.kvack.org (Postfix) with ESMTP id 04B416B005C for ; Mon, 26 Oct 2020 20:35:09 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A09681EE6 for ; Tue, 27 Oct 2020 00:35:09 +0000 (UTC) X-FDA: 77415835938.03.crush16_3806b8e27277 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 2A8EA28A4EE for ; Tue, 27 Oct 2020 00:35:09 +0000 (UTC) X-HE-Tag: crush16_3806b8e27277 X-Filterd-Recvd-Size: 3728 Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com [216.228.121.65]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Tue, 27 Oct 2020 00:35:08 +0000 (UTC) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Mon, 26 Oct 2020 17:34:46 -0700 Received: from [10.2.57.113] (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 27 Oct 2020 00:35:06 +0000 Subject: Re: [PATCH 2/2] mm: prevent gup_fast from racing with COW during fork To: Jason Gunthorpe CC: , Andrea Arcangeli , Andrew Morton , Aneesh Kumar K.V , Christoph Hellwig , Hugh Dickins , Jan Kara , Jann Horn , Kirill Shutemov , Kirill Tkhai , Leon Romanovsky , Linux-MM , "Michal Hocko" , Oleg Nesterov , Peter Xu , Linus Torvalds References: <2-v1-281e425c752f+2df-gup_fork_jgg@nvidia.com> <32a38d92-6ecc-243b-77be-8f1ea0792334@nvidia.com> <20201026234952.GD1523783@nvidia.com> From: John Hubbard Message-ID: <729699ba-a6a2-4081-092f-cae6f2c5657b@nvidia.com> Date: Mon, 26 Oct 2020 17:35:06 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20201026234952.GD1523783@nvidia.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1603758886; bh=7o9fGwEvHiJDgecjqaND2PAnsgF+zH+zGq4sHgulNm4=; h=Subject:To:CC:References:From:Message-ID:Date:User-Agent: MIME-Version:In-Reply-To:Content-Type:Content-Language: Content-Transfer-Encoding:X-Originating-IP:X-ClientProxiedBy; b=NR7kcevsshUhQeY4sqq9LtBC5zCZAMYlv6CLWOFCClmLEWrqi2EqHUSYMOQ8LM9K5 1/2C8BOdQGUPcQhAgtrjV2kVlle2CF74s4DLYRWgjV6JquTelG/6GVc3VEYRKMQOV+ 02ZeVOwpBhNRsZo84XP33jcUVkV4b2EzY6lx7kKRdoFuICforSfeqhle4wu1ILsp+B Eq21y9axjHxORI8lBntbu1jy+G4JptNoLFTKixe7PyCB51Uaxvd6UTxzggWMbe/E5p v30XsDZWs4xDn3ohYOXlZK+JX5aDW8W06rX183QMJ2usl+NiKcYkCkHcSGGDiK8kny Xz/GqqKPMFDqQ== 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 10/26/20 4:49 PM, Jason Gunthorpe wrote: > On Fri, Oct 23, 2020 at 10:31:51PM -0700, John Hubbard wrote: >> On 10/23/20 10:19 PM, John Hubbard wrote: >>> On 10/23/20 5:19 PM, Jason Gunthorpe wrote: >> ... >> If so, it would still be good to wrap the "acquire" and "release" >> parts of this into functions, IMHO. So we'd end up with, >> effectively, a lock API anyway. > > What it really needs is a smp_load_mb() to match the existing smp_store_mb(), > then this implementation wouldn't look so odd. > No argument there! > It is actually really straightforwad since the write side is under the > exclusive mmap_lock. > Yes, conceptually it is pretty clean. I'm still wishing there were a small API to encapsulate such things, but given that there isn't one, I'll take another look later tonight and attempt to spot any problems with the current patch, as-is. "Unfortunately", I don't yet see any problems... :) thanks, -- John Hubbard NVIDIA