Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2182392rwb; Thu, 19 Jan 2023 22:37:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXuyOCLKFweruh9AaGeYSLlv6whcD/m8M2hioKan/XrJwjfEXeN6wf1K+WV8roW95gYYjQ08 X-Received: by 2002:a17:902:8c90:b0:191:2b76:612c with SMTP id t16-20020a1709028c9000b001912b76612cmr12139507plo.62.1674196626121; Thu, 19 Jan 2023 22:37:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674196626; cv=none; d=google.com; s=arc-20160816; b=YBF7+eRBXuUhk4hOy1INvuvE8h10eB3+BBQT1ywVVqdHpTw9G/l4FjPyQFvQQibXR4 8XmKzUZtBAISXoDEpazDX04mwsomg3K3QLOyAoKDKBhwmZzWfdQnQqMpb4xcj/NatZ/7 ukMa93SQbmsAwRwc9HVeOybEg3mQgy09r/wKVdwEn9acpMc9dNwIY44AOSMJNeLV+8Qt hmVAo9ZCCHRvavByJc05LTvgY5cazXcTbIGiyzhGLES7qDwke0AesK0xuHKh5j1FDqVn qQng3Aa845KyK88rlVJAVifpUCI2yX0ANsg3cHn10rTuOS52Eel61yXEY54Wd1cIFu0l 9/Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=cN6BtsvLB2Tckg44mumtgxFtviJ5L3OzknDmFCnQGqY=; b=Bxkv5eZZxrdyrUXyKcG9GfWMI+IiCCwVHjeN48ufbn68ekIKk8Iy23rFnn0pZsocqD CpI+Tfr3K1LPEizWWaa0X/i3cjhCD/jfyrSG7HTMUYM/rTJwakAsEkVypkj3fsxw1ZRd TtzsnyPpqJgP+cw+aU2fjw/Im3/ZvNL7HpMWRSeacjDzDqE69EFFPBMtmAMGBfUf7KHT GwbgDeCfl0fnn3t8xv2FtUP61nj2hsC42Q1OF2aSYbP0W1cfLxENNVTN6ITSWyCqOPnQ caW0Q7f4AzgI9cH+7ueVEoqB9vsisUSURlgfNV9ZY+WH5IdrRE3m+17nekebG3Eq2xwL lfJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l13-20020a170903120d00b001944983f4e2si32145707plh.491.2023.01.19.22.37.00; Thu, 19 Jan 2023 22:37:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231138AbjATGBS (ORCPT + 49 others); Fri, 20 Jan 2023 01:01:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230527AbjATGBN (ORCPT ); Fri, 20 Jan 2023 01:01:13 -0500 Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C819518CA; Thu, 19 Jan 2023 22:01:09 -0800 (PST) Received: by mail-qt1-f178.google.com with SMTP id jr19so2208825qtb.7; Thu, 19 Jan 2023 22:01:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cN6BtsvLB2Tckg44mumtgxFtviJ5L3OzknDmFCnQGqY=; b=MkEvmD0hNL99ig+Ald1uxCdA5+3HfK+Wmefvgit1B1SbnPnVuH2dMDUOHxNyUdsS1d idQDQ+28pmFGiOTgOLLRM1eaxn+u1ED4l1vlFkarxHVxdfqGWFvNsrCloeTIQS0L6vkJ +2yUldGwUUb4MZDjmGf2OO+PDIfj11TEqAVKnCU6fbkp1qUMisfRxrfQ97Ib1OvtxIIz Fa9nRX7wKEW8w+cyltFV6SqnsCehJIThZPDujDzf91YAauezjddtZwq/1SAft74W2GY7 2zrltY6Hbae77lp6egYXIpkMnv8lkW63Mur+XbNwYG46Bz0CH8iqaYSj3/tsOV/Rh4/T qa4w== X-Gm-Message-State: AFqh2kqQ4EPCOEZuYh3+eyv8kiTngyJU7DciBIfxcNBodOcUUwFWh4El v7JFiSco08bU/9FvqJNyM9c= X-Received: by 2002:ac8:718d:0:b0:3b0:11a1:3140 with SMTP id w13-20020ac8718d000000b003b011a13140mr15959656qto.43.1674194468834; Thu, 19 Jan 2023 22:01:08 -0800 (PST) Received: from maniforge.lan ([2620:10d:c091:480::1:2fc9]) by smtp.gmail.com with ESMTPSA id m3-20020a05620a24c300b007055dce4cecsm1889102qkn.97.2023.01.19.22.01.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jan 2023 22:01:08 -0800 (PST) Date: Fri, 20 Jan 2023 00:01:12 -0600 From: David Vernet To: Alexei Starovoitov Cc: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@meta.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, tj@kernel.org Subject: Re: [PATCH bpf-next 7/8] bpf/docs: Document cpumask kfuncs in a new file Message-ID: References: <20230119235833.2948341-1-void@manifault.com> <20230119235833.2948341-8-void@manifault.com> <20230120055906.m4pkchwawfxhj6ze@MacBook-Pro-6.local.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230120055906.m4pkchwawfxhj6ze@MacBook-Pro-6.local.dhcp.thefacebook.com> User-Agent: Mutt/2.2.9 (2022-11-12) X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 19, 2023 at 09:59:06PM -0800, Alexei Starovoitov wrote: > On Thu, Jan 19, 2023 at 05:58:32PM -0600, David Vernet wrote: > > + > > +For example: > > + > > +.. code-block:: c > > + > > + /** > > + * A trivial example tracepoint program that shows how to > > + * acquire and release a struct bpf_cpumask *. > > + */ > > + SEC("tp_btf/task_newtask") > > + int BPF_PROG(task_acquire_release_example, struct task_struct *task, u64 clone_flags) > > + { > > + struct bpf_cpumask *cpumask, *acquired; > > + > > + cpumask = bpf_cpumask_create(); > > + if (!cpumask) > > + return 1; > > + > > + acquired = bpf_cpumask_acquire(cpumask); > > + bpf_cpumask_release(cpumask); > > + bpf_cpumask_acquire(acquired); > > + > > + return 0; > > + } > > As the first example in the doc it was... alarming :) > I've read it as it says that bpf_cpumask_acquire has to be called on > freshly created cpumask before it can be used. That's fair, I treated this example like a testcase :-) > I've started to doubt by code reading skills of the previous patches :) > A basic example is probably necessary to introduce the concept. > Or this example should have bpf_cpumask_set_cpu right after create and > more alu ops after release with comments to demonstrate the point. Makes sense. I'll update the examples to be more clear and reflect realistic use cases.