public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Xu <dxu@dxuuu.xyz>
To: bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
	andrii@kernel.org, olsajiri@gmail.com, quentin@isovalent.com,
	alan.maguire@oracle.com
Subject: [PATCH bpf-next v2 0/2] bpf, bpftool: Support dumping kfunc prototypes from BTF
Date: Sun,  4 Feb 2024 14:06:33 -0700	[thread overview]
Message-ID: <cover.1707080349.git.dxu@dxuuu.xyz> (raw)

This patchset enables dumping kfunc prototypes from bpftool. This is
useful b/c with this patchset, end users will no longer have to manually
define kfunc prototypes. For the kernel tree, this also means we can
drop kfunc prototypes from:

        tools/testing/selftests/bpf/bpf_kfuncs.h
        tools/testing/selftests/bpf/bpf_experimental.h

Example usage:

        $ make PAHOLE=/home/dxu/dev/pahole/build/pahole -j30 vmlinux

        $ ./tools/bpf/bpftool/bpftool btf dump file ./vmlinux format c | rg "__ksym;" | head -3
        extern void cgroup_rstat_updated(struct cgroup *cgrp, int cpu) __weak __ksym;
        extern void cgroup_rstat_flush(struct cgroup *cgrp) __weak __ksym;
        extern struct bpf_key *bpf_lookup_user_key(u32 serial, u64 flags) __weak __ksym;

Note that this patchset is only effective after the enabling pahole [0]
change is merged and the resulting feature enabled with
--btf_features=decl_tag_kfuncs.

[0]: https://lore.kernel.org/bpf/cover.1707071969.git.dxu@dxuuu.xyz/

=== Changelog ===

From v1:
* Add __weak annotation
* Use btf_dump for kfunc prototypes
* Update kernel bpf_rdonly_cast() signature

Daniel Xu (2):
  bpf: Have bpf_rdonly_cast() take a const pointer
  bpftool: Support dumping kfunc prototypes from BTF

 kernel/bpf/helpers.c    |  4 ++--
 tools/bpf/bpftool/btf.c | 45 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 2 deletions(-)

-- 
2.42.1


             reply	other threads:[~2024-02-04 21:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-04 21:06 Daniel Xu [this message]
2024-02-04 21:06 ` [PATCH bpf-next v2 1/2] bpf: Have bpf_rdonly_cast() take a const pointer Daniel Xu
2024-02-05  0:32   ` Yonghong Song
2024-02-06 13:42   ` Jiri Olsa
2024-02-06 15:44     ` Daniel Xu
2024-02-06 16:03       ` Jiri Olsa
2024-02-06 17:32       ` Andrii Nakryiko
2024-02-04 21:06 ` [PATCH bpf-next v2 2/2] bpftool: Support dumping kfunc prototypes from BTF Daniel Xu
2024-02-08  0:50   ` Andrii Nakryiko
2024-03-18 18:37     ` Daniel Xu
2024-02-13 19:09 ` [PATCH bpf-next v2 0/2] bpf, " Andrii Nakryiko
2024-02-13 21:08   ` Daniel Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1707080349.git.dxu@dxuuu.xyz \
    --to=dxu@dxuuu.xyz \
    --cc=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olsajiri@gmail.com \
    --cc=quentin@isovalent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox