bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: "Toke Høiland-Jørgensen" <toke@redhat.com>
Cc: Gilad Reti <gilad.reti@gmail.com>, bpf <bpf@vger.kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>
Subject: Re: libbpf: pinning multiple progs from the same section
Date: Wed, 10 Feb 2021 12:04:14 -0800	[thread overview]
Message-ID: <CAEf4BzaUkcnVaGJkMxuc+atqUimxJJQOrZHDkK1Yprysy79hyg@mail.gmail.com> (raw)
In-Reply-To: <87tuqlsdtu.fsf@toke.dk>

On Tue, Feb 9, 2021 at 3:03 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>
> Gilad Reti <gilad.reti@gmail.com> writes:
>
> >> > I didn't get this last comment. What I meant is that I want something
> >> > like the bpf_object__pin_maps but that doesn't pin the maps, just
> >> > exposing its naming part.
> >>
> >> Right, OK. Why, though? I can kinda see how it could be convenient to
> >> (basically )make libbpf behave as if all maps has the 'pinning'
> >> attribute set, for map reuse. But I'm not sure I can think any concrete
> >> use cases where this would be needed. What's yours?
> >>
> >
> > I am using the same bpf objects (more specifically, the new skeleton
> > feature) in two different processes that need access to the same
> > maps/programs (for example, they both need access to shared maps).
> > Thus, I want to reuse the entire object in both. Since we already have
> > a way to pin an entire bpf object, I thought it would be convenient to
> > have a way of reusing it entirely (though I am fine with pinning and
> > reusing each one manually).
> > (I cannot set the __uint(pinning, LIBBPF_PIN_BY_NAME) on each since I
> > want to share the bss map too)
>
> Ah, see, now *this* could go under the "missing API" header: having a
> way to make libbpf pin (and reuse) the auto-generated maps, like you can
> do with the 'pinning' attribute.
>
> Andrii, WDYT?

I think that the whole pinning handling in libbpf feels a bit ad-hoc.
It would be good for someone to sit and think through this end-to-end.
Unfortunately I never had a need for pinning, so I'm not the best
person to do this.

In this case, you can still do bpf_map__set_pin_path() on internal
maps (.bss, .data, etc), but you'll need to specify pin path
explicitly, which is different from what you get with
LIBBPF_PIN_BY_NAME.

So I think pinning support is not complete, but I'd also like to avoid
adding new APIs in an ad-hoc manner without a holistic view of how
pinning should work with libbpf.

>
> -Toke
>

  reply	other threads:[~2021-02-10 20:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-07 11:35 libbpf: pinning multiple progs from the same section Gilad Reti
2021-02-08  8:57 ` Gilad Reti
2021-02-08 11:42   ` Toke Høiland-Jørgensen
2021-02-08 11:57     ` Gilad Reti
2021-02-08 14:28       ` Toke Høiland-Jørgensen
2021-02-08 14:44         ` Gilad Reti
2021-02-08 15:09           ` Toke Høiland-Jørgensen
2021-02-08 15:50             ` Gilad Reti
2021-02-08 17:55               ` Toke Høiland-Jørgensen
2021-02-08 18:19                 ` Gilad Reti
2021-02-08 19:16                   ` Toke Høiland-Jørgensen
2021-02-09  8:35                     ` Gilad Reti
2021-02-09 11:03                       ` Toke Høiland-Jørgensen
2021-02-10 20:04                         ` Andrii Nakryiko [this message]
2021-02-08 22:36 ` Andrii Nakryiko

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=CAEf4BzaUkcnVaGJkMxuc+atqUimxJJQOrZHDkK1Yprysy79hyg@mail.gmail.com \
    --to=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=gilad.reti@gmail.com \
    --cc=toke@redhat.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;
as well as URLs for NNTP newsgroup(s).