mbox series

[0/2] bpf: Yet another approach to fix the BPF dispatcher thing

Message ID 20221103120012.717020618@infradead.org (mailing list archive)
Headers show
Series bpf: Yet another approach to fix the BPF dispatcher thing | expand

Message

Peter Zijlstra Nov. 3, 2022, noon UTC
Hi!

Even thought the __attribute__((patchable_function_entry())) solution to the
BPF dispatcher woes works, it turns out to not be supported by the whole range
of ageing compilers we support. Specifically this attribute seems to be GCC-8
and later.

This is another approach -- using static_call() to rewrite the dispatcher
function. I've compile tested this on:

  x86_64  (inline static-call support)
  i386    (out-of-line static-call support)
  aargh64 (no static-call support)

A previous version was tested and found working by Bjorn.

It is split in two patches; first reverting the current approach and then
introducing the new for ease of review.

Comments

Björn Töpel Nov. 3, 2022, 1:42 p.m. UTC | #1
Peter Zijlstra <peterz@infradead.org> writes:

> Hi!
>
> Even thought the __attribute__((patchable_function_entry())) solution to the
> BPF dispatcher woes works, it turns out to not be supported by the whole range
> of ageing compilers we support. Specifically this attribute seems to be GCC-8
> and later.
>
> This is another approach -- using static_call() to rewrite the dispatcher
> function. I've compile tested this on:
>
>   x86_64  (inline static-call support)
>   i386    (out-of-line static-call support)
>   aargh64 (no static-call support)
>
> A previous version was tested and found working by Bjorn.
>
> It is split in two patches; first reverting the current approach and then
> introducing the new for ease of review.

Took it for a spin on x86_64/KVM. For the series:

Acked-by: Björn Töpel <bjorn@kernel.org>
Tested-by: Björn Töpel <bjorn@kernel.org>
Jiri Olsa Nov. 3, 2022, 2:48 p.m. UTC | #2
On Thu, Nov 03, 2022 at 01:00:12PM +0100, Peter Zijlstra wrote:
> Hi!
> 
> Even thought the __attribute__((patchable_function_entry())) solution to the
> BPF dispatcher woes works, it turns out to not be supported by the whole range
> of ageing compilers we support. Specifically this attribute seems to be GCC-8
> and later.
> 
> This is another approach -- using static_call() to rewrite the dispatcher
> function. I've compile tested this on:
> 
>   x86_64  (inline static-call support)
>   i386    (out-of-line static-call support)
>   aargh64 (no static-call support)
> 
> A previous version was tested and found working by Bjorn.
> 
> It is split in two patches; first reverting the current approach and then
> introducing the new for ease of review.
> 

Acked-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka
patchwork-bot+netdevbpf@kernel.org Nov. 4, 2022, 10:20 p.m. UTC | #3
Hello:

This series was applied to bpf/bpf.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Thu, 03 Nov 2022 13:00:12 +0100 you wrote:
> Hi!
> 
> Even thought the __attribute__((patchable_function_entry())) solution to the
> BPF dispatcher woes works, it turns out to not be supported by the whole range
> of ageing compilers we support. Specifically this attribute seems to be GCC-8
> and later.
> 
> [...]

Here is the summary with links:
  - [1/2] bpf: Revert ("Fix dispatcher patchable function entry to 5 bytes nop")
    (no matching commit)
  - [2/2] bpf: Convert BPF_DISPATCHER to use static_call() (not ftrace)
    https://git.kernel.org/bpf/bpf/c/c86df29d11df

You are awesome, thank you!