2015-11-20 08:14:31

by Wang Nan

[permalink] [raw]
Subject: Re: [RFC PATCH 1/7] perf tools: Add API to config maps in bpf object



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

There's an inconvience in this syntax.

In following cmdline:

# perf record -e mybpf.c/maps.channel.value=1234/ ls

because of the greedy manner of flex, mybpf.c/maps.c would
be expressed as path of a BPF source file (and yes, it is a valid
path).

If flex has a non-greedy mode then it would be fixed easily. However,
the official flex docs reveals its policy that it doesn't and would not
provide non-greedy matching. Even if we have non-greedy matching,
we are unable to prohibit user to put their BPF object into path
like

/home/user/mybpf.c/thefile.c

Fortunately this patch has not beed merged, so we have a chance to fix
it at very beginning. I will replace all '.' in object config string
to ':', so the above cmdline becomes:

# perf record -e mybpf.c/maps:channel:value=1234/ ls

[1]
http://flex.sourceforge.net/manual/Why-doesn_0027t-flex-have-non_002dgreedy-operators-like-perl-does_003f.html