Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1543385rdh; Mon, 25 Sep 2023 16:45:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG6dNCDe52TaodAN0a4U58aWDaS7IsdqZkqL5ObhXGaBWV81f1XgPyEqetoteqEn3XmRJcM X-Received: by 2002:a05:6a20:5618:b0:153:588c:f197 with SMTP id ir24-20020a056a20561800b00153588cf197mr5716186pzc.35.1695685508247; Mon, 25 Sep 2023 16:45:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695685508; cv=none; d=google.com; s=arc-20160816; b=uZXdWUWb5sBhmo0Veqc9pm1LjEJ6AkLZitWjNC0Io3R5SytHb0xnie9ELqTiU3bwdt OQKED/UNsVnHmtpEPb5/HYh0A81y1SXjVsVtiTUDScPmNVdg8jpDotwwxuXLby+UbMJN gYTD6gz6gFKYNWSFn0/chFp0/YMXmRkzCb2YMWLEWcc9RHfVLt4iNiSNO6J4QkvGcfL/ RUVXigIuFh4bMo4K2oZToIjSoquv7Jiz1A9jrnnvzWu7rC1OHe3cOHxECDZFSsYNZuD8 8EVny39ye+8DA72GCY7yJCQO2GcYBXz0dW+9yPL2r/WuE7DbxMBOoUmzczTF07my7aVO qFyA== 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=sMmFCeiOJ4O8oCC74btqEjTxI+tZgUw+Fsv0KNyIrY4=; fh=wtPNz5QEtytCPPuNNoj9k3ZLKUvhc5S3xSbNrMwZr3o=; b=g+7khLcC+T6m0kifKwfIsGYyPeFe3Ok3oUPEG+E2e64Q2mY2HpS3yLQpR6kdTu3l1f llciBrQZjRRYWz2iHCkKeqy/viuRcQnlIdXHHqe/J8EHaYfyFJO7/M9qhJX+Hyod9I7g rFldmQNwtkJ6VKvJn1GaHgkkxpLXtAON/bgWDn2wfCkuQwto3Qea7grT/qNgVCxXkzfU aLla+iQ9lCoKL6JIUPmK67YxZIGIKQQORq0Rd6N2C/SUNzEuuXc35hqt1xFSsPnbOSTC fH3/XhjYqkh+Kc0V3D8jyxITNRGBXoFWjQXowmeMv3fpo/VRTUluHSnu/XETDUdkquZ2 MzGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=as8ca0R+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id s1-20020a170903200100b001c62139b16esi2361176pla.4.2023.09.25.16.45.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 16:45:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=as8ca0R+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 13AD381668A1; Mon, 25 Sep 2023 16:45:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233488AbjIYXpK (ORCPT + 99 others); Mon, 25 Sep 2023 19:45:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbjIYXpJ (ORCPT ); Mon, 25 Sep 2023 19:45:09 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81D1010A; Mon, 25 Sep 2023 16:45:02 -0700 (PDT) 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 25 Sep 2023 16:45:07 -0700 (PDT) --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--