Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1758217rdb; Mon, 9 Oct 2023 01:42:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHtcjNdifdfEDEHF7jFAj98376rgfhes+6Ozjl/pzXCdrzwM6YTU0H+PxWWN8D2jWg2R3Kx X-Received: by 2002:a05:6358:4414:b0:15a:e6ac:ee5d with SMTP id z20-20020a056358441400b0015ae6acee5dmr15181553rwc.17.1696840928891; Mon, 09 Oct 2023 01:42:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696840928; cv=none; d=google.com; s=arc-20160816; b=mtClO7GQnvypoJCyXBMMTGZ5kGw+eUhgl/8XqZ4lGpx19Gmo9NCLbdz/7U1iuCjPMG v8pkseCd3fC2lJFRumvOgc+Bw8mLJnQXPH+KNaxn1jC0GNjsq1TDlez8kqmpXfG0iszu JbTz3pHXwbfVrksUsptzbla3dJ5uR1eSGQIqpiNPhpVD0qeQDBd5p8o/rVHvAMq2rNGL 6PE3GtWy0Dp9RGVxf4hfc04CxUimvg1295jTeJ+vKxxg7m32ZR/pSFDwQwZATDPO9W37 FFGadQJTiZCSKhbIdB1DxNnFO36kLRsPS3emxdcIUsqWxLDEcSxBy+Swui5nYHelw+Ew 4xyA== 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=w3aZlHbnYFmkx4P8ebmDoMvJ74hb1Kth7r4ox0RmoZw=; fh=F5M/07vUqNxvrCSEZSXffLFlrqXZOtORyIukROoamOM=; b=UqycTUXRyXDzKLUatlAvX1m43xqzNDiavw6/TOyH678mJgavkTSOmJlbHaqqI5A63Y 17DFBRLMp7saewsP1C0aim+29KeexGdYQOWO4+2d/H+rksz55B6frjJWt0xn9D3M+7eo tOOMLjjB95Gm/ZVuaO2DkfKHX1qxq7IAeb4Yteih5d17lh5DreuuHqQ/Og/dFJ70vtRc oGuf5jBihTii7HLi80QkfKgZxYPVYD/d8DgXLq6nvj2X9SMbSEyYMD1NfpltlYpJbpIf zlTaXQciZH9eBDgy//w+tKWQ6nwUZ7XnM3oQlmvwYcaHNoTmpHcF1p0an504Q/EMK+OC tc9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mTU2kcR8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id rj3-20020a17090b3e8300b0027660aac61asi12051504pjb.114.2023.10.09.01.42.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 01:42:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mTU2kcR8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 28C73804B879; Mon, 9 Oct 2023 01:42:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234493AbjJIIl4 (ORCPT + 99 others); Mon, 9 Oct 2023 04:41:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234491AbjJIIly (ORCPT ); Mon, 9 Oct 2023 04:41:54 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0578CB6; Mon, 9 Oct 2023 01:41:53 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3970AC433C7; Mon, 9 Oct 2023 08:41:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696840912; bh=4kcb3KJxlv8xCWB0hf9FgeYmQ74is/VJSpLom3fBsoE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mTU2kcR8q/tIZnExeb3VK5ciNJvkkphanMOurKs3FwH6W0csFeiAJIIP1FvK3AlJx cK3nL9xTZf31ZI+s6rz25iHEYD1kwBObTWCi+M/hma15XVAWtGBbF1mZzMYlGuXLLc dcQgBOAdDaA0WykfzWlgS7FyyJwLQzyH1+rQaNCLLbstpF0QporGOPW8xgny+ORqsx wbcMdXOQhL1dRrhaKZMK6LaefQ5DYEHigIkdPNWlUxJxfQoQilqMUTytR9QCKGAoWy j7APXNbcE4LyhT41zUaupAFBMMqdGIm660ETyw2zxuIXqcumqhtJL90PVqRUbudVmP oReRJ5PvA9dww== Date: Mon, 9 Oct 2023 11:40:58 +0300 From: Mike Rapoport To: Axel Rasmussen Cc: Alejandro Colomar , 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: <20231009084058.GH3303@kernel.org> References: <20230919190206.388896-1-axelrasmussen@google.com> <20230919190206.388896-4-axelrasmussen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230919190206.388896-4-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 agentk.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 (agentk.vger.email [0.0.0.0]); Mon, 09 Oct 2023 01:42:06 -0700 (PDT) X-Spam-Level: ** 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). > > 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. > > The comment is kept rather brief; a full description of this feature > will be included in ioctl_userfaultfd.2 instead. > > Signed-off-by: Axel Rasmussen Reviewed-by: Mike Rapoport (IBM) > --- > man2/userfaultfd.2 | 7 +++++++ > 1 file changed, 7 insertions(+) > > 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 == \-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 = 0` to detect features supported by this kernel, and > + again with the subset of features the program actually wants to > + enable. */ > uffdio_api.api = UFFD_API; > uffdio_api.features = 0; > if (ioctl(uffd, UFFDIO_API, &uffdio_api) == \-1) > -- > 2.42.0.459.ge4e396fd5e-goog > > -- Sincerely yours, Mike.