Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp4160957rwb; Tue, 16 Aug 2022 16:03:07 -0700 (PDT) X-Google-Smtp-Source: AA6agR4MnbPRy8CxR6HdaTJuAYpdFux3RRPBrJGnTIWCNh6/W5akNIgXXv3I1vP9a65Vg2dlQJtc X-Received: by 2002:a17:90b:4b4d:b0:1f5:164f:f7c4 with SMTP id mi13-20020a17090b4b4d00b001f5164ff7c4mr840946pjb.131.1660690987007; Tue, 16 Aug 2022 16:03:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660690987; cv=none; d=google.com; s=arc-20160816; b=zg1ELmGaSysq4xXsCnm/+aoeD0tfsvD0sJgBsQZh85sK8vutVJYG9XeBgnfE2NfEmn lfXSHIGxT9xuJdkM/UM77lTKI3VS8hzHfM7jl2RgGCQSFMQdzbZtPN1v576yxEICGIy1 799e1v/mvZUtt82nqveO1iT+3XkwsDUzszjeJ+t/7I0teYGloz2NinxqObrEGbX+JFnn xQhb/GqlcQxlcocHBumrR7lEHQ8gIbfEB6KLdPfd1HWM3fqT/598hOkE19oxMR0zCpjf WyMqBPRHw3XJxbZSjVkbxEKVVoA+q9c9FYlGI+rhUn30rU9+wdCdGqa8jYtr4zUMjWlG yTsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ia+gWUguoxZfAy1Dg2ZzsdLR8URymW2ftEEeLv7mHds=; b=JTsuqC0g+RkgC/6H4mKlXqJXwsSDsSanPI66IXjSy4mcaLmUNfg3hvfk6Gr9jXLJqt xd2JK+sOvyGcP7qq2mxHNMVnAeWaA6KZlf9p2FkGpsJ4ppwZ43bwvsqFQF6AMym52XJr 6HaJOClkmVGDyCggyjFjLPepg1xDguybiezPnFl3ydb0sgj7ncrkJ+iW+YgqpR7IFmgZ ANEPIQ0F4glE0kolvITIyCIHZYppaoOJomOifG83ODhka1D/ACXUsGxfgiyHSE//glK2 yO499rM686nHC2Avv8RYwHvuo2Hu5pk2pKNW7iaoQwJ8aVDdg5GVsbUfO1iK0ZeVMjNQ OU0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="Yd//NI6t"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nm11-20020a17090b19cb00b001f59204dd5esi213546pjb.48.2022.08.16.16.02.32; Tue, 16 Aug 2022 16:03:06 -0700 (PDT) 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=@google.com header.s=20210112 header.b="Yd//NI6t"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237482AbiHPXAb (ORCPT + 99 others); Tue, 16 Aug 2022 19:00:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237692AbiHPXA2 (ORCPT ); Tue, 16 Aug 2022 19:00:28 -0400 Received: from mail-yw1-x1132.google.com (mail-yw1-x1132.google.com [IPv6:2607:f8b0:4864:20::1132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62A7E7B1F5 for ; Tue, 16 Aug 2022 16:00:27 -0700 (PDT) Received: by mail-yw1-x1132.google.com with SMTP id 00721157ae682-32a17d3bba2so189411587b3.9 for ; Tue, 16 Aug 2022 16:00:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=ia+gWUguoxZfAy1Dg2ZzsdLR8URymW2ftEEeLv7mHds=; b=Yd//NI6tGwsKJEtX6z8PRhifk+LuQiS1aOojM+MFA28Lu8+R5bhMsUQ6ynIAkNZrze 8vyihr/nj/DOBXHTpDmnvCQvjYx6VSIZEH5ptw08LL2k7akIFrov9i68o0LNb/DVMF33 I6R4HK28J6+SKN6RlbyxyG1U9sejG6tOZVHgYZ4zjQOjWTkSN04v4s3XVQZf6ObCcRJ+ SDoYrq/sWZLEHUgrsh7Mwm1dJaFYvFFHIoq//fEip6zwL+ckjoLEhnn9RoxtjkemSZuO T9A2lm5sZDGXZcgIhlMODQxOm1mWr71ql/5sgS6Ly4ajPBuecTzbM99Sgdb5Yt7pw7jr v0AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=ia+gWUguoxZfAy1Dg2ZzsdLR8URymW2ftEEeLv7mHds=; b=sA9Rjm83mCt6KuTfLusRUtekCqrrLcA4uWsTrBCPjjADkaHA+5O3/e//G2why91fdX VN200rQhlqZZfyhe8/ravwOaVQbNUHuUNB8Zj2tc3eFnC8b3ytNambAOrIGCoGelvh+1 0g/Ed+RC6dpyaBbCiI3oAKaCWiOtIsezMaHiyi86I8K8soUhkk3zAYYsT4zZ+x2tBFaR sR6D5XClMthRqebfh0ONiwJReeY0Kg+PbuRo4lbUJMM8uxYZAyerJBwVC1PI5xYdIOZL 10BcDrDdj6+AooaJnH3591x/ywnc5OyEUQhPW7ERPrgvOCMSKl4xUpHPG0YWe4AYayWS Z3fA== X-Gm-Message-State: ACgBeo2EsQ3LEx3wT9bLiTeRm4FeZ3gtn4EGg+oYFFqHf9MvHqsyWm2Q zsMYrn4pX1A8f70M5Tssave402UXiRK6komWwSq7wA== X-Received: by 2002:a81:4806:0:b0:32f:f84c:f30a with SMTP id v6-20020a814806000000b0032ff84cf30amr11990225ywa.107.1660690826444; Tue, 16 Aug 2022 16:00:26 -0700 (PDT) MIME-Version: 1.0 References: <20220816214945.742924-1-haoluo@google.com> In-Reply-To: From: Hao Luo Date: Tue, 16 Aug 2022 16:00:15 -0700 Message-ID: Subject: Re: [PATCH bpf-next] libbpf: allow disabling auto attach To: Andrii Nakryiko Cc: linux-kernel@vger.kernel.org, bpf@vger.kernel.org, netdev@vger.kernel.org, Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , John Fastabend , Stanislav Fomichev , Yosry Ahmed , Jiri Olsa Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 Tue, Aug 16, 2022 at 3:55 PM Andrii Nakryiko wrote: > > On Tue, Aug 16, 2022 at 3:16 PM Hao Luo wrote: > > > > On Tue, Aug 16, 2022 at 3:01 PM Andrii Nakryiko > > wrote: > > > > > > On Tue, Aug 16, 2022 at 2:49 PM Hao Luo wrote: > > > > > > > > Add libbpf APIs for disabling auto-attach for individual functions. > > > > This is motivated by the use case of cgroup iter [1]. Some iter > > > > types require their parameters to be non-zero, therefore applying > > > > auto-attach on them will fail. With these two new APIs, Users who > > > > want to use auto-attach and these types of iters can disable > > > > auto-attach for them and perform manual attach. > > > > > > > > [1] https://lore.kernel.org/bpf/CAEf4BzZ+a2uDo_t6kGBziqdz--m2gh2_EUwkGLDtMd65uwxUjA@mail.gmail.com/ > > > > > > > > Signed-off-by: Hao Luo > > > > --- [...] > > > > diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h > > > > index 61493c4cddac..88a1ac34b12a 100644 > > > > --- a/tools/lib/bpf/libbpf.h > > > > +++ b/tools/lib/bpf/libbpf.h > > > > @@ -260,6 +260,8 @@ LIBBPF_API const char *bpf_program__name(const struct bpf_program *prog); > > > > LIBBPF_API const char *bpf_program__section_name(const struct bpf_program *prog); > > > > LIBBPF_API bool bpf_program__autoload(const struct bpf_program *prog); > > > > LIBBPF_API int bpf_program__set_autoload(struct bpf_program *prog, bool autoload); > > > > +LIBBPF_API bool bpf_program__autoattach(const struct bpf_program *prog); > > > > +LIBBPF_API void bpf_program__set_autoattach(struct bpf_program *prog, bool autoattach); > > > > > > please add these APIs to libbpf.map as well > > > > > > > Ok. Which section? LIBBPF_1.0.0? Do the items in each section have a > > particular order? > > Yes, 1.0.0 section. All the functions are sorted alphabetically. > Thanks for confirming. :)