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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9043C27C52 for ; Thu, 6 Jun 2024 21:33:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7AA2A6B0085; Thu, 6 Jun 2024 17:33:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 75ABE6B00A7; Thu, 6 Jun 2024 17:33:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 623166B00B4; Thu, 6 Jun 2024 17:33:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 43A666B0085 for ; Thu, 6 Jun 2024 17:33:07 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D363880917 for ; Thu, 6 Jun 2024 21:33:06 +0000 (UTC) X-FDA: 82201764372.06.EB3EBD6 Received: from ale.deltatee.com (ale.deltatee.com [204.191.154.188]) by imf01.hostedemail.com (Postfix) with ESMTP id BC1304001A for ; Thu, 6 Jun 2024 21:33:04 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=deltatee.com header.s=20200525 header.b=VafrFhSD; spf=pass (imf01.hostedemail.com: domain of logang@deltatee.com designates 204.191.154.188 as permitted sender) smtp.mailfrom=logang@deltatee.com; dmarc=pass (policy=quarantine) header.from=deltatee.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717709584; h=from:from:sender: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:dkim-signature; bh=GFEw8cAaOIMPPjcIH/t2swdVfYuU+9OBnbnvT/Z34FA=; b=8Bidx91L2t8jyWYsUpdqljx0sl2zA60kVk9sRH42hb1lh57ixY1i1d6dAwWHFqrsQhpLYK 6DyCFd2KyriT+yiO7GcuskPAUQ/sy2E9XOJT3quA8PvkDxDRamDs4HtFYWdhHCXXlxGess XQZ1U8NPoroM8inCJD7sEqdJeJr9LsY= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=deltatee.com header.s=20200525 header.b=VafrFhSD; spf=pass (imf01.hostedemail.com: domain of logang@deltatee.com designates 204.191.154.188 as permitted sender) smtp.mailfrom=logang@deltatee.com; dmarc=pass (policy=quarantine) header.from=deltatee.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717709584; a=rsa-sha256; cv=none; b=s7YLgA5TzEOvIhVV8YhL2fsTKMMiL8x4pduU8G61CUHnK78pklE4gc4OTXNiHO37EgwnXc AeaX/CyobMnD85GLj1mkodTrUVq6mUPBBMkR7nRjUWb3OOVAo1BQfE0u7xSfst+bAssVPV LwG0ksRfS6KlYXPvzeuLnhzUP973G0E= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:In-Reply-To:From:References:Cc:To: MIME-Version:Date:Message-ID:content-disposition; bh=GFEw8cAaOIMPPjcIH/t2swdVfYuU+9OBnbnvT/Z34FA=; b=VafrFhSDZTiuTQ8+eqghWgRF/6 LbImSkv5LzDfHOSEpw5N5S4ulsNiiv1TzeiftXjYmAxXH9xYRxXqV6ScNt6jpoZhUoMjpLgULTY4c RxEqaFL5TsOFZvWBW6uee5L1CXJlmgb8ZmEQb3c/zrxeclsuynN+yXuixJpTovirhWS9QmVDgv2Ka zCh7bRny2nQzn/GF+eMTU8MtnBT27kGc17jRdSPb5CgAukSJ+fhCiWh1HUL/v2CPuqd9Kw4wF00zx rokY8xTE011F43W7U8oQ0olgR2h94vh+ngSqC+weHVt2qqA6FxLwSBLt7mMgxdELA9RdCtvo2WLM9 NfcCF6PQ==; Received: from d104-157-31-28.abhsia.telus.net ([104.157.31.28] helo=[192.168.1.250]) by ale.deltatee.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1sFKj7-002BN1-1U; Thu, 06 Jun 2024 15:33:00 -0600 Message-ID: Date: Thu, 6 Jun 2024 15:32:39 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Greg Kroah-Hartman , Martin Oliveira Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-mm@kvack.org, Jason Gunthorpe , Leon Romanovsky , Bjorn Helgaas , Tejun Heo , "Rafael J. Wysocki" , Andrew Morton , Mike Marciniszyn , Michael Guralnik , Dan Williams , Ard Biesheuvel , Valentine Sinitsyn , Lukas Wunner References: <20240605192934.742369-1-martin.oliveira@eideticom.com> <20240605192934.742369-2-martin.oliveira@eideticom.com> <2024060658-ember-unblessed-4c74@gregkh> Content-Language: en-CA From: Logan Gunthorpe In-Reply-To: <2024060658-ember-unblessed-4c74@gregkh> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 104.157.31.28 X-SA-Exim-Rcpt-To: gregkh@linuxfoundation.org, martin.oliveira@eideticom.com, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-mm@kvack.org, jgg@ziepe.ca, leon@kernel.org, bhelgaas@google.com, tj@kernel.org, rafael@kernel.org, akpm@linux-foundation.org, mike.marciniszyn@intel.com, michaelgur@nvidia.com, dan.j.williams@intel.com, ardb@kernel.org, valesini@yandex-team.ru, lukas@wunner.de X-SA-Exim-Mail-From: logang@deltatee.com Subject: Re: [PATCH 1/6] kernfs: create vm_operations_struct without page_mkwrite() X-SA-Exim-Version: 4.2.1 (built Wed, 06 Jul 2022 17:57:39 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: BC1304001A X-Stat-Signature: tyrga14s9zsp17fqtdajorwata3p1hj8 X-Rspam-User: X-HE-Tag: 1717709584-977417 X-HE-Meta: U2FsdGVkX1+wgEwLkora+C4TAT83tgaysRoIaMD43TR5ZfVnlgz5kZh2RsCdvKpck1X8rBY+N8Zt9l9+bdVYGuwK8adRH+4eSs2/UbyncLNiDKluV4cJIoqB9EUo01yM9tLL5qrAcC+/lQBzIp++wiWrojVvtMPqRc7mJfmE/FfdxXyePlpOMseRQdLnDJqT8KoxATEsbrcSBm0sq9/SK4HuZGahY91bdgbcIA0Rl4TMImbDBwrUd0VbnAvBtHsosXvhhtRORkheyRd2c0Z8yIOW0m5WDSJlS+W0rS8xiAm6FDag6hU4WFnBFWrg9PVXf4FwLkZPjv2tl0UYg7Sqru8RhmipWM6EmykYtqYFvzsH9U3jMPQWRnvA7zuuyEmlg3V5xueU8gCo7OCXE7i2rlcc9PDl1vsNz7PDrhuzyc1Q+8VFiBbt5rxC/5HCfT8nGcJW7Cn1VDqugchPFmGmX7ZfnxZfLuUDsPvNJRxVdYf2hhNdyGHoMvxbVEkLQMuxFFsrv4FLNNX9IAcRwcSL5DLk80gho63n5lQ/UMeQ1vm36ktAU5f3qDdXQYMM62sijtE1WBya8/9U2ZKzvyiLkLpfQbOftEac/IekGfVY8Hi7UfOIunYW6GUVYQyo/1EnnNi8qAqZo8EVnfkKb5fadvUjxL2TVOmT5uKTJCLdZqX1vxwpdApKWLzk1JswsgAPTXTp+vf5m2VXf4XmchTgIJxJfWABvjNJWDhCit/UTjIfgSk+GHo55oaHAC3AkBl2saFoRcasZywbCkhPoHJwcSHQPYd++mq11jmTM0qM15oVhwY+LToaB3qdGjSgITTh8d+54vnL78nz+z0QoCpdrSOFc/bSOJ2GXYsW+mZQrjt+9zX2as6AmvTdP3iGnGMgE7HZiB/OgAqddl8sD8G2L0ZL8ali56XBwW/X7RvJTWgKmqF29aXjPgPhPPNM+z7zRxo5INlKbLRFeqJtfrK ohYRkx3k ZzO+iVbNAyQG8lSKnQcdj3tHhyBzUl0KiR09o5hhJauOXHzI4HUOsRyjx4GHSCCBz/2U1rJJwC1d3XpsEIyPwvPcZU75O5xem+nV45xfx4EzMYJYMf2/ezwxQ/KM0GbcXzjIJIYvsCxKa2ItdDHFVhL5lH9Lg+Io8lnkCd+8kp6sbMPdFRdBQg5/ndrM0ovUox7+IpPRbv9fJUC9ZKZC7xUoyk8wXiepNfTPrExJmRQx2PgHi6tKJLmzLg/UNP5ZicWZGFCXwrXn6QrLEc618t3ltUCPsxwARouXEl+vqRDzuIPga3CDgtzsuuU00hdliX1V3WyUlM9JIm5g5Pjz8ACLrzSecshcNdh4nXbR42COYmwA0og8znhDAci3/hEw0Hs6+81i6jX2qwAKuEahrQSCVgPKxRQJQxJuj 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: List-Subscribe: List-Unsubscribe: Hi Greg, On 2024-06-06 14:54, Greg Kroah-Hartman wrote: > On Wed, Jun 05, 2024 at 01:29:29PM -0600, Martin Oliveira wrote: >> The standard kernfs vm_ops installs a page_mkwrite() operator which >> modifies the file update time on write. >> >> This not always required (or makes sense), such as in the P2PDMA, which >> uses the sysfs file as an allocator from userspace. > > That's not a good idea, please don't do that. sysfs binary files are > "pass through", why would you want to use this as an allocator? The P2PDMA code already creates a binary attribute which is used to allocate P2PDMA memory into userspace[1]. It was done this way a couple of years ago at the suggestion of Christoph[2]. Using a sysfs attribute made the code substantially simpler and got rid of a bunch of pseudofs mess that was required when mmaping a char device. The attribute already exists and is used by userspace so it's not something we can change at this point. The attribute has worked well for what was needed until we wanted to use P2PDMA memory with FOLL_LONGTERM and GUP. That path specifically denies FOLL_LONGTERM pins when the underlying VMA has a .page_mkwrite operator, which sysfs/kernfs forces on us. P2PDMA doesn't benefit from this operator in any way so the simplest thing is to remove it for this use case. >> Furthermore, having the page_mkwrite() operator causes >> writable_file_mapping_allowed() to fail due to >> vma_needs_dirty_tracking() on the gup flow, which is a pre-requisite for >> enabling P2PDMA over RDMA. >> >> Fix this by adding a new boolean on kernfs_ops to differentiate between >> the different behaviours. > > This isn't going to work well. What about it are you worried won't work well? We're open to other suggestions. Thanks, Logan [1] https://elixir.bootlin.com/linux/latest/source/drivers/pci/p2pdma.c#L164 [2] https://lore.kernel.org/all/20220705075108.GB17451@lst.de/