Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1811281rdb; Mon, 9 Oct 2023 03:58:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGQ+gQxRcY3IXjO+qN9Aw2w5ANsdWd0REN+djDI0sDqquYd1+CmhH1JaqitnSL4rG1IobML X-Received: by 2002:a17:90b:1bc7:b0:274:589f:ba35 with SMTP id oa7-20020a17090b1bc700b00274589fba35mr12789044pjb.8.1696849122127; Mon, 09 Oct 2023 03:58:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696849122; cv=none; d=google.com; s=arc-20160816; b=Wl4AMFD/71rcZ6/OUy5m3ditwtMjK/Xcrvxr7tTa1euHqThyTY2HvYMf5jQ/lLN0et zHIj49G3GQW5PY+aT36Q6ZNfDezrFI4nZ8KudyRxCj4f7Of3M+90kFovS4Yaep7YX+4v JXBa4rL4++X0N35g8oMfHfYBxj4ZhOahbNM9Stxt57xEdpRLv8KIwJ8TcmAPoJRR/PAD E3rpH7gOdpOIaKcA/jDwQ4Wy5BZtIHtHdzn1TKEVAcgIRbY1XkSnioBlRE0eK/8eny+e 7yJjUyhBcVR8Wm3eGuY8TgWnvbBxSdMUKEbPkVVCj4qLkLBClYG3y85MpEQd9vblL/6c ysfQ== 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=YzLL1G0qF6PiA/KiXED8CaDBkXZW6W2mLUBIekhrQzw=; fh=HWWjbDwmd1SQmQFkIQKZa0ltFhef2N+P5cXqkJVzd/g=; b=F3wvratnc/LsIYSBUAHlnTc358KZQpFZGEO4LmgJpE9IjDQsWjmw09a4Vt7ORb0FRH EqJyn2F70/ItuqLopStrq9unkEoOHTqiD9MMnMqSu+6a0MRSPQZoE/NfbvuEZq4F8jzD BmFhl/aJdzA6EP91jTa6Gr+FiJlEzkYsV5pjT90hdZ29Q68MjTwPC3MdZ4e/d16bFwdr 7YQcWwmkKqLYMaed3/o4R2laxTjbe1YLM/wsJzbZO9ig1z3AECrYlNZ+oW4mh3dkE9de x8rd2RwGqEi/FwybUVl6nuXi9rHZs3joQ9y6osKJ/DwQIFLubd0IUSFe18Ll8l/qqcmx r16w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DZye6kFS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id gb17-20020a17090b061100b00273ede74018si8976362pjb.187.2023.10.09.03.58.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 03:58:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DZye6kFS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 82DCE8020B4F; Mon, 9 Oct 2023 03:58:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346146AbjJIK63 (ORCPT + 99 others); Mon, 9 Oct 2023 06:58:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346133AbjJIK61 (ORCPT ); Mon, 9 Oct 2023 06:58:27 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD4E49C; Mon, 9 Oct 2023 03:58:25 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15177C433C8; Mon, 9 Oct 2023 10:58:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696849105; bh=pFDYRue/bKj9ILdCpjBIpmgz7Ku880Uz+C01332gWuE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DZye6kFSL5tEFdCjs6MTkk47EvSnsY2Nre6JIrO0oUkmZGhBkTxD4fw/6M2ik+6UH OBaW2AcdSVzxvRAfU1YsDqLBjItnHo70Xgcre3gbmhvUWUzhYCbuvppcC8n6ovUbbA d2gaYsklkkBN+k3GvWEybOTdQ5C1+tnV5e94K8VhIoaemsBCW2K8ZjCL2ZXvcf16s1 5SaqClDch5QdecmGk5sGuuGEFSyBsRwtoOfrh0YVFUehMqY0IeJyh+z38Y0DD48uJL 38td8l2QsNxmDuvBATmuYgSS5bspoLX52/Z+cHkY3hZwtfyLyK+leO2tkdvVDxhbvJ 4GwmYAnYaJZTw== Date: Mon, 9 Oct 2023 12:58:21 +0200 From: Alejandro Colomar To: Mike Rapoport Cc: Axel Rasmussen , 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> <20231009084247.GI3303@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="W7HwIlpxFh93S0s/" Content-Disposition: inline In-Reply-To: <20231009084247.GI3303@kernel.org> 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 morse.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 (morse.vger.email [0.0.0.0]); Mon, 09 Oct 2023 03:58:39 -0700 (PDT) X-Spam-Level: ** --W7HwIlpxFh93S0s/ Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Date: Mon, 9 Oct 2023 12:58:21 +0200 From: Alejandro Colomar To: Mike Rapoport Cc: Axel Rasmussen , 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 Hi Mike, On Mon, Oct 09, 2023 at 11:42:47AM +0300, Mike Rapoport wrote: > 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 >=20 > Reviewed-by: Mike Rapoport (IBM) Since v2 is unchanged, I've added this tag. Thanks for the review! Cheers, Alex >=20 > > --- > > 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 f= eatures and the generic > > .BR ioctl (2) > > operations available. > > .PP > > +After 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. s/responsds/responds/ amended. > > +.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 defaul= t. > > -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 > >=20 >=20 > --=20 > Sincerely yours, > Mike. --=20 --W7HwIlpxFh93S0s/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmUj3M0ACgkQnowa+77/ 2zIljg/+O+XKXPmc+OxbhyCJMh2jHqOEpdFbUq6rqZM6ZkTGGSD+G4lM4tN7QNvd 9UYN/jrxFq/Og4zpCYULSxSqYwgnKC25e3l2KNK0wT49D/T05vl/Fq2zQSD7lL2/ 303w2aAKijCdicWZumFytoUxAVybgHvsDGqgyq65w57muAWV+mSQjIQYnpXIvBKw uA1wncaMpXTU0CG7uehIGbudIRrc1FpmNp1yPjSMyCeN8LucS8xTOwDOaf1a1Q4L X4pgP/sr8t2uKC/1M9rnaA8GvhZp9vwxHBJxBvKyVhmkoiD8Fc15AtjI+OBKuo60 6Wh2jsrKQZsSeuYU/pITUO2XszbckymBatAIQkAbMPsQODthglIfb59GGCTxLoVU MJ88Pguc/WaSFz06T+AErgJaT94dnup4o2oDSloeQ+etRR0Ooqf5Dsm2cImRoIMt wKwYcJuYivqex+y85tBiD3UMIrKzpyyb3oTaYEfHMWpAzQnUYS7HJ0TAEW+pLF+f g8G8SohJkpxpkZ4SQKfs719tCB7qkUR0ToQhi18q2vGaQMjbFU48xZKidyV8bBju HwU2DpsYG6Iw0F7K1dcF3lACdvMhcdbOLygcM+tSDGD2asntQ6qEMn4EjgX18fCg kOLjOIYUJRaGMWxRBetts4DI41BN394UznxLu93XjJ+WVdSwV3k= =BdwT -----END PGP SIGNATURE----- --W7HwIlpxFh93S0s/--