Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp646780pxm; Thu, 3 Mar 2022 01:31:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxfvQ58rAf1OBbVM0edFNdECFqjMmbaY/Rp1vU3oMsthtiKE0CmXPcpIwe74RyeONnlrSPa X-Received: by 2002:a17:907:3ea3:b0:6da:6f16:bd9b with SMTP id hs35-20020a1709073ea300b006da6f16bd9bmr4791647ejc.308.1646299901430; Thu, 03 Mar 2022 01:31:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646299901; cv=none; d=google.com; s=arc-20160816; b=SCHUgydpQzc3cJrMr+tm6VLfgDTq57vSx5zIfMvh5zNhm8FyQ6egezKVZVjMVrl9UC 2Cqic+qhbGe3n+We+27Ddz7zdiap4KaUmblaeQQjX3xm88XOgCpBZgRrUCLHuQwelxqB 6MqeWUYENJUviDZPAfWVI2UmYKVLx18yc1rp4M3EDpAmee6XeWAd5DSXf6bLjauBjpeD a5vrb32kzYmrzn4aLZwzWGY/0kRFRxyMm9TFrMPfldrDswz7J8NzZ4Zydy18earxp9VE mkYZOjel3oodpMSjjzx5rmGbpGbKdzIRkmDLt8fef81TP9APDZScTzaMrd5VP1+kxo6o ARhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=m2mAGXBlKqRnW4B+OtLFqzxW5wMoYCTA1YJLFQ1QSJY=; b=PdChHioetDCfrNWNBVkxoyTuPGv5pKhJaGLds04DoCaohF6CoXMGoyEzEj/F0UymSq sh3RqIoTezkjVYiiqBBNdV8CRHkNz0ckp7hDDWQVsoO3ECgGvTT4+RL7LQdrYX+4xDwc JUDB1eF3+GwhbSOc2vy39+lw0+AN4NB2tYCvDz6+RIjws28A9SKZ0O8wBRzQ5fNJbIB5 s4kaP9/HJErvF6P7uXgbREQy4BePDd0+YAhuPTut4M2dG767N/RMu+Chdat4C4/WPJPG Qpn51nINuj7Yo+X/cBMU3xaiosEqBA3PkCC4LyeRMfxrpD59g4uCDAkcKtHiP1fLNTe/ SvfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TJGx2UTP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f16-20020a0564021e9000b00415b3438149si1452315edf.140.2022.03.03.01.31.16; Thu, 03 Mar 2022 01:31:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TJGx2UTP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230511AbiCCIIJ (ORCPT + 99 others); Thu, 3 Mar 2022 03:08:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230326AbiCCIII (ORCPT ); Thu, 3 Mar 2022 03:08:08 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7DE401704C1 for ; Thu, 3 Mar 2022 00:07:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646294842; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m2mAGXBlKqRnW4B+OtLFqzxW5wMoYCTA1YJLFQ1QSJY=; b=TJGx2UTPuaZo61R0ubx4RutgL4LHt68eS4+velb5jOei+QXry5JvoUff/nx9FChHXz6DJs XmtgSMYTGUoCJsV6oH+K0gyCgyluvG2W3pNKwGjbd+AYAoenzDqsVgIa4iWajZV+Adj9Q9 wTzoj4vwxb8iUqwA0biLnE2YkLzTTB8= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-445-44_FQlFhNFaSZD1cGeUOBA-1; Thu, 03 Mar 2022 03:07:21 -0500 X-MC-Unique: 44_FQlFhNFaSZD1cGeUOBA-1 Received: by mail-wm1-f70.google.com with SMTP id n31-20020a05600c3b9f00b003812242973aso1406751wms.4 for ; Thu, 03 Mar 2022 00:07:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=m2mAGXBlKqRnW4B+OtLFqzxW5wMoYCTA1YJLFQ1QSJY=; b=p2RuwS+9MD76pcnBOQFINQgEI7m7ZVPoolY1/HkXoLxEtZ4rGkUYzCSftpBfbdmAhj VX6q/uHx21c26elrAbHNnh/eBokOiZL86FkAjkchgeXKy1998Ao1/4D12w5Wdp+eDdgD qzIy/bY1vwVY2jfyJQwsCyZufzSxGvPaip6xEeZD+4e5bJ7Gqv3wn38wL6vK8elfD28x WLCvHxCoN9XuWH38pNPonNAbTPLP1sz06Ho38KguGEnAFTUruyk4QkjgFwTUBXBYLq7r D/2dsWZ16h+AfaoMQyO9zYEYOFhk2UUoGcw91UC7FQTor4EXd4in6yxWq4OtOSu8MR+9 qyxA== X-Gm-Message-State: AOAM531W4Lsrs14eaw6EpzG0qSJUb2Ff8kiSB2sCPQcP77ZR3gxdwexU AgMud2cer6+Tvmx2Vv1Al9b21U0lbAgQQYCimDID+2Xl1QUWH/ytoKJZRrBMk1wCVserz3pfeyE lBhLgAwg5rSLilNKEKaT6D/5a X-Received: by 2002:adf:c188:0:b0:1e6:8ecb:ea5a with SMTP id x8-20020adfc188000000b001e68ecbea5amr24933479wre.711.1646294840362; Thu, 03 Mar 2022 00:07:20 -0800 (PST) X-Received: by 2002:adf:c188:0:b0:1e6:8ecb:ea5a with SMTP id x8-20020adfc188000000b001e68ecbea5amr24933446wre.711.1646294840096; Thu, 03 Mar 2022 00:07:20 -0800 (PST) Received: from ?IPV6:2003:cb:c706:3600:f39a:d830:baab:42f0? (p200300cbc7063600f39ad830baab42f0.dip0.t-ipconnect.de. [2003:cb:c706:3600:f39a:d830:baab:42f0]) by smtp.gmail.com with ESMTPSA id m14-20020a05600c4f4e00b0038181486018sm1393216wmq.40.2022.03.03.00.07.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Mar 2022 00:07:19 -0800 (PST) Message-ID: Date: Thu, 3 Mar 2022 09:07:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH RFC 12/13] mm/gup: trigger FAULT_FLAG_UNSHARE when R/O-pinning a possibly shared anonymous page Content-Language: en-US To: Jason Gunthorpe Cc: linux-kernel@vger.kernel.org, Andrew Morton , Hugh Dickins , Linus Torvalds , David Rientjes , Shakeel Butt , John Hubbard , Mike Kravetz , Mike Rapoport , Yang Shi , "Kirill A . Shutemov" , Matthew Wilcox , Vlastimil Babka , Jann Horn , Michal Hocko , Nadav Amit , Rik van Riel , Roman Gushchin , Andrea Arcangeli , Peter Xu , Donald Dutile , Christoph Hellwig , Oleg Nesterov , Jan Kara , Liang Zhang , Pedro Gomes , Oded Gabbay , linux-mm@kvack.org References: <20220224122614.94921-1-david@redhat.com> <20220224122614.94921-13-david@redhat.com> <20220302165559.GU219866@nvidia.com> <20220302205934.GV219866@nvidia.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20220302205934.GV219866@nvidia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02.03.22 21:59, Jason Gunthorpe wrote: > On Wed, Mar 02, 2022 at 09:38:09PM +0100, David Hildenbrand wrote: > >> (a) I want a R/O pin to observe file modifications. >> (b) I want the R/O pin to *not* observe file modifications but observe >> my (eventual? if any) private modifications, > > A scenario I know that motivated this is fairly straightfoward: > > static char data[] = {}; > > ibv_reg_mr(data, READ_ONLY) > data[0] = 1 > .. go touch data via DMA .. > > We want to reliably observe the '1' > > What is happening under the covers is that 'data' is placed in the > .data segment and becomes a file backed MAP_PRIVATE page. The write > COWs that page > > It would work OK if it was in .bss instead > > I think the FOLL_FORCE is there because otherwise the trick doesn't > work on true RO pages and the API becomes broken. Thanks for the nice example, it matches what John brought up in respect to MAP_PRIVATE semantics. -- Thanks, David / dhildenb