From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90D51C38A2A for ; Fri, 8 May 2020 18:25:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 680E52173E for ; Fri, 8 May 2020 18:25:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YfvDGx8J" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727105AbgEHSZE (ORCPT ); Fri, 8 May 2020 14:25:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726948AbgEHSZD (ORCPT ); Fri, 8 May 2020 14:25:03 -0400 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0287C061A0C; Fri, 8 May 2020 11:25:03 -0700 (PDT) Received: by mail-io1-xd43.google.com with SMTP id 19so2725085ioz.10; Fri, 08 May 2020 11:25:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=B+INd7V6WsPV69b0ltqt1ElbcHXHjVKgLGixyO4x2go=; b=YfvDGx8Js8tFGh/cGMssuCcsVybqcvDkXUJ80OI0sPMDqi9oUmQy8s+5Hk7mEYREzk oUdWoYQ2MVgrY7KKgQDAoHl1bjDsjPri1vdXNnuYWdt/LnAV+cs6qlona80+xw+EtC/o 7nl9MaQrRC7vLiCOu6ZxfEpUFO0+IY/ZfiL2lopOrSQtSj22ueQD+feKyF0jmh84g1gx VGMmmbL0BkyBcfwY++vL/jQTJJw4QQgWYbbGsdwXOzP4U2nbj5dcrSrB+bomn8fizQvp AbY1bY4dOmJQaXNzkjfbRHTDO2TfGHLFo46ne70blTqIEzwwxBVVS6xNpz+6NToAI2bJ uXTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=B+INd7V6WsPV69b0ltqt1ElbcHXHjVKgLGixyO4x2go=; b=fDbhXbu4wj9NnbxzJ/ZHsrMpQaoaI+vEgSo9hdAXTob11DewSjG2e/daM6qSCKs6gC 1CWdMDJfYr8nhzYq0gU5Q2w8WYTh9naHtYcp68pRrRC+myit2iODxJhzVeK9NgEUojJ9 ydct/psiLjiOw0XF+XJ3felzfu1lareixGNhnSQTXDmZXFmPqvfWxx/UIbBIHPki4NMA MtCxUA7DTPjw4IH+47q74apuyupRx+ApLDDgAVJ2cvJ5Cuv0FckuL2HXCesc/9Y9SPgN AVpjTi4GpABePNcOkeEGsLc6ZYl/4ct7DvPJNnqSibnsYpVeYex9F0GBWuLHAKWWIzJM NMlQ== X-Gm-Message-State: AGi0PuYMroIOafSbQbLGoAOZoKCEG5Rc8cXj1MI/sOlQu320bIKwZwDv +/zL2z3KGBw3IVnTF/Q7COn8eyGJsZ1O/h4RtN4= X-Google-Smtp-Source: APiQypItjtAGonjwJzliqFhiqvF5OlQYJUW8/wCQGbhSqrrvvoYtmiQU/zK4p0Aq73lcEaVkH+IlqMTP8wtjcI7iEqM= X-Received: by 2002:a05:6638:103b:: with SMTP id n27mr1859885jan.40.1588962303039; Fri, 08 May 2020 11:25:03 -0700 (PDT) MIME-Version: 1.0 References: <20200507053915.1542140-1-yhs@fb.com> <20200507053918.1542509-1-yhs@fb.com> In-Reply-To: <20200507053918.1542509-1-yhs@fb.com> From: Andrii Nakryiko Date: Fri, 8 May 2020 11:24:52 -0700 Message-ID: Subject: Re: [PATCH bpf-next v3 03/21] bpf: support bpf tracing/iter programs for BPF_LINK_CREATE To: Yonghong Song Cc: Andrii Nakryiko , bpf , Martin KaFai Lau , Networking , Alexei Starovoitov , Daniel Borkmann , Kernel Team Content-Type: text/plain; charset="UTF-8" Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Wed, May 6, 2020 at 10:41 PM Yonghong Song wrote: > > Given a bpf program, the step to create an anonymous bpf iterator is: > - create a bpf_iter_link, which combines bpf program and the target. > In the future, there could be more information recorded in the link. > A link_fd will be returned to the user space. > - create an anonymous bpf iterator with the given link_fd. > > The bpf_iter_link can be pinned to bpffs mount file system to > create a file based bpf iterator as well. > > The benefit to use of bpf_iter_link: > - using bpf link simplifies design and implementation as bpf link > is used for other tracing bpf programs. > - for file based bpf iterator, bpf_iter_link provides a standard > way to replace underlying bpf programs. > - for both anonymous and free based iterators, bpf link query > capability can be leveraged. > > The patch added support of tracing/iter programs for BPF_LINK_CREATE. > A new link type BPF_LINK_TYPE_ITER is added to facilitate link > querying. Currently, only prog_id is needed, so there is no > additional in-kernel show_fdinfo() and fill_link_info() hook > is needed for BPF_LINK_TYPE_ITER link. > > Acked-by: Andrii Nakryiko > Signed-off-by: Yonghong Song > --- still looks good, but I realized show_fdinfo and fill_link_info is missing, see request for a follow-up below :) > include/linux/bpf.h | 1 + > include/linux/bpf_types.h | 1 + > include/uapi/linux/bpf.h | 1 + > kernel/bpf/bpf_iter.c | 62 ++++++++++++++++++++++++++++++++++ > kernel/bpf/syscall.c | 14 ++++++++ > tools/include/uapi/linux/bpf.h | 1 + > 6 files changed, 80 insertions(+) > [...] > +static const struct bpf_link_ops bpf_iter_link_lops = { > + .release = bpf_iter_link_release, > + .dealloc = bpf_iter_link_dealloc, > +}; Link infra supports .show_fdinfo and .fill_link_info methods, there is no need to block on this, but it would be great to implement them from BPF_LINK_TYPE_ITER as well in the same release as a follow-up. Thanks! [...]