Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1587956rdb; Sun, 8 Oct 2023 15:24:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF4xiIImLsndOgZefUPSckJAZkzMEooIVug1+owmJS7+Q0BRI0K4FWj/xqtWjkKooHyC5cV X-Received: by 2002:a17:902:744b:b0:1c3:d9ed:a410 with SMTP id e11-20020a170902744b00b001c3d9eda410mr14024925plt.59.1696803852489; Sun, 08 Oct 2023 15:24:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696803852; cv=none; d=google.com; s=arc-20160816; b=IaaRwYP+I+lYi+7snYYKH45302R75uKVFDgy478zN7pO0iNrOlv4q1s7MYTwGQU9hC dKlEq9JnXBuqClQaMDzsuOM86HoRnBzfxGPWPDX/V32ZGI0Iv2XQdBQT0BYRHj+aToHG 7JveTukaPbENWGlpsoon/WlzvlylG7llLWzeGgUbV7TXWv8UeTw/aYEVF68OMVMAi/2X YuAkKJ874jIqYDSv2o2T0D2mN1kKmsUE3RxKguBhyOQiHT0MHrGbavc5uKvEx2QAjmwZ u9paVS7rexN/1qAVRZY0eSJynGG81ARyN0+Z59SxcmCcPJrEIQ030mzPxB8F+ByrWziT TuSQ== 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=cBIQiBqTbAcgz7sVOZYS9rXbx6+1QZlX+KkE8JbWXPY=; fh=wtPNz5QEtytCPPuNNoj9k3ZLKUvhc5S3xSbNrMwZr3o=; b=jPLay4+S3Uvu4o6xVAQZBTkB06ZhX7ILRrd1rCE9PHayMEvhJWkrv8cVC3oj2Ddrzi phhj7oucf5L6r8tVp0dgzxyvgDrImf32zxVw06wrPkTH3qlrrZ31gpKobJ0CF+ecSwA0 T6u/FYDlPWNGkJUDMX9ig1GPqB+2IRAGaBx4o+Q3CDbCtnLxzqN68Gd76XHpIIHy8tlp uI2S6RyNBM2TH9gRU3FTCXMhzNbc7lzeVxqXL6aO8Hy6xj1KwN5FW2jBYXJ04zRbelGf avEVylFDcj6FXT045PW+bBmHE8hkPRnv1OtS0YYpSyCRuN2R39+dBDgJUyNtcN6lBJd+ WpXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YKXgdQRz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id q6-20020a17090311c600b001c732b6869csi9037489plh.63.2023.10.08.15.24.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Oct 2023 15:24:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YKXgdQRz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 114A9806301E; Sun, 8 Oct 2023 15:24:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344809AbjJHWX4 (ORCPT + 99 others); Sun, 8 Oct 2023 18:23:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344437AbjJHWXz (ORCPT ); Sun, 8 Oct 2023 18:23:55 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAB88A6; Sun, 8 Oct 2023 15:23:53 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1183BC433C8; Sun, 8 Oct 2023 22:23:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696803833; bh=xnpzq4wUBG/q3NOSKI83ekFwJTD3ZZprq8GYkFyKFUI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YKXgdQRzxz98aBdg4Lu6qe11VhTNIeyrgVUmZMIZ2tm8BujGs4Pwd3iI8w5KO9dur U/kHZbKiae+9ZE8wKBaAtWHmP/7swn20fYA0ByglqLQ3RJE+DpxozNNxVa/GuXt0n3 qWg99YOGA6LJKEKNmktIL27OIuLXqyslNf4E3WhctIMgBNGJ4q8Xkgizny5HiG9dnU YcdcXrgXLpwmZaBDqpgKSXC6hFEF7j69svBwQtioD4BYondUv9QjBi9Z8Pw9WcDmRA lsVV3lY2ESMlJIVfbUCXDco+v+xgEdq+KDHrbxKZWfpoQeQpf47++uSCg4Fg7F8lIg wqfgWGztaCCNQ== Date: Mon, 9 Oct 2023 00:23:49 +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 v2 1/5] ioctl_userfaultfd.2: describe two-step feature handshake Message-ID: References: <20231003194547.2237424-1-axelrasmussen@google.com> <20231003194547.2237424-2-axelrasmussen@google.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="IEa6GDqAgBshCuXi" Content-Disposition: inline In-Reply-To: <20231003194547.2237424-2-axelrasmussen@google.com> X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Sun, 08 Oct 2023 15:24:10 -0700 (PDT) X-Spam-Level: ** --IEa6GDqAgBshCuXi Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Date: Mon, 9 Oct 2023 00:23:49 +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 v2 1/5] ioctl_userfaultfd.2: describe two-step feature handshake On Tue, Oct 03, 2023 at 12:45:43PM -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 Patch applied. Thanks, Alex > --- > 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 b5281ec4c..ef352a69d 100644 > --- a/man2/ioctl_userfaultfd.2 > +++ b/man2/ioctl_userfaultfd.2 > @@ -82,7 +82,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 > @@ -92,6 +91,25 @@ fields to bit masks representing all the available fea= tures and the generic > .BR ioctl (2) > operations available. > .PP > +Since Linux 4.11, > +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 > @@ -101,24 +119,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.609.gbb76f46606-goog >=20 --=20 --IEa6GDqAgBshCuXi Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmUjK/UACgkQnowa+77/ 2zLptg/+P9U2SpowseEvKRg0lV7o/eyhXKRhaPF4TSMq3GLRcTCcSGj/VGCew/nO bz/9ClFGKbXgPf1eyRMwds14/3NhCMf6I6GlCvbhs2dKgXf2xiMYaCZ0L0AtDg/W a9VK6k6BO58V/WEbIQgf3ckY7wJpLpIlcF9FQDSe/5az4DARKxEqhdKoP0OvAIbQ bkBl/BGwaOlJTc/ByTzxJvFZYyUUjp1t0Ae92ydSlFdYSe61Q1QdvxVbVV7c9sUO WXW0Osn3eVe5XjlAttZ60Q+iQO3bnGNOX8gLTZlsTBp52stvmpt+YipmkVqTSE0Q wXNjcgqfgWtkZbvpuWTiQ3YnhWn0WPaQ0EO9KQacIaQnRS654AK6tQZoBUgwO+Nh jiZjvroZ8Fj5QYvzB5KSlsVRL1HHITd0mIc1xA1elks693jDwkH2QjJjUZS+EkZx 9p9ZGbYdGxrZiM5fUoML2GsAEtFDQODorER8FzzzaOoobjsWCQudfUJ9BfmhDrPC Do5cHT8J9ARZJes+Z4yBF8xqPaXRP++QLs7jln3vhr3R5yvQSGVRGb3SoyIiO9Js uDXOdS5GrQhVtXECJVGTL0GXk/NPvj7YAa5/jeU0oYSm6A2b0tnLhY9z4slexLbV mTqiDNna3dTumwPAuGYVY6d2x5QdN4Wql2jhn4roOaONH5W4qPw= =bV+4 -----END PGP SIGNATURE----- --IEa6GDqAgBshCuXi--