Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2187874rwb; Thu, 19 Jan 2023 22:43:12 -0800 (PST) X-Google-Smtp-Source: AMrXdXtWYUgchqcJsl0/4jb+GkGnoJ4wsqXcdolj7eTGogSPi1RCXFcE3ZEF/ABCRN/8B2nZsLQQ X-Received: by 2002:a05:6402:27cf:b0:488:e7ae:5cc4 with SMTP id c15-20020a05640227cf00b00488e7ae5cc4mr17915736ede.41.1674196992591; Thu, 19 Jan 2023 22:43:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674196992; cv=none; d=google.com; s=arc-20160816; b=SAjQ2vCygtxKxV6fFW8mehM6IfvTF6Ddng/sZHKKYV0qSB4ueNskdbe2IZl6ODk3fx y+Yg2nfDPxfsORmy8PWM+bI6RS0Hb+pkFxpKbaqaVYcjB2iERkfroMZUgnI8/FsG5gFQ H4+gqWydLv8Mep/FLQcoNnHDi9WiW1oIG87TLR4Xcu96iz0/jIz9XDQqvAb/5R3AoEum Aq64PfJFtEirrvl5z2BOIQm5K9+RdhmsQ/TihHBeTajaYoQuKqSItO7fzQ3y++0MG5pT Kr9P+Ecu7B4z7zabma9CXzj+MCIQtYGQQ9gIzCwynlQSKXbgOBbmVfDVrwm3IhZh6d2q N7pg== 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=KtnXlmTpuc06EMMN7aGW2IlZGwG+DgNxDWRhTtH1Re8=; b=UCXx1qjUcQRf3sf5oGP/CHDOAa24N7oqbPOeAwMXqSQzgbHSjXrdUOEoezvpXCk0OS zzoZfPdjFr92sO2L8Od6by18UymCIykvkX8TQLfK/f4ndeupGoT5DbpwjYJYnHbRoGu5 am2mHFrfOKCjCDtzEO6oHOLG/LvVmK6WGb3YXaAabPz6mSxl1JvhmFhjCUMzY/X9VsQ5 ywyB0IGJv1s6lrYleKw+GmVBong12aPr7/kV6lHBMGUNtVdUXb/HCb7xfYTBMJvzY+qX OyGQqUHEnIOxVvZRPZx+GLSg2MlNUcUJjnfCmoUCJm+6JxFtPwpCwUlQQYSN03p0Y8/D ETMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kgpNi+jm; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id et12-20020a056402378c00b0049e24a14a25si11713237edb.250.2023.01.19.22.43.00; Thu, 19 Jan 2023 22:43:12 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kgpNi+jm; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230457AbjATF7P (ORCPT + 49 others); Fri, 20 Jan 2023 00:59:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229530AbjATF7N (ORCPT ); Fri, 20 Jan 2023 00:59:13 -0500 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D8C0EF8F; Thu, 19 Jan 2023 21:59:12 -0800 (PST) Received: by mail-pl1-x634.google.com with SMTP id v23so4486118plo.1; Thu, 19 Jan 2023 21:59:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=KtnXlmTpuc06EMMN7aGW2IlZGwG+DgNxDWRhTtH1Re8=; b=kgpNi+jm296fYI3NfSQzo8YYhvoSww5NhWWGEc2nKkXV4x9aqG9sh8RAk6TnBKwGEt Uq1SjlFfVAUxh6XKQZDUlqksnDk2EELfLO+cQ9IpI6sbfng0rUX9BWu0zFq02N+PMfiP dVpWeuzMwLJoKmAqw5BK1f8EYetZo4biRnSPCyIaHGtXBIIjBVcv5CCGPsQs0ogMH4IL ZOCcs1hQpH3wjPBbUAtH/sPPOLSYYi052WHj9auNJWFiVth2IQYeebvV+zDKnA40Et97 EJQ3PA7KNKK6yCqX9mymtRmq/p0+wgFv1GiX+e+fPjQxRIo4cy1lXXeNmS6kZ9AYAxn1 cs1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=KtnXlmTpuc06EMMN7aGW2IlZGwG+DgNxDWRhTtH1Re8=; b=jav/p9HbGa2BP9fYRFt/BOcJV4vDbbsCCcebnZKBUgL/lnHoVlf5tRXeWU0MM0X45/ 3OZHfmyeYRZzPbsi2DKpdHx/rpo/PcNhv71smRauQBp/9wZI+yKTMLRhL8wyzIAXgkWG yBB67s64+qxJPttVQGLhzwNVsdf0NO88edlUeOLNzbQWOq/ecOhVJAD28x5MSaR1Lb/V lVY2tR0lwZcuBoo8Cy7RTLehuhwSvWr/rFhJPgE7OlDnbha1C3XUc9HuV6BaBrgNv251 GWplN9EXkrfJv2CboQzV9bCz2c7G+0nFVIzMlUunZ/cgGlbNenLgjKdUgvwxuA7VNf1F jMGQ== X-Gm-Message-State: AFqh2kqwoPLIbwewvx73vrrbCNY1r7D1PcdT6lS+1elDKHkTuUlBEPQ/ RKXrn5btD666ubMs4FmXeKo= X-Received: by 2002:a17:902:9002:b0:194:9c02:7619 with SMTP id a2-20020a170902900200b001949c027619mr14595690plp.29.1674194350123; Thu, 19 Jan 2023 21:59:10 -0800 (PST) Received: from MacBook-Pro-6.local.dhcp.thefacebook.com ([2620:10d:c090:400::5:186c]) by smtp.gmail.com with ESMTPSA id y22-20020a17090264d600b001708c4ebbaesm12757237pli.309.2023.01.19.21.59.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jan 2023 21:59:09 -0800 (PST) Date: Thu, 19 Jan 2023 21:59:06 -0800 From: Alexei Starovoitov To: David Vernet 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: <20230120055906.m4pkchwawfxhj6ze@MacBook-Pro-6.local.dhcp.thefacebook.com> References: <20230119235833.2948341-1-void@manifault.com> <20230119235833.2948341-8-void@manifault.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230119235833.2948341-8-void@manifault.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 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. 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.