bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [QUESTION] BPF trampoline limits
@ 2023-03-31 11:23 andrea terzolo
  2023-04-04 22:33 ` Andrii Nakryiko
  0 siblings, 1 reply; 3+ messages in thread
From: andrea terzolo @ 2023-03-31 11:23 UTC (permalink / raw)
  To: bpf

Hello! If I can I would like to ask one question about the BPF
trampoline. Reading the description of this commit [0] I noticed the
following statement:

- Detach of a BPF program from the trampoline should not fail. To avoid memory
allocation in detach path the half of the page is used as a reserve and flipped
after each attach/detach. 2k bytes is enough to call 40+ BPF programs directly
which is enough for BPF tracing use cases. This limit can be increased in the
future.

Looking at the kernel code, I found only this limit
BPF_MAX_TRAMP_LINKS. If I understood correctly, this limit denies us
the use of the same trampoline for more than 38 bpf programs. So my
question is, does the commit description refer to another limit or
does this "call 40+ BPF programs" refer to the BPF_MAX_TRAMP_LINKS
macro?

Thank you in advance for your time,
Andrea

0: https://github.com/torvalds/linux/commit/fec56f5890d93fc2ed74166c397dc186b1c25951

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

* Re: [QUESTION] BPF trampoline limits
  2023-03-31 11:23 [QUESTION] BPF trampoline limits andrea terzolo
@ 2023-04-04 22:33 ` Andrii Nakryiko
  2023-04-08 14:23   ` andrea terzolo
  0 siblings, 1 reply; 3+ messages in thread
From: Andrii Nakryiko @ 2023-04-04 22:33 UTC (permalink / raw)
  To: andrea terzolo; +Cc: bpf

On Fri, Mar 31, 2023 at 4:32 AM andrea terzolo <andreaterzolo3@gmail.com> wrote:
>
> Hello! If I can I would like to ask one question about the BPF
> trampoline. Reading the description of this commit [0] I noticed the
> following statement:
>
> - Detach of a BPF program from the trampoline should not fail. To avoid memory
> allocation in detach path the half of the page is used as a reserve and flipped
> after each attach/detach. 2k bytes is enough to call 40+ BPF programs directly
> which is enough for BPF tracing use cases. This limit can be increased in the
> future.
>
> Looking at the kernel code, I found only this limit
> BPF_MAX_TRAMP_LINKS. If I understood correctly, this limit denies us
> the use of the same trampoline for more than 38 bpf programs. So my
> question is, does the commit description refer to another limit or
> does this "call 40+ BPF programs" refer to the BPF_MAX_TRAMP_LINKS
> macro?

No, it's BPF_MAX_TRAMP_LINKS, which got reduced a bit down from its
40+ limit to current 38.


>
> Thank you in advance for your time,
> Andrea
>
> 0: https://github.com/torvalds/linux/commit/fec56f5890d93fc2ed74166c397dc186b1c25951

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

* Re: [QUESTION] BPF trampoline limits
  2023-04-04 22:33 ` Andrii Nakryiko
@ 2023-04-08 14:23   ` andrea terzolo
  0 siblings, 0 replies; 3+ messages in thread
From: andrea terzolo @ 2023-04-08 14:23 UTC (permalink / raw)
  To: Andrii Nakryiko; +Cc: bpf

On Wed, 5 Apr 2023 at 00:33, Andrii Nakryiko <andrii.nakryiko@gmail.com> wrote:
>
> On Fri, Mar 31, 2023 at 4:32 AM andrea terzolo <andreaterzolo3@gmail.com> wrote:
> >
> > Hello! If I can I would like to ask one question about the BPF
> > trampoline. Reading the description of this commit [0] I noticed the
> > following statement:
> >
> > - Detach of a BPF program from the trampoline should not fail. To avoid memory
> > allocation in detach path the half of the page is used as a reserve and flipped
> > after each attach/detach. 2k bytes is enough to call 40+ BPF programs directly
> > which is enough for BPF tracing use cases. This limit can be increased in the
> > future.
> >
> > Looking at the kernel code, I found only this limit
> > BPF_MAX_TRAMP_LINKS. If I understood correctly, this limit denies us
> > the use of the same trampoline for more than 38 bpf programs. So my
> > question is, does the commit description refer to another limit or
> > does this "call 40+ BPF programs" refer to the BPF_MAX_TRAMP_LINKS
> > macro?
>
> No, it's BPF_MAX_TRAMP_LINKS, which got reduced a bit down from its
> 40+ limit to current 38.
>
Thank you very much for the quick answer!
> >
> > Thank you in advance for your time,
> > Andrea
> >
> > 0: https://github.com/torvalds/linux/commit/fec56f5890d93fc2ed74166c397dc186b1c25951

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

end of thread, other threads:[~2023-04-08 14:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-31 11:23 [QUESTION] BPF trampoline limits andrea terzolo
2023-04-04 22:33 ` Andrii Nakryiko
2023-04-08 14:23   ` andrea terzolo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).