From: "Wangnan (F)" <wangnan0@huawei.com>
To: <acme@kernel.org>, <ast@plumgrid.com>, <brendan.d.gregg@gmail.com>
Cc: <a.p.zijlstra@chello.nl>, <daniel@iogearbox.net>,
<dsahern@gmail.com>, <hekuang@huawei.com>, <jolsa@kernel.org>,
<lizefan@huawei.com>, <masami.hiramatsu.pt@hitachi.com>,
<namhyung@kernel.org>, <paulus@samba.org>,
<linux-kernel@vger.kernel.org>, <pi3orama@163.com>,
<xiakaixu@huawei.com>, Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [RFC PATCH 1/7] perf tools: Add API to config maps in bpf object
Date: Mon, 23 Nov 2015 19:20:09 +0800 [thread overview]
Message-ID: <5652F669.1010405@huawei.com> (raw)
In-Reply-To: <1445078910-73699-2-git-send-email-wangnan0@huawei.com>
On 2015/10/17 18:48, Wang Nan wrote:
> bpf__config_obj() is introduced as a core API to config BPF object
> after loading. One configuration option of maps is introduced. After
> this patch BPF object can accept configuration like:
>
> maps.my_map.value=1234
>
> This patch is more complex than the work it really does because the
> consideration of extension. In designing of BPF map configuration,
> following things should be considered:
>
> 1. Array indics selection: perf should allow user setting different
> value to different slots in an array, with syntax like:
> maps.my_map.value[0,3-6]=1234;
>
> 2. Type of value: integer is not the only valid value type. Perf
> event can also be put into a map after commit 35578d7984003097af2b1e3
> (bpf: Implement function bpf_perf_event_read() that get the selected
> hardware PMU conuter);
>
> 3. For hash table, it is possible to use string or other as key;
>
> 4. It is possible that map configuration is unable to be setup
> during parsing. Perf event is an example.
>
> Therefore, this patch does tie following thing for extension:
>
> 1. Instead of update map element during parsing, this patch stores
> map config options in 'struct bpf_map_priv'. Following patches
> would apply those configs at proper time;
Because of this delay-updating manner, current implementation forbid
setting a map with different configuration.
For example:
# perf record -e
test_bpf.c/maps:channel:value[0...9]=1,maps:channel:value[10...19]=2/ ...
is equal to
# perf record -e test_bpf.c/maps:channel:value[10...19]=2/ ...
because [see follow]
> 2. Make 'struct bpf_map_priv' extensible so following patches can
> add new key and value operations;
>
> 3. Use bpf_config_map_funcs array to support more maps configuration.
>
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Signed-off-by: He Kuang <hekuang@huawei.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Alexei Starovoitov <ast@plumgrid.com>
> Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: David Ahern <dsahern@gmail.com>
> Cc: He Kuang <hekuang@huawei.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Kaixu Xia <xiakaixu@huawei.com>
> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Zefan Li <lizefan@huawei.com>
> Cc: pi3orama@163.com
> Link: http://lkml.kernel.org/n/ebpf-36xcrahy9n0ayc05mu7aajpk@git.kernel.org
> ---
>
[SNIP]
>
> +enum bpf_map_priv_key_type {
> + BPF_MAP_PRIV_KEY_ALL,
> +};
> +
> +enum bpf_map_priv_value_type {
> + BPF_MAP_PRIV_VAL_VALUE,
> +};
> +
> +struct bpf_map_priv {
> + struct {
> + enum bpf_map_priv_key_type type;
> + } key;
> +
> + struct {
> + enum bpf_map_priv_value_type type;
> + union {
> + u64 val;
> + };
> + } value;
> +};
> +
... because this structure holds only one config term.
In next version I'd like to save multiple setting operations in
this structure.
Thank you.
next prev parent reply other threads:[~2015-11-23 11:21 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-17 10:48 [RFC PATCH 0/7] perf tools: Config BPF maps through perf cmdline Wang Nan
2015-10-17 10:48 ` [RFC PATCH 1/7] perf tools: Add API to config maps in bpf object Wang Nan
2015-11-20 8:13 ` Wangnan (F)
2015-11-23 11:20 ` Wangnan (F) [this message]
2015-10-17 10:48 ` [RFC PATCH 2/7] perf tools: Add API to apply config to BPF map Wang Nan
2015-10-17 10:48 ` [RFC PATCH 3/7] perf record: Apply config to BPF objects before recording Wang Nan
2015-10-17 10:48 ` [RFC PATCH 4/7] perf tools: Enable BPF object configure syntax Wang Nan
2015-10-23 4:48 ` Wangnan (F)
2015-10-17 10:48 ` [RFC PATCH 5/7] perf tools: Support setting different slots in a BPF map separately Wang Nan
2015-11-20 13:25 ` Wangnan (F)
2015-11-20 15:34 ` Arnaldo Carvalho de Melo
2015-11-23 2:01 ` Wangnan (F)
2015-11-23 5:45 ` Wangnan (F)
2015-10-17 10:48 ` [RFC PATCH 6/7] perf tools: Enable indics setting syntax for BPF maps Wang Nan
2015-10-17 10:48 ` [RFC PATCH 7/7] perf tools: Enable passing event to BPF object Wang Nan
2015-10-17 20:35 ` [RFC PATCH 0/7] perf tools: Config BPF maps through perf cmdline Alexei Starovoitov
2015-10-17 23:58 ` Wangnan (F)
2015-10-18 0:07 ` Alexei Starovoitov
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=5652F669.1010405@huawei.com \
--to=wangnan0@huawei.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=acme@redhat.com \
--cc=ast@plumgrid.com \
--cc=brendan.d.gregg@gmail.com \
--cc=daniel@iogearbox.net \
--cc=dsahern@gmail.com \
--cc=hekuang@huawei.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=pi3orama@163.com \
--cc=xiakaixu@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.