BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next v1 0/4] 'bpf_fastcall' attribute in vmlinux.h and bpf_helper_defs.h
@ 2024-09-16  9:17 Eduard Zingerman
  2024-09-16  9:17 ` [PATCH bpf-next v1 1/4] bpf: allow specifying bpf_fastcall attribute for BPF helpers Eduard Zingerman
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Eduard Zingerman @ 2024-09-16  9:17 UTC (permalink / raw)
  To: bpf, ast
  Cc: andrii, daniel, martin.lau, kernel-team, yonghong.song,
	arnaldo.melo, Eduard Zingerman

The goal of this patch-set is to reflect attribute bpf_fastcall
for supported helpers and kfuncs in generated header files.
For helpers this requires a tweak for scripts/bpf_doc.py and an update
to uapi/linux/bpf.h doc-comment.
For kfuncs this requires:
- introduction of a new KF_FASTCALL flag;
- modification to pahole to read kfunc flags and generate
  DECL_TAG "bpf_fastcall" for marked kfuncs;
- modification to bpftool to scan for DECL_TAG "bpf_fastcall"
  presence.

In both cases the following helper macro is defined in the generated
header:

    #ifndef __bpf_fastcall
    #if __has_attribute(bpf_fastcall)
    #define __bpf_fastcall __attribute__((bpf_fastcall))
    #else
    #define __bpf_fastcall
    #endif
    #endif

And is used to mark appropriate function prototypes. More information
about bpf_fastcall attribute could be found in [1] and [2].

Modifications to pahole are submitted separately.

[1] LLVM source tree commit:
    64e464349bfc ("[BPF] introduce __attribute__((bpf_fastcall))")

[2] Linux kernel tree commit (note: feature was renamed from
    no_caller_saved_registers to bpf_fastcall after this commit):
    52839f31cece ("Merge branch 'no_caller_saved_registers-attribute-for-helper-calls'")

Eduard Zingerman (4):
  bpf: allow specifying bpf_fastcall attribute for BPF helpers
  bpf: __bpf_fastcall for bpf_get_smp_processor_id in uapi
  bpf: use KF_FASTCALL to mark kfuncs supporting fastcall contract
  bpftool:  __bpf_fastcall for kfuncs marked with special decl_tag

 include/linux/btf.h            |  1 +
 include/uapi/linux/bpf.h       |  2 +
 kernel/bpf/helpers.c           |  4 +-
 kernel/bpf/verifier.c          |  5 +-
 scripts/bpf_doc.py             | 50 ++++++++++++++++-
 tools/bpf/bpftool/btf.c        | 98 ++++++++++++++++++++++++++++++----
 tools/include/uapi/linux/bpf.h |  2 +
 7 files changed, 144 insertions(+), 18 deletions(-)

-- 
2.46.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-09-27 22:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-16  9:17 [PATCH bpf-next v1 0/4] 'bpf_fastcall' attribute in vmlinux.h and bpf_helper_defs.h Eduard Zingerman
2024-09-16  9:17 ` [PATCH bpf-next v1 1/4] bpf: allow specifying bpf_fastcall attribute for BPF helpers Eduard Zingerman
2024-09-27 22:31   ` Andrii Nakryiko
2024-09-27 22:39     ` Eduard Zingerman
2024-09-16  9:17 ` [PATCH bpf-next v1 2/4] bpf: __bpf_fastcall for bpf_get_smp_processor_id in uapi Eduard Zingerman
2024-09-16  9:17 ` [PATCH bpf-next v1 3/4] bpf: use KF_FASTCALL to mark kfuncs supporting fastcall contract Eduard Zingerman
2024-09-16  9:17 ` [PATCH bpf-next v1 4/4] bpftool: __bpf_fastcall for kfuncs marked with special decl_tag Eduard Zingerman
2024-09-16  9:22 ` [PATCH bpf-next v1 0/4] 'bpf_fastcall' attribute in vmlinux.h and bpf_helper_defs.h Eduard Zingerman
2024-09-27 22:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox