Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp810943rwb; Fri, 7 Oct 2022 04:37:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4u+qZRrBSwmFqES6jQIUJBxgUFzweZytEezDpZ4stC60B3NAIpDlT4QNb74pN61amXNulZ X-Received: by 2002:a17:90b:4a4d:b0:20a:c49f:9928 with SMTP id lb13-20020a17090b4a4d00b0020ac49f9928mr15946300pjb.133.1665142624921; Fri, 07 Oct 2022 04:37:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665142624; cv=none; d=google.com; s=arc-20160816; b=GwYvejXRbQxe4Cg68qtMNMu2X3M+/6zgczEerGVxVVGcLz179Bx5HvvXicGSa91fxM xbmLCGibhR0XAhKTPnDl8ykmomhBiLLRCmZ4LUq7jqOZoN1vGWx+d7SsbQQBIWk+y2VY NugENUBatXiY6RJCUn0hRLwbHcSL9rL4b6RuOcMXqBT+jQILdV1hvCmW2y3a1BU8luQR dQVa9FOIb1SEbYU1gakSkRJuts9Qls/lWAmh64xlDBOzaVvVAv1Dgu9DsYsEOq0ZFzHR 3dPTAcFlQd8j/5fDKAF7Boi7NTO0MirplBXMHuzwlGRk9XwH/CiHzFK0etnHANdtG4VG TQVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=nj799XYBt8UhTQZQJ9jQhimAhjKzSVyfHnzNPYAksnw=; b=vWaV2A1zpbpJg18/veuv60qy1PI4BdxmeFWtnf887iRRHHhS89FwmCHh07u0hIdfby DQczZz/ItyfDPVVR910s+oPLFf668U4n2SllzxW98U/4/YQ7oBbKPHM2qfoLeuA95k3s w/x19+9hbCvibvZxRAzCYOkwskcqmgWawf/YvBEQH2WdbAgwLBkTO+TVBnkuMGyYa7eH wPSY8Ya8q2cEWtEw2THd5FDto24VjadkRgWrmdxb6Kf4VeMo8nsjW2EQgd9tPqnrLfdo NHsqfhk2cSQ260GPxUb0j4mVlHAfksANWdGxOLara3/3LMdHGlS4/n6z3Kl1205VCqev G2aQ== 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 y14-20020a17090322ce00b00176a1183050si2267925plg.80.2022.10.07.04.36.53; Fri, 07 Oct 2022 04:37:04 -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; 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 S229700AbiJGLcI (ORCPT + 99 others); Fri, 7 Oct 2022 07:32:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbiJGLcH (ORCPT ); Fri, 7 Oct 2022 07:32:07 -0400 Received: from frasgout11.his.huawei.com (frasgout11.his.huawei.com [14.137.139.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 645B0CF1AE; Fri, 7 Oct 2022 04:32:05 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.18.147.227]) by frasgout11.his.huawei.com (SkyGuard) with ESMTP id 4MkQwj1SLfz9xHwF; Fri, 7 Oct 2022 19:25:57 +0800 (CST) Received: from roberto-ThinkStation-P620 (unknown [10.204.63.22]) by APP2 (Coremail) with SMTP id GxC2BwDHQ14XDkBjSF+mAA--.6552S2; Fri, 07 Oct 2022 12:31:45 +0100 (CET) Message-ID: <903481c1933ba25f5b97d378b7344502cd56f209.camel@huaweicloud.com> Subject: Re: [PATCH v2 0/6] Add _opts variant for bpf_*_get_fd_by_id() From: Roberto Sassu To: Jiri Olsa Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, mykolal@fb.com, shuah@kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Roberto Sassu Date: Fri, 07 Oct 2022 13:31:32 +0200 In-Reply-To: References: <20221006110736.84253-1-roberto.sassu@huaweicloud.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5-0ubuntu1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-CM-TRANSID: GxC2BwDHQ14XDkBjSF+mAA--.6552S2 X-Coremail-Antispam: 1UD129KBjvJXoWxWw47CF1kCw4fKrW3WFyDZFb_yoW5GrWUpa 95Ga4Ykr4FqryI9F9xtFZYvFn5tFWxX34UGa4xJr13Ary0qFs8Z34xWr43ur9I934kGw4D Zw4Yyry5Gw1UAFJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkjb4IE77IF4wAFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIEc7CjxV AFwI0_Gr0_Gr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40E x7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x 0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41lFIxGxcIEc7CjxVA2Y2ka0xkIwI1l42xK82IYc2Ij 64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x 8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r4a6rW5MIIYrxkI7VAKI48JMIIF0xvE 2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42 xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIE c7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07UZ18PUUUUU= X-CM-SenderInfo: purev21wro2thvvxqx5xdzvxpfor3voofrz/1tbiAgASBF1jj3-zDAABsk X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 Fri, 2022-10-07 at 12:59 +0200, Jiri Olsa wrote: > On Thu, Oct 06, 2022 at 01:07:30PM +0200, Roberto Sassu wrote: > > From: Roberto Sassu > > > > Add the _opts variant for bpf_*_get_fd_by_id() functions, to be > > able to > > pass to the kernel more options, when requesting a fd of an eBPF > > object. > > > > Pass the options through a newly introduced structure, > > bpf_get_fd_by_id_opts, which currently contains open_flags (the > > other two > > members are for compatibility and for padding). > > > > open_flags allows the caller to request specific permissions to > > access a > > map (e.g. read-only). This is useful for example in the situation > > where a > > map is write-protected. > > > > Besides patches 2-6, which introduce the new variants and the data > > structure, patch 1 fixes the LIBBPF_1.0.0 declaration in > > libbpf.map. > > > > Changelog > > > > v1: > > - Don't CC stable kernel mailing list for patch 1 (suggested by > > Andrii) > > - Rename bpf_get_fd_opts struct to bpf_get_fd_by_id_opts > > (suggested by > > Andrii) > > - Move declaration of _opts variants after non-opts variants > > (suggested by > > Andrii) > > - Correctly initialize bpf_map_info, fix style issues, use map > > from > > skeleton, check valid fd in the test (suggested by Andrii) > > - Rename libbpf_get_fd_opts test to libbpf_get_fd_by_id_opts > > > > Roberto Sassu (6): > > libbpf: Fix LIBBPF_1.0.0 declaration in libbpf.map > > libbpf: Introduce bpf_get_fd_by_id_opts and > > bpf_map_get_fd_by_id_opts() > > libbpf: Introduce bpf_prog_get_fd_by_id_opts() > > libbpf: Introduce bpf_btf_get_fd_by_id_opts() > > libbpf: Introduce bpf_link_get_fd_by_id_opts() > > selftests/bpf: Add tests for _opts variants of > > bpf_*_get_fd_by_id() > > it's not marked, but I'm assuming this goes to bpf-next, right? At the next possible chance would be perfect. > anyway, lgtm > > Acked-by: Jiri Olsa Thanks Roberto > thanks, > jirka > > > tools/lib/bpf/bpf.c | 48 +++++++++- > > tools/lib/bpf/bpf.h | 16 ++++ > > tools/lib/bpf/libbpf.map | 6 +- > > tools/testing/selftests/bpf/DENYLIST.s390x | 1 + > > .../bpf/prog_tests/libbpf_get_fd_by_id_opts.c | 87 > > +++++++++++++++++++ > > .../bpf/progs/test_libbpf_get_fd_by_id_opts.c | 36 ++++++++ > > 6 files changed, 189 insertions(+), 5 deletions(-) > > create mode 100644 > > tools/testing/selftests/bpf/prog_tests/libbpf_get_fd_by_id_opts.c > > create mode 100644 > > tools/testing/selftests/bpf/progs/test_libbpf_get_fd_by_id_opts.c > > > > -- > > 2.25.1 > >