Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7049893rwr; Tue, 2 May 2023 08:51:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Sumx5jWoWIQ4SsRMKzB1xWCM/e1oNBk8K5+DhYkTlDHGHsa/pGbPPeKrDjZI/8I2mXRyp X-Received: by 2002:a17:90a:62c3:b0:23d:286:47d3 with SMTP id k3-20020a17090a62c300b0023d028647d3mr17150198pjs.40.1683042678331; Tue, 02 May 2023 08:51:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683042678; cv=none; d=google.com; s=arc-20160816; b=ITr9VAVB9lhW2EK131MBPBYVtgNrUTIP2aOpE1O6kf807FFl5tNTW3bhBDI9pYlmlX 2CrdaHZCxAuNOK08s/4TGIBi5ccFgerQyWGwmF1yTXXJbRHJBLptoqhS0JXC8R68oth5 Hfo/xVooUuYj/ieMp7NJsoISKiI1eFpm5Q17rWZhBrRdHSUW6wrYQyO0ewKj8+6I82P8 CTlCHAuEFHsQF8ysMTuFcbvq0exDwlYBdv8jBfWLkIv55Ku0Sx0NL5lmH2QH1PQaUi7H 3rPHS2cU0bU8vYZLf2zPue3g1f3f7530y8QUXJnSJIMtf/z1ITqtLTIdZnzp3ywB5tzo Q8Ew== 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:subject :organization:from:references:cc:to:content-language:user-agent :mime-version:date:message-id:dkim-signature; bh=/jXCvdd7DNygReOZu9LsiaslZNiW9u3JpZSmEUHzOZk=; b=HHt4DGfLAE2PUG1+fmvaAOtsk9HFlKYk9617ltBJhfcgeJWc6sHAzgeU2hRM7ova6q 6Yl6CkzmAbIAljfzwWUkwlQUQrcYXhyRYuTyUrEk5PASAXKbNHcYAqMO7W7U0ddFyOao IS2isSlf7UH1qOoCG9wNsAhhIohZ7m2kTI/nJNAeMcHEUlfEuU7sZ5GLrU2dBzzEG7gO Jo5i0E1QFqIpyQgMh0w2Qjs5ocleQYxkNomLMTvVRRLhEGWHRsmHJgSE4Dl94CNo+EjY 7hrkeaP8VxS7EhuwMV9InQfT3TTXQ94pr0rmstm5lVM/7+tMPqDcT88IAZbOL7wJSL3A 9eDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BRDgSKTa; 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 w24-20020a17090aea1800b0024de4be9639si7471736pjy.34.2023.05.02.08.51.03; Tue, 02 May 2023 08:51: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=@redhat.com header.s=mimecast20190719 header.b=BRDgSKTa; 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 S234569AbjEBPqg (ORCPT + 99 others); Tue, 2 May 2023 11:46:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233781AbjEBPqe (ORCPT ); Tue, 2 May 2023 11:46:34 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF41D1B0 for ; Tue, 2 May 2023 08:45:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683042346; 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=/jXCvdd7DNygReOZu9LsiaslZNiW9u3JpZSmEUHzOZk=; b=BRDgSKTa7nEr1bdpIOCLfMzyYKhcvH67DYXXiOtVdse65imeItlGx7cPyskdmJrDhtUxSx VShIzmQG6kdkGrYEMu2AfQB3BQOzWFWF9jLSeXsOv5mwaf1gkvt9MdUPwHcUJ8mNWtDaZo HLLzommqUg5nvKfIH/iccKV8E99Fj1Y= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-360-hfAWL_8jPCijmOmQVnHNxg-1; Tue, 02 May 2023 11:45:45 -0400 X-MC-Unique: hfAWL_8jPCijmOmQVnHNxg-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3f321e60feaso13218745e9.0 for ; Tue, 02 May 2023 08:45:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683042344; x=1685634344; h=content-transfer-encoding:in-reply-to:subject:organization:from :references:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/jXCvdd7DNygReOZu9LsiaslZNiW9u3JpZSmEUHzOZk=; b=NKYpdDvWUkyuHz4WtWt3e5kk/KC+OWaAjLikANTNmI6VPqRSHy51p/oa+r5GjfQ5ii o129sdcrx55N6dg/j1fwu2U8zWOEKT1IUlLh7clPM4rbKDPdakZJDCrX73CudnIBP8gr hMIUf745eKYSIEX7ZU6yRQmlvnps1QIcAG4QOmCdz8JJ0uF1ymBYTJj9mSq2UVmciU7V sH8bKRMp475B1k0uk9yZEKoVzW3I4Ux1W5LJJci0UuckRC8EGGRp5hQ0GxtmqysUsKVX bWnsjLvhbeQnTt7+4LpdA9SqmXVWlRp5/qql5IrtACiUBTQx3dL5xRLlpeFrWR1n/pSA WQPA== X-Gm-Message-State: AC+VfDx/7rRSXLFqkOLQI5sqIUJRqC30a9kR0/P1VxiCK0CNgmb3xDxE NaV5j6HaXK9d+N85VvmYeB5SPKjQkqcdBG5mQt0uRNIcTFV3vbAToX1lVugBpOc8cayRMAU3Bk1 AHIfrN4+Q5eQ2C+F5WzUi8RwJ X-Received: by 2002:a7b:c3c4:0:b0:3f3:3a81:32b with SMTP id t4-20020a7bc3c4000000b003f33a81032bmr5684942wmj.15.1683042343899; Tue, 02 May 2023 08:45:43 -0700 (PDT) X-Received: by 2002:a7b:c3c4:0:b0:3f3:3a81:32b with SMTP id t4-20020a7bc3c4000000b003f33a81032bmr5684921wmj.15.1683042343556; Tue, 02 May 2023 08:45:43 -0700 (PDT) Received: from ?IPV6:2003:cb:c700:2400:6b79:2aa:9602:7016? (p200300cbc70024006b7902aa96027016.dip0.t-ipconnect.de. [2003:cb:c700:2400:6b79:2aa:9602:7016]) by smtp.gmail.com with ESMTPSA id f25-20020a7bc8d9000000b003f0b1b8cd9bsm35846962wml.4.2023.05.02.08.45.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 May 2023 08:45:42 -0700 (PDT) Message-ID: <4fd5f74f-3739-f469-fd8a-ad0ea22ec966@redhat.com> Date: Tue, 2 May 2023 17:45:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Content-Language: en-US To: Jason Gunthorpe , Peter Xu Cc: Matthew Rosato , Christian Borntraeger , Lorenzo Stoakes , 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 , Jan Kara , "Kirill A . Shutemov" , Pavel Begunkov , Mika Penttila , Dave Chinner , Theodore Ts'o References: <1ffbbfb7-6bca-0ab0-1a96-9ca81d5fa373@redhat.com> <3c17e07a-a7f9-18fc-fa99-fa55a5920803@linux.ibm.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v6 3/3] mm/gup: disallow FOLL_LONGTERM GUP-fast writing to file-backed mappings In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.7 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_NONE,RCVD_IN_MSPIKE_H2,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.05.23 17:36, Jason Gunthorpe wrote: > On Tue, May 02, 2023 at 11:32:57AM -0400, Peter Xu wrote: >>> How does s390 avoid mmu notifiers without having lots of problems?? It >>> is not really optional to hook the invalidations if you need to build >>> a shadow page table.. >> >> Totally no idea on s390 details, but.. per my read above, if the firmware >> needs to make sure the page is always available (so no way to fault it in >> on demand), which means a longterm pinning seems appropriate here. >> >> Then if pinned a must, there's no need for mmu notifiers (as the page will >> simply not be invalidated anyway)? > > And what if someone deliberately changes the mapping? memory hotplug > in the VM, or whatever? Besides s390 not supporting memory hotplug in VMs (yet): if the guest wants a different guest physical address, I guess that's the problem of the guest, and it can update it: KVM_S390_ZPCIOP_REG_AEN is triggered from QEMU via s390_pci_kvm_aif_enable(), triggered by the guest via a special instruction. If the hypervisor changes the mapping, it's just the same thing as mixing e.g. MADV_DONTNEED with longterm pinning in vfio: don't do it. And if you do it, you get to keep the mess you created for your VM. Linux will make sure to not change the mapping: for example, page migration of a pinned page will fail. But maybe I am missing something important here. -- Thanks, David / dhildenb