linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Wangnan (F)" <wangnan0@huawei.com>
To: Joe Stringer <joe@ovn.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>, <ast@fb.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	LKML <linux-kernel@vger.kernel.org>,
	netdev <netdev@vger.kernel.org>
Subject: Re: [PATCHv2 perf/core 5/7] tools lib bpf: Add bpf_program__pin()
Date: Wed, 25 Jan 2017 10:18:22 +0800	[thread overview]
Message-ID: <b93c8045-7408-fb8d-f8a1-c0d11bdbc791@huawei.com> (raw)
In-Reply-To: <CAPWQB7EWFE6DToMwTws6rUpnO49UYV1Rq-=0KV2ZioUf+dTjpg@mail.gmail.com>



On 2017/1/25 9:16, Joe Stringer wrote:
> On 24 January 2017 at 17:06, Wangnan (F) <wangnan0@huawei.com> wrote:
>>
>> On 2017/1/25 9:04, Wangnan (F) wrote:
>>>
>>>
>>> On 2017/1/23 9:11, Joe Stringer wrote:
>>>> Add a new API to pin a BPF program to the filesystem. The user can
>>>> specify the path full path within a BPF filesystem to pin the program.
>>>> Programs with multiple instances are pinned as 'foo', 'foo_1', 'foo_2',
>>>> and so on.
>>>>
>>>> Signed-off-by: Joe Stringer <joe@ovn.org>
>>>> ---
>>>> v2: Don't automount BPF filesystem
>>>>       Split program, map, object pinning into separate APIs and separate
>>>>       patches.
>>>> ---
>>
>> [SNIP]
>>
>>>> +int bpf_program__pin(struct bpf_program *prog, const char *path)
>>>
>>> In your next patch please let caller select one instance:
>>>
>>> int bpf_program__pin(struct bpf_program *prog, int instance, const char
>>> *path)
>>> (please choose a better name)
>>>
>>> Then your can wrap it with another function to pin all instances,
>>> implement
>>> naming schema (%s_%d) there.
>>>
>>> Then implement naming schema in bpf_object__pin like:
>>>
>>> %s/objectname_mapname
>>> %s/objectname_progname_%d
>>>
>> Is it possible to use directory tree instead?
>>
>> %s/object/mapname
>> %s/object/prog/instance
> I don't think objects have names, so let's assume an object with two
> program instances named foo, and one map named bar.
>
> A call of bpf_object__pin(obj, "/sys/fs/bpf/myobj") would mount with
> the following files and directories:
> /sys/fs/bpf/myobj/foo/1
> /sys/fs/bpf/myobj/foo/2
> /sys/fs/bpf/myobj/bar
>
> Alternatively, if you want to control exactly where you want the
> progs/maps to be pinned, you can call eg
> bpf_program__pin_instance(prog, "/sys/fs/bpf/wherever", 0) and that
> instance will be mounted to /sys/fs/bpf/wherever, or alternatively
> bpf_program__pin(prog, "/sys/fs/bpf/foo"), and you will end up with
> /sys/fs/bpf/foo/{0,1}.
>
> This looks pretty reasonable to me.

It looks good to me.

Thank you.

  reply	other threads:[~2017-01-25  2:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-23  1:11 [PATCHv2 perf/core 0/7] Libbpf improvements Joe Stringer
2017-01-23  1:11 ` [PATCHv2 perf/core 1/7] tools lib bpf: Fix map offsets in relocation Joe Stringer
2017-01-26 15:29   ` [tip:perf/core] " tip-bot for Joe Stringer
2017-01-23  1:11 ` [PATCHv2 perf/core 2/7] tools lib bpf: Define prog_type fns with macro Joe Stringer
2017-01-26 15:30   ` [tip:perf/core] " tip-bot for Joe Stringer
2017-01-23  1:11 ` [PATCHv2 perf/core 3/7] tools lib bpf: Add set/is helpers for all prog types Joe Stringer
2017-01-26 15:30   ` [tip:perf/core] " tip-bot for Joe Stringer
2017-01-23  1:11 ` [PATCHv2 perf/core 4/7] tools lib bpf: Add libbpf_get_error() Joe Stringer
2017-01-26 15:31   ` [tip:perf/core] " tip-bot for Joe Stringer
2017-01-23  1:11 ` [PATCHv2 perf/core 5/7] tools lib bpf: Add bpf_program__pin() Joe Stringer
2017-01-25  1:04   ` Wangnan (F)
2017-01-25  1:06     ` Wangnan (F)
2017-01-25  1:16       ` Joe Stringer
2017-01-25  2:18         ` Wangnan (F) [this message]
2017-01-26 19:32           ` Arnaldo Carvalho de Melo
2017-01-26 19:43             ` Joe Stringer
2017-01-23  1:11 ` [PATCHv2 perf/core 6/7] tools lib bpf: Add bpf_map__pin() Joe Stringer
2017-01-23  1:11 ` [PATCHv2 perf/core 7/7] tools lib bpf: Add bpf_object__pin() Joe Stringer
2017-01-24 16:12 ` [PATCHv2 perf/core 0/7] Libbpf improvements Arnaldo Carvalho de Melo
2017-01-25  0:50   ` Joe Stringer

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=b93c8045-7408-fb8d-f8a1-c0d11bdbc791@huawei.com \
    --to=wangnan0@huawei.com \
    --cc=acme@kernel.org \
    --cc=ast@fb.com \
    --cc=daniel@iogearbox.net \
    --cc=joe@ovn.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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).