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 E2920C77B7C for ; Mon, 23 Jun 2025 16:50:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 831268D0009; Mon, 23 Jun 2025 12:50:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7E19D8D0005; Mon, 23 Jun 2025 12:50:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A9C98D0009; Mon, 23 Jun 2025 12:50:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 5677F8D0005 for ; Mon, 23 Jun 2025 12:50:51 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id D5D071A0924 for ; Mon, 23 Jun 2025 16:50:50 +0000 (UTC) X-FDA: 83587254660.18.6555B8C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf11.hostedemail.com (Postfix) with ESMTP id 5FF1D40002 for ; Mon, 23 Jun 2025 16:50:48 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=OPN5XFYq; spf=pass (imf11.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=quarantine) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1750697448; 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=Ed4niKBqAAFAJdMUfcKk9bgf0mMY+ZjxjhYnZ9rFgsM=; b=bd5YDhgVBk9KsOPsJokw9wULCClBW52P5Jog3oLdpGgKbGN/hsBZM7bgrq7Qlc+7E7jE0X C2kBPqdI4ykpx37Nv34AaJJjDyHrEJgA4lNMX6pxkbEps9nf6AANCxUL6BeQkw9S9XDkWK xzMw7cMusw2OOTfrNsJUxT7s2Tqfbk8= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=OPN5XFYq; spf=pass (imf11.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=quarantine) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1750697448; a=rsa-sha256; cv=none; b=v3lsEFEfmF/pcyGT3fZ9dZ6S3f5rhHfeVzwGOqtkiBO4gkP487nHHlqWrJGSG1/WngdwXY eNMuem4a/efR4+aSZKnuWxdW461A+WIQAHHKidjl5PxzZmFUYtJEdRCOgZPormSTvZLxeS 1bftRMuoGFYaYGJQiKBh75ukJl6o4/M= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1750697447; 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:autocrypt:autocrypt; bh=Ed4niKBqAAFAJdMUfcKk9bgf0mMY+ZjxjhYnZ9rFgsM=; b=OPN5XFYqqZZBFqln+aQ6je9sZnebpu8PE2HKGLedqMpZZlmlPlX5vLt63gi2KXeRVLeU+0 cAqkp5x5n93OsiomsOzfqz4X7gamYMPJpDS00v5vf4YsQfh5j7v9mWOIHPlVvUUARcUyfg 9Ehcotvv+VlPTAOOirkWCNbngTeD8Ac= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-5-FAEBjMpoMVSNV3gWFRaojA-1; Mon, 23 Jun 2025 12:50:46 -0400 X-MC-Unique: FAEBjMpoMVSNV3gWFRaojA-1 X-Mimecast-MFC-AGG-ID: FAEBjMpoMVSNV3gWFRaojA_1750697445 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-3a5058f9ef4so1671300f8f.2 for ; Mon, 23 Jun 2025 09:50:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750697445; x=1751302245; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=Ed4niKBqAAFAJdMUfcKk9bgf0mMY+ZjxjhYnZ9rFgsM=; b=M0iopuT52sXWkfNtA4aO77jRU9U9vo2W3OC2MWEWH+LtaOmu/f1JlE5K5liqBxbvaV RHxiHYeRg89qtAF3zyBvI38vGnnE45VAqZLbwLASRlJCFc+Jab76qT3TpGvedLzJSbSu yW0zSHWR7Obb5otCcoBYIbUztJgbprUxELV16/MXqz35fVvnUwF7IFW15VWEPYZRQ9pn Ray25wBmyFPeroZFZQZn8gXwvL8IdZbfxLfvr0trW9Q7EE4kPwFOqds3FdUXmUNWNNLH CV5p2oFZodSkOSHZ5mR4Eq5O1cqMfJQ3iwLsIPAX3mz4+aC1yByqzJxaHN2UxCIfD7+v nssw== X-Gm-Message-State: AOJu0YyKO+2PW5t3HZgbi440P52dCLHGq+yzaNvRgHtC8OTnycRdMWcX lPIcFlX5NtRwgS6rQ5nrsu88xBDIvuZe7y+I1YnpPXDNTnh46l3DzOrioNFCiVFY6PhwwmmpzMN ZN296PGopyZPKiQMEUUEy3fUGBP+fct+aJBDe/4F3QYLy785jGpX7 X-Gm-Gg: ASbGncuGnZHBZDVO7DeuqwuQTo/ngPcd2wG9++L83AuvAV9U6xRH+Xx599/ZViQN1AT 6+j+ACga1tTTAINI1SqF1/F23zR5LaP3A3UUEXT1olm68e9JUXwd1iUy3mmnZlIpMste3mSQ5sJ 4gNqQrfIbpIoA1nhcyu7nLEuRP7lvJPkCI9AQp+Hr2wVqasl3t7eDXRmc3M5Jy8CaMHWxMIR73P boYPLPOBAp4Yty/SmzX/dv3diPBZhL9Zmc0ylnpa+KJaSrT3l8a3fOtbn0CtiOCz6fpGOTRx9hY W6HyFIC/rQ6eOnK9xLJsOxAHTyoj0BmYmaxNVM9k4eN8SV4Purh1MTDPE5Qkw5kEh0U7MZlNbzk jhPjSB+BKoO9/DLsysaR7uT0gQbRApBHXBnmU2rUNbMHjbAhdHg== X-Received: by 2002:a05:6000:3c7:b0:3a3:7ba5:9618 with SMTP id ffacd0b85a97d-3a6d12da112mr10882041f8f.29.1750697445060; Mon, 23 Jun 2025 09:50:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGOCWW7LmmKMRm1yEnHNd2WBIZ/Ne3pJxWlGyzN5KG6za4FEbOjWtLWcsmJ/nBd/OTszxhfTg== X-Received: by 2002:a05:6000:3c7:b0:3a3:7ba5:9618 with SMTP id ffacd0b85a97d-3a6d12da112mr10882005f8f.29.1750697444635; Mon, 23 Jun 2025 09:50:44 -0700 (PDT) Received: from ?IPV6:2003:d8:2f4e:fd00:8e13:e3b5:90c8:1159? (p200300d82f4efd008e13e3b590c81159.dip0.t-ipconnect.de. [2003:d8:2f4e:fd00:8e13:e3b5:90c8:1159]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-453624554cfsm83316645e9.0.2025.06.23.09.50.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Jun 2025 09:50:44 -0700 (PDT) Message-ID: <0126fa5f-b5aa-4a17-80d6-d428105e45c7@redhat.com> Date: Mon, 23 Jun 2025 18:50:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/4] mm: Introduce vm_uffd_ops API To: Peter Xu Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Nikita Kalyazin , Hugh Dickins , Oscar Salvador , Michal Hocko , Muchun Song , Andrea Arcangeli , Ujwal Kundur , Suren Baghdasaryan , Andrew Morton , Vlastimil Babka , "Liam R . Howlett" , James Houghton , Mike Rapoport , Lorenzo Stoakes , Axel Rasmussen References: <20250620190342.1780170-1-peterx@redhat.com> <20250620190342.1780170-2-peterx@redhat.com> <1e6fcebf-f74e-46ad-912b-d7df13527aea@redhat.com> From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb B3JfpUqcWwE7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QDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: j6DguvYImhACKJenBi9UQwD5H7-jCMEwPlVQR7PWBfo_1750697445 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 5FF1D40002 X-Stat-Signature: 3jewyaixx8fo3bpbdwj9x7w9uxqbt8r4 X-Rspam-User: X-Rspamd-Server: rspam04 X-HE-Tag: 1750697448-190832 X-HE-Meta: U2FsdGVkX19y90cmgQ6/qqUGYyhQnwCWP2Wg2ubd2Sgd6lDse5q5Jbcvf4YwAlhCxn/FyRKzQ2BNS8EnGI3JiFJCMTIi8Un5/fCN9r2P16tE9Tq3tenG0CbWhlH21PQN1OkEy9wC+Sj98QcbDjFtKwjB9tXba1+5QZ7K4w3g7NreYE8mJruRCSGT4uXfgrJAj7N9QTY9yH9W/0HmhnuSyxgR7LXCdmmn1d+d2+KRckq0hD+buNKPxvD+5Oc0I/6zSXu2G4wzUVtLy45s8lM3mV0AyzBTtONDO9HY5Sv4/kjZ3KUXRVm+FevZg2bt+PxxRO5Kh8Z7NOTCBKwUgFqhUhHin3uhW19DRrqZscr9mHSfR2lTHuB4woKEj7wBOg5b6UuVHcajz2zjc64gVShUAiTvKllbqFXArxjjBRROUt7bNfbAq0gnGn+7ZJ/S/ynjpVIqe/kNWv9f7JTVISasjTaPpqWr3ko787ym/a9TjEHOHD6GGh6/n49h1R6q4y/oWhsYuje788K96mO5uwjVe1kOL7hmpBZq3rv1rB4OzJ6AbeQKIKekDIlLeWRXB5JzZAkBcJJLM+0aVyC0pfAKskweMylg/bEfdndJbbmhBlRqG2eB/Lr4TF21GqiKquvZWMGJbZGO/E3MDXYdm8bDEZSsjF7o6NNQ2O52RU6IM8yzR2Q6wG6EFJZy/CUalC59RmQwpyWokMErT2gdq1x9Xngxl3zuScBIcQtiBOKZViBbeGKicasjXRLu1OK3m+UQsNkMcQxWeAL6I/O1AFnYI7OdPuxKpvFc/e38CRaUhhdtOlXRofc1mGkuSyH6gSS976VVfbuXRL4tGFEt9qgzSJmuWRLTgwPZseQpV15hYFDxnOeH2mVp8255PIQrx0RR9KynyxUpymEbsjUREH90NUwzNOCGXeLPMesw8WS+p0pLu5xF24F5kxB0tnHlEwrsoWl3PhNc3xEEy1rUYpc 1kgAMZcI LKJIXOyHjxIY/bVcIIHYyBLVpiCHLJuNpCuNIbDV0BCKOJrL+qQhKuEkLhPRCE31rqQcQ3Z4RyXJplC+XhWuBAIt7bTpUlNp+FOfrTfUoAG9+znyIqV8D0aWzVSGbk1M3fyvW7O+hW8J1frxFpItPd3Ifq3d80cvnT3uekJh4UASNJVH1JBbOumrBaxXs9Vgk48GxBAdKyByl8a1h1bS+lLfpg1xGHNPzY0VWUMjwjWSJK4/8t0x+kFcgw/RvafNEcR2gjyXewKshr4JXrZYomDlzDmFPCthf8XQXc2yKAmBF4U0xD+js82JYTT6wSrHyaYMCwrKQwQFNUHCPPfW9aPjnsqQN1OC54/Gb+LSJMU1MDxk+KwvOtwV/e48I18NY8YO6I1Cg+kYKBX/IRgIDn/RsrHoKqaRkiYWfarZmVdenBkpQwDZD6oxden/omXHo1axvzwPfHE1cseA+ShZqtvz5YJBC8ORLfPS3VeZdP2G/DuRU1TtVDtkFM6a/q/JsmslSL0HGiDdD0Lg= 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: On 23.06.25 15:59, Peter Xu wrote: > On Mon, Jun 23, 2025 at 10:25:33AM +0200, David Hildenbrand wrote: >> On 20.06.25 21:03, Peter Xu wrote: >> >> Hi Peter, > > Hey David, > >> >>> Introduce a generic userfaultfd API for vm_operations_struct, so that one >>> vma, especially when as a module, can support userfaults without modifying >> >> The sentence is confusing ("vma ... as a module"). >> >> Did you mean something like ".. so that a vma that is backed by a >> special-purpose in-memory filesystem like shmem or hugetlb can support >> userfaultfd without modifying the uffd core; this is required when the >> in-memory filesystem is built as a module." > > I wanted to avoid mentioning of "in-memory file systems" here. I thought one of the challenges of supporting guest_memfd on anything that is not a special in-memory file system is also related to how the pagecache handles readahead. So ... > > How about an updated commit like this? > > Currently, most of the userfaultfd features are implemented directly in the > core mm. It will invoke VMA specific functions whenever necessary. So far > it is fine because it almost only interacts with shmem and hugetlbfs. > > This patch introduces a generic userfaultfd API for vm_operations_struct, > so that any type of file (including kernel modules that can be compiled > separately from the kernel core) can support userfaults without modifying > the core files. .... is it really "any file" ? I doubt it, but you likely have a better idea on how it all could just work with "any file". > > After this API applied, if a module wants to support userfaultfd, the > module should only need to touch its own file and properly define > vm_uffd_ops, instead of changing anything in core mm. > > ... Talking about files and modules is still confusing I'm afraid. It's really a special-purpose file (really, not any ordinary files on ordinary filesystems), no? > >> >>> the core files. More importantly, when the module can be compiled out of >>> the kernel. >>> >>> So, instead of having core mm referencing modules that may not ever exist, >>> we need to have modules opt-in on core mm hooks instead. >>> >>> After this API applied, if a module wants to support userfaultfd, the >>> module should only need to touch its own file and properly define >>> vm_uffd_ops, instead of changing anything in core mm. >> >> Talking about modules that much is a bit confusing. I think this is more >> about cleanly supporting in-memory filesystems, without the need to >> special-case each and every one of them; can be viewed a cleanup independent >> of the module requirement from guest_memfd. > > Yes. But if we don't need to support kernel modules actually we don't need > this.. IMHO it's so far really about cleanly support kernel modules, which > can even be out-of-tree (though that's not my purpose of the change..). > > Please help check if above updated commit message would be better. I agree that another special-purpose file (like implemented by guest_memfd) would need that. But if we could get rid of "hugetlb"/"shmem" special-casing in userfaultfd, it would be a rasonable independent cleanup. But I can spot in patch #3 now: "Hugetlbfs still has its own hard-coded handler in userfaultfd, due to limitations similar to vm_operations_struct.fault(). TODO: generalize it to use the API function." I would have hoped that we clean that up in one go instead. > >> >>> >>> Note that such API will not work for anonymous. Core mm will process >>> anonymous memory separately for userfault operations like before. >>> >>> This patch only introduces the API alone so that we can start to move >>> existing users over but without breaking them. >>> >>> Currently the uffd_copy() API is almost designed to be the simplistic with >>> minimum mm changes to move over to the API. >>> >> >> Is there a way to move part of the actual implementation (how this is all >> wired up) from patch #4 into this patch, to then only remove the old >> shmem/hugetlb hooks (that are effectively unused) in patch #4? > > Not much I really removed on the hooks, but I was trying to reuse almost > existing functions. Here hugetlb is almost untouched on hooks, then I > reused the shmem existing function for uffd_copy() rather than removing it > (I did need to remove the definition in the shmem header though becuse it's > not needed to be exported). > > The major thing got removed in patch 4 was some random checks over uffd ops > and vma flags. I intentionally made them all in patch 4 to make review > possible. Otherwise it can be slightly awkward to reason what got removed > without knowing what is protecting those checks. Agreed. It's a shame the new API is not a proper replacement for hugetlb special casing just yet ... -- Cheers, David / dhildenb