Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1540428rdh; Mon, 25 Sep 2023 16:36:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IED/zvJpDbe5ytzZys4gmE8LZ9206BLSAd9G2fPYR5O76qDgCt/GpOyhQ/VhWZOItTSEfaM X-Received: by 2002:a17:903:1248:b0:1c5:6309:e1e2 with SMTP id u8-20020a170903124800b001c56309e1e2mr9376645plh.48.1695685002026; Mon, 25 Sep 2023 16:36:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695685002; cv=none; d=google.com; s=arc-20160816; b=rllqIkLHM4W60fRiO80IrEUACMD938V4oC1i47tGDA15GO2yJPpn76eC57T6p4XiFB xzy74iyqkUOvjrAldyWPg9hzYArIFV2movRCWviUVFEdiktZSZL6nOu2IXJq/qWupWsl QCRG3j5q/qmmi+vGFJLiEvhRoWKaV3YsrTCbMSsxAGrUPDtX1H9LznlouaW+Q5NbEMOv Dw/EcQ6w62OptslXRIDYOsRDFr7UX0lbyl2noy4k+b9AoHMEcVIoyC3n8wr2C1Hl7VD3 W4tpXDhkOt+90bbLKVjvfVBhk/nYtUptXkGRKoPzi5SDg65ACOOqiWVR8IeePBGqMjyj r6Hw== 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=bcZ7BBXv8BSZCIjKtUQKuplu7CxDOXoI9XGZTdkzV2c=; fh=wtPNz5QEtytCPPuNNoj9k3ZLKUvhc5S3xSbNrMwZr3o=; b=DX87ZjfvgQijWULyK/2DeZyGvPnAgigFSTGyEKvqF8sVY3JYYf2jp2A6llsMwkpHgf RuiE+3s44OGe60IryIf7AzcwSYIW3UlgszI9va82eBqccStCObpgmw21TOCxWvMO/7aW zKIYXiFModQtUY1HLsmO6mXOGMItflGYeoTw9Y2csvFE0J8TFDdLN00Qzp8558QMbeYq DGMji0xB8WuXUZW/bROdmfTsmVAbclHPApYM+hIIY49VkMkct+LnUp9v0empg2lPDb/6 GCTjCD2BbPzkmadGSe2c0eswu/yGLv+WY4VDlMTlDiDjI9BL6LMsd2o5CeOunH0RWvAW lHZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="dmXc/1pX"; 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 q15-20020a170902dacf00b001bbb56b34e4si12010865plx.331.2023.09.25.16.36.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 16:36:42 -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="dmXc/1pX"; 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 7433E801BCDD; Mon, 25 Sep 2023 16:32:29 -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 S233538AbjIYXc0 (ORCPT + 99 others); Mon, 25 Sep 2023 19:32:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230125AbjIYXcZ (ORCPT ); Mon, 25 Sep 2023 19:32:25 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17431101; Mon, 25 Sep 2023 16:32:19 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84CBEC433C8; Mon, 25 Sep 2023 23:32:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695684738; bh=g6tAy6hdSxc4KI8v9obT1Yl+ADKftmXOjG6GSK2ZkhE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dmXc/1pXGW2+/HEeumfywZ51IU4Hs5ACQTZujqaS/qyTSxTlsOeh8HFq8IulI9qqu 1uX2Fb+M5C9jdIceHxJ1lmQxiJY1GZm8asgiujFw5MmKrRdh/QqKflnkizvac1oZAB 57w1VbzOAW4CAdDxdRUSaAZ1MUUHO5yPdcSK6Pn0pNnC+iWKqOsC7AOJ0o67I2FRR7 sdLEBHKlWv1K4WaxL5E4yVIntF7vVbXJMupEw8UY/QrIXCEeSO57MNDIjKjWtiWMh9 i66AoBMSH7j1uMEHB8iVA7n5QrRXc1LJyz/LJhnIATMmUI/mgPf4X9RUbC+8AQotBg SRix/cACrcuKw== Date: Tue, 26 Sep 2023 01:32:15 +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 03/10] userfaultfd.2: comment on feature detection in the example program Message-ID: References: <20230919190206.388896-1-axelrasmussen@google.com> <20230919190206.388896-4-axelrasmussen@google.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="7eflzcifipfkwrsh" Content-Disposition: inline In-Reply-To: <20230919190206.388896-4-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:32:29 -0700 (PDT) --7eflzcifipfkwrsh Content-Type: text/plain; protected-headers=v1; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH 03/10] userfaultfd.2: comment on feature detection in the example program MIME-Version: 1.0 Hi Axel, On Tue, Sep 19, 2023 at 12:01:59PM -0700, Axel Rasmussen wrote: > The example program doesn't depend on any extra features, so it does not > make use of the two-step feature handshake process. This is fine, but it > might set a bad example for programs which *do* depend on specific > features (e.g. they may conclude they don't need to do anything to > enable / detect them). >=20 > No need to make the example program more complicated: let's just add a > comment indicating why we do it the way we do it in the example, and > describing briefly what a more complicated program would need to do > instead. >=20 > The comment is kept rather brief; a full description of this feature > will be included in ioctl_userfaultfd.2 instead. >=20 > Signed-off-by: Axel Rasmussen Patch applied. Thanks, Alex > --- > man2/userfaultfd.2 | 7 +++++++ > 1 file changed, 7 insertions(+) >=20 > diff --git a/man2/userfaultfd.2 b/man2/userfaultfd.2 > index 00d94e514..b2b79f61d 100644 > --- a/man2/userfaultfd.2 > +++ b/man2/userfaultfd.2 > @@ -881,6 +881,13 @@ main(int argc, char *argv[]) > if (uffd =3D=3D \-1) > err(EXIT_FAILURE, "userfaultfd"); > \& > + /* NOTE: Two-step feature handshake is not needed here, since this > + example doesn't require any specific features. > + > + Programs that *do* should call UFFDIO_API twice: once with > + `features =3D 0` to detect features supported by this kernel, and > + again with the subset of features the program actually wants to > + enable. */ > uffdio_api.api =3D UFFD_API; > uffdio_api.features =3D 0; > if (ioctl(uffd, UFFDIO_API, &uffdio_api) =3D=3D \-1) > --=20 > 2.42.0.459.ge4e396fd5e-goog >=20 --7eflzcifipfkwrsh Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmUSGH8ACgkQnowa+77/ 2zJTTxAAlq3w3g9XKdtWdAY0IFZ8OLHqDNS4ORRDwwc6CYY0LLe7lTDsHVO0jDTl Bl4F7WF+OcvPNu9gVwI9Ry8q3uZlOkr6WVi/2wvYV0j6FOmcYf1F4s9mRADGaadZ qvjuQbXsXfV6es4zi1j7HpoJ4mh2UwWyYvzm4HHaiGFCeErkj7JOUPCiIY0YjtCu HZtSMtKEzq8bhawccBa1yKABrKteu/zykDuo620dybqiDivfrvpLwjRJMJ+uZXXQ wis+GPLry0B6ZmfhzIptVQVsm/03bNZU0YrCyGU9VoX/u6W0PqQHRmuedX61F0XI 8BmVBRpEL7F1tdGe6nCUpWmVVHTSAcb24L2hQ6n3eGOWPDNL3wAXbsIy+Vxfa5nY DEkIttpfc4sdfU7UEJ3y/hWkZX/ZKm+CI7opeqkyiw4Qg+sZQGjgudeZ0mSccert xgpsLgPT02ZCEqoEFjAK4z50PSrhVxycja1nbMd5ycUzS7Uy72+izckT16YsFf5b kgvxXo4BEwps4Sfc2yhXejuVwixzvuoBfTR+GXaiLSfyj3ai/No7wtQZPt2myXT2 A7xnYpqfR9ilNaug3ZiXY+e28SAcKWCRM8OpEqIy14RKEzkMhf22zzfE6rBOkQ9g u0wgcrNXyq4RBjKa3tQxnYeB2/3nNgAK8AT2jgKwZZ9XrFfYCCI= =hPpM -----END PGP SIGNATURE----- --7eflzcifipfkwrsh--