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 13FF9E81806 for ; Mon, 25 Sep 2023 23:45:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9E1D18D004D; Mon, 25 Sep 2023 19:45:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 991AB8D0007; Mon, 25 Sep 2023 19:45:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 859CA8D004D; Mon, 25 Sep 2023 19:45:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 7613C8D0007 for ; Mon, 25 Sep 2023 19:45:06 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 4E85CB3D0C for ; Mon, 25 Sep 2023 23:45:06 +0000 (UTC) X-FDA: 81276753012.26.52CA4A3 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf19.hostedemail.com (Postfix) with ESMTP id 7AB441A0008 for ; Mon, 25 Sep 2023 23:45:04 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=as8ca0R+; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf19.hostedemail.com: domain of alx@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=alx@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695685504; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=sMmFCeiOJ4O8oCC74btqEjTxI+tZgUw+Fsv0KNyIrY4=; b=dVCGu0pbDbFSwlddLnURH4iQZ6yI45DwI/x4ZUF/zwisBCp5LsAGjTSXMQSh27RNWDpnTm XDjagoQXEymohc/1SNoMnwXlTdMip82jCU/uQwUfzgpsOnjfVmKLxJT0vu655PF7tWqHsT lyTkuShsHnivJWJ3y26vhq+9I6tx74E= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=as8ca0R+; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf19.hostedemail.com: domain of alx@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=alx@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695685504; a=rsa-sha256; cv=none; b=ck//XpkzAJY3AojzgwqFnvlv3SKNjTZIjuw/41q+xTWfKJxq0DutDIcg8AWn0mvZvTU04a 1toHlZBGsGNuC1w+NyTVDrOWsgqj5UAP0Dq7XCh8w/URrghG4pz+O+SH9xGhkzsr7nEK8L P0eVmMl67YO9w+eWPMsri4X8ZSgG3z8= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id BDC1DB80E7B; Mon, 25 Sep 2023 23:45:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAAA0C433C8; Mon, 25 Sep 2023 23:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695685502; bh=5hXy8gXAnPDRA/xb8in5bDyRmvowKWkabeT+gdxcykY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=as8ca0R+9XP+3xiFd0abvvG0SUUSVmgd+ABk/M5q3hoWP807wRs3/6dR5+4btuG8X oIg57aaXW5Xqj3qTj6GZXdtfoJKIfFOnxU3vjrAgw554cmpUM/mc4u+3ggx9UOmO58 y6Jq6ANkLSHoPIxFDSO2NTS2Yccg7VnhIUZsvMG23aG8tcRb9NIMIhPm8pxgUv04+4 o4kHDfS/pk1oFJHvhXvfq2a9sa0b7Snj6hJUrVqZa6oI3UYUrhH2YhNURQztPYKGBD 6Cfzh4WxVdKhBiHO8zzNvTIU1/uQSCP3KYm2+Ie+usUwua5vxOHs/JkGqNCS890dk5 IviICiPANzP7Q== Date: Tue, 26 Sep 2023 01:44:58 +0200 From: Alejandro Colomar To: Axel Rasmussen Cc: Peter Xu , linux-man@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 05/10] ioctl_userfaultfd.2: describe two-step feature handshake Message-ID: References: <20230919190206.388896-1-axelrasmussen@google.com> <20230919190206.388896-6-axelrasmussen@google.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="p2il7vkfavf2qb2o" Content-Disposition: inline In-Reply-To: <20230919190206.388896-6-axelrasmussen@google.com> X-Rspamd-Queue-Id: 7AB441A0008 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 8kgyxyat8st5of1q6z7w3osy931qhee7 X-HE-Tag: 1695685504-521143 X-HE-Meta: U2FsdGVkX18cjpdW5OWmKlfADvW3vIHXCoPJ6wn9FSrbRxuDnDglx/9fEJabOl8KyKmj+q4ON37aoG7JuJoAShCpHbDz1/87DXIAXyTgeW3yLjcNoHxOyc91H8uEXGJ/BbYySwiU9MRCWJtmf8H8VX6DhXL39HeF5B+7HzbD0mJGLcDFkN0iniZpwKGgpPqjyI29KKr9DidkExwnWg5F/ME/zqrAJLi7abKNy7hpvkBw8njTfMKGxNlqtj0ksbg3/3fn7g/TlMMbUpeFHAgCb6Z1Li0+M+Hy+GS4v/AkBx3Be/7e8+hiu5ZCHdxBfoWpsPjb+FdCrRcFVCASCn9LpvReQ+dQXa+Vdnr6Kw5OjwvLIJItCyj+C3lyYo742Vx2+t1MS90uTNgeGCLF9UaSfzuNLVX3Gr4YQLLjlOLFWtHrA0MF0B71iCzDrMEvRNe+bMFshn7TsiRZYQaNAIadD9eXJk5iELFXonyoAJqDe1NGRL8ul2O5aFDF/XxdTscSaS0r4ztUsS8UDyv6fBhRYUSBQD7WS1mRXWWocto8QvJi7/KFrKq/x/VFWEYGX2nzQbt/CXFXI5UBcMoPczQ6JeQL0IOcEmIRIcN3lDIibtvyZQzq1W9PfjgN39e5/WLQgfP2xvmacS+2HnhAKX7ZNxQ3xkRtPE/HAf+mFtJ5H3utVQzKxG7HwLhvBUIsjj7o+qRSkrdGLU9DM+gvV4Ylij5QZLSp7rDHaeCXjYwPEKNiQJJHQxacE1dF5pMdf5Zfgo/bhKmqLEAW8Cuc+y3Mtps1UAKQis0PC4b1N/g3lnYGkdWKn3zUZ7ZTqapkf099ojJpThvfiwHAbrdDLfifz2nH5OM4jihvh646Ep4EG3B5BbZx84oOa3a7QUfs8ZzypB2ACQFI/SlJrlkf1mQRlPlVl4Cd7HI8f9Tb35QoDd+9CfNeRXp6w7z1W59KfwbDwvz0Sjat8wv7R8LTn40 Xg9myi+n WkU3+KvDJmdwxDJwwmhqMTZn2SQs1iPiz1gztlEYqqHyu/9/NU+fto1iMFIZcx410M5jiBvyMZi0SeDVr+bqZDVGtZAjZCsyOOy2hM7h6FSh8Ae8HOdfu9UBNgGBABYpmzAhghDfdG7UoR6eL7AgyXSaOxY6fGGNdSlBmCRksG8P9dfbVN5QezToh5H0bFIUZGrrYMDsi+NewD1IiTK7TSe3/MLE9CjgKcOuFzVvWWWVShBhsLbGVU0cTGfA1Wtwvb0mid+nwKKiI/tvZfZyQ/B2GJE+Rr8Fj7EKiWgaV1bLa5mtRckJH66pINvDqiUwQ4idzv5pta82K4KEu04sJYHJPdavXx6FaYQLZDuq78KkFUvw= 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: --p2il7vkfavf2qb2o Content-Type: text/plain; protected-headers=v1; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH 05/10] ioctl_userfaultfd.2: describe two-step feature handshake MIME-Version: 1.0 Hi Axel, On Tue, Sep 19, 2023 at 12:02:01PM -0700, Axel Rasmussen wrote: > Fully describe how UFFDIO_API can be used to perform a two-step feature > handshake, and also note the case where this isn't necessary (programs > which don't depend on any extra features). >=20 > This lets us clean up an old FIXME asking for this to be described. >=20 > Signed-off-by: Axel Rasmussen > --- > man2/ioctl_userfaultfd.2 | 37 +++++++++++++++++++++---------------- > 1 file changed, 21 insertions(+), 16 deletions(-) >=20 > diff --git a/man2/ioctl_userfaultfd.2 b/man2/ioctl_userfaultfd.2 > index 339adf8fe..e91a1dfc8 100644 > --- a/man2/ioctl_userfaultfd.2 > +++ b/man2/ioctl_userfaultfd.2 > @@ -83,7 +83,6 @@ struct uffdio_api { > The > .I api > field denotes the API version requested by the application. > -.PP > The kernel verifies that it can support the requested API version, > and sets the > .I features > @@ -93,6 +92,25 @@ fields to bit masks representing all the available fea= tures and the generic > .BR ioctl (2) > operations available. > .PP > +After Linux 4.11, "After" to me means that you're not including 4.11. You probably mean "Since", which would be inclusive? Or do you actually mean since 4.12? In any case, "since" is more commonly used, so I prefer that wording, for consistency. Thanks, Alex > +applications should use the > +.I features > +field to perform a two-step handshake. > +First, > +.BR UFFDIO_API > +is called with the > +.I features > +field set to zero. > +The kernel responsds by setting all supported feature bits. > +.PP > +Applications which do not require any specific features > +can begin using the userfaultfd immediately. > +Applications which do need specific features > +should call > +.BR UFFDIO_API > +again with a subset of the reported feature bits set > +to enable those features. > +.PP > Before Linux 4.11, the > .I features > field must be initialized to zero before the call to > @@ -102,24 +120,11 @@ and zero (i.e., no feature bits) is placed in the > field by the kernel upon return from > .BR ioctl (2). > .PP > -Starting from Linux 4.11, the > -.I features > -field can be used to ask whether particular features are supported > -and explicitly enable userfaultfd features that are disabled by default. > -The kernel always reports all the available features in the > -.I features > -field. > -.PP > -To enable userfaultfd features the application should set > -a bit corresponding to each feature it wants to enable in the > -.I features > -field. > -If the kernel supports all the requested features it will enable them. > -Otherwise it will zero out the returned > +If the application sets unsupported feature bits, > +the kernel will zero out the returned > .I uffdio_api > structure and return > .BR EINVAL . > -.\" FIXME add more details about feature negotiation and enablement > .PP > The following feature bits may be set: > .TP > --=20 > 2.42.0.459.ge4e396fd5e-goog >=20 --p2il7vkfavf2qb2o Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmUSG3oACgkQnowa+77/ 2zKFCA//b9J4YsNEWsxijeXSus+8OQkpMXymStaVl08Cn/oNjYqw6K87xf1KMpzJ SlJvwchbRtGA1QNEJytTd1fp49ykSQqxeenktMvqhY5pLRi0PK6lrRkHf3rRST/F 6NxNqfTB7N56xze8qnzL+OLx49vsZoGaPO3GJnYej6WPyl9NOu0sB6nZf08b22gV Fxiijitg6eSN2a0KcItYoXhvE+aH7a8sh6EBhnoaIIjk6qT/J9mKtppPSSxqQ8Bk 2ySSlb/R4DzEzXJoqNGPEIHkRBnJnMpg3wzkuenNSTUn1QwKqkIs4EevUMAWAs+V CAA6/veM8DZgeN6hlVsadQogIxHCecRqgL5LyUvsTuAxs9kjNm1jrFgmS4iXywol xDAaD3BS8Q7EhZAmkdZ0SPWDMr1+cM4RSUKF2wl1+zo423elCoBQK3J+QvijmdEZ Wcj+QLt3T7FAeYDW2hMO0arFqfUaPA1g76AWdQ5vYTZDO+y4mPdSmHOhaY43kg+b FPe5WPOuY6267g7L3GoZnv3zY6/B0rqytSa4JYhEAkXiNtqg+JJC2kGk9OwQFpZB wpf6EgeJHYA42NxXtnRM1ZFOSj7q0T5y2Dch+w4Td7vPp8JYmwoiVs04JJX8sXfk RZqiiOs0207xmydjIrP5oymj+7d1LmCqCJd/C9DKYdDE9bTHSGg= =iKJ7 -----END PGP SIGNATURE----- --p2il7vkfavf2qb2o--