Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1794902rwd; Wed, 17 May 2023 01:12:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4k5xRamb2ld8cFBsbT9Lrhw3xF45VcmZRnCH4LQW67z9WvEFN2IfOgYZC8RHAWqUcftvHW X-Received: by 2002:a17:90b:3d1:b0:253:43d8:1e8e with SMTP id go17-20020a17090b03d100b0025343d81e8emr1400361pjb.25.1684311138188; Wed, 17 May 2023 01:12:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684311138; cv=none; d=google.com; s=arc-20160816; b=NQG9uPZi239BVI8aMgDqsp1uAt6pYqJcxmEej798aAuNxBRsF/per68ar4A+s675YN hVSHSXCn/ewDNUXlIy82iUHQ3Z7fJ9s2OFTJhRz7OkCqm8nAmKu55rMxY6JkcrW3YVm2 1KzBfVc5V43L8T+jSIgHQPDuHKyKVAcHGLPZNh+2lZBTcoOEiZFjDQB7mm2Q3ikQdt7U Z1XbvRgpBTG1NLt3PkpDV7znCQwsMwDtgP4AnWq4WVMxW0dP7DAEnIU3DeMyp6eh6b9s loxLGTAJA5VfnNOoXWFpRxUqQCnrVUkQ/MqWd1oAEBKRnOxZKdQ4JXH4GjUgsSqXcGC+ FHjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3/kfc+tiJ0ZCBOb1GVRxtYgE5lDPgEU5sGHiw/RjZPo=; b=C/okDGppgA8S6j/I16kznRcECsyiXYFdOtMfMpsB/9HOXvZVOJ1adBs6/BqqZXa/4G O+asScq/qCgUxQCzdKsrVG1iJ6NLEHanAVznMwUujkjPmam/P3Qo47a/vsgQBhpFbLuI ihWYTxWcujLDqFrFOYBfl03XfmoNthhZ13t05q7Xu3Z1QzGxx+ERu3JChWxEZ2KOmLXV AlfhJViZwVCuzoP0TVo/jNM6db4fQ5WSfKJl5ZU1y3RSNj2KBI9EpG3SWQKlvJBqjC31 9H5ObSE3v4TfccKW+yTjGf+lj/GSGA4z9m6OK3EW2ywaTZzR2dsTTSH+XiVInGGeS+Mh brCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=UV9FWfS8; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m15-20020a638c0f000000b0051bb433f5d3si20006183pgd.862.2023.05.17.01.12.03; Wed, 17 May 2023 01:12:18 -0700 (PDT) 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=@gmail.com header.s=20221208 header.b=UV9FWfS8; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230402AbjEQH4C (ORCPT + 99 others); Wed, 17 May 2023 03:56:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230341AbjEQHzc (ORCPT ); Wed, 17 May 2023 03:55:32 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D3E31701; Wed, 17 May 2023 00:55:30 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-307c040797bso230304f8f.3; Wed, 17 May 2023 00:55:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684310129; x=1686902129; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=3/kfc+tiJ0ZCBOb1GVRxtYgE5lDPgEU5sGHiw/RjZPo=; b=UV9FWfS8aIvYMGLcPcpiWcUdl75X59NHVstTUgr95d6jmEJGTvmJYksKT9XVbcSz0R /uqtlt+EidplmbyZ2bX7/b6E3nTsXJpK97L9rApchZ0lF3T5y9vldo06p44O0HeSnFuq ccgs3QBBJEDmceq6i+YH2t1CFNLUL5N8H4w8ZN8tQl7h1zFBX/tF8MwHfn40MmBFRr62 3dZfQIDLSb3oRoNjfpdbTw52pmWThAAIAxgDegm26qYqZO/3etNtu3SaO5NKSKsj4ROX 3OBTGc1PooOgO1kuA6mIZf+6ZED7DiGxUZxFmPlUjvOvLjM6M4n/KmN93/gTjqLSQD8t EwNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684310129; x=1686902129; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3/kfc+tiJ0ZCBOb1GVRxtYgE5lDPgEU5sGHiw/RjZPo=; b=eiLq9wFoisV2RNtxEabW5YZB1VWuuCxgrGUj924m4IJKOrVmmW9IWUyolHuA47RSC+ f8oa8hbJXxpcSloe2ed7r69HW57Nhw5BOsOWt4Ym2OEwrzf8jUQfBPBFnoEjmNYn4Dn2 xSZzwb3vEz+CF1qA9uZbIZmVCV4ti6SCKIeYJcgczp35md/pa1xRZCaHHsQFKDoNEVPL WUZTW+iq1fGbZtxr8qZAc+LaVQIzn0ZDs6cg3WvUEV3hqZk6zym2O0o9z+i9ko0g8P9n MiN8xD9wv6xLPqHo90KtXmQQLZIwcrFSAdxlw0AEuLfuzEBMAtCxe76qdvURMTPFOdWb Pkow== X-Gm-Message-State: AC+VfDxIacZA5tKNaMGLeXmYzHwgn87yENjUIe/GGbyE3nkr9vEbWvxM g58EbkvBOkfSztGeLPvslPE= X-Received: by 2002:adf:e8c4:0:b0:309:3698:8006 with SMTP id k4-20020adfe8c4000000b0030936988006mr3101357wrn.34.1684310128765; Wed, 17 May 2023 00:55:28 -0700 (PDT) Received: from localhost (host86-156-84-164.range86-156.btcentralplus.com. [86.156.84.164]) by smtp.gmail.com with ESMTPSA id t2-20020a5d5342000000b00307972e46fasm1844942wrv.107.2023.05.17.00.55.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 May 2023 00:55:27 -0700 (PDT) Date: Wed, 17 May 2023 08:55:27 +0100 From: Lorenzo Stoakes To: Christoph Hellwig Cc: Jan Kara , Jason Gunthorpe , "Kirill A . Shutemov" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Jens Axboe , Matthew Wilcox , Dennis Dalessandro , Leon Romanovsky , Christian Benvenuti , Nelson Escobar , Bernard Metzler , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Bjorn Topel , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Christian Brauner , Richard Cochran , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , linux-fsdevel@vger.kernel.org, linux-perf-users@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, Oleg Nesterov , John Hubbard , Pavel Begunkov , Mika Penttila , David Hildenbrand , Dave Chinner , Theodore Ts'o , Peter Xu , Matthew Rosato , "Paul E . McKenney" , Christian Borntraeger Subject: Re: [PATCH v9 0/3] mm/gup: disallow GUP writing to file-backed mappings by default Message-ID: <503e92f9-fbc2-422b-b0d4-f4cabe3f6802@lucifer.local> References: <20230515110315.uqifqgqkzcrrrubv@box.shutemov.name> <7f6dbe36-88f2-468e-83c1-c97e666d8317@lucifer.local> <20230517072920.bfs7gfo4whdmi6ay@quack3> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 Wed, May 17, 2023 at 12:43:34AM -0700, Christoph Hellwig wrote: > On Wed, May 17, 2023 at 08:40:26AM +0100, Lorenzo Stoakes wrote: > > > I'm not sure what you mean by "total flexibility" here. In my opinion it is > > > also about how HW performs checksumming etc. > > > > I mean to say *_ops allow a lot of flexibility in how things are > > handled. Certainly checksumming is a great example but in theory an > > arbitrary filesystem could be doing, well, anything and always assuming > > that only userland mappings should be modifying the underlying data. > > File systems need a wait to track when a page is dirtied so that it can > be written back. Not much to do with flexbility. I'll try to take this in good faith because... yeah. I do get that, I mean I literally created a repro for this situation and referenced in the commit msg and comments this precise problem in my patch series that addresses... this problem :P Perhaps I'm not being clear but it was simply my intent to highlight that yes this is the primary problem but ALSO GUP writing to ostensibly 'clean' pages 'behind the back' of a fs is _also_ a problem. Not least for checksumming (e.g. assume hw-reported checksum for a block == checksum derived from page cache) but, because VFS allows a great deal of flexibility in how filesystems are implemented, perhaps in other respects we haven't considered. So I just wanted to highlight (happy to be corrected if I'm wrong) that the PRIMARY problem is the dirty tracking breaking, but also strikes me that arbitrary writes to 'clean' pages in the background is one too.