From: Okash Khawaja <osk@fb.com>
To: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <kafai@fb.com>,
Alexei Starovoitov <ast@kernel.org>, Yonghong Song <yhs@fb.com>,
"Quentin Monnet" <quentin.monnet@netronome.com>,
"David S. Miller" <davem@davemloft.net>, <netdev@vger.kernel.org>,
<kernel-team@fb.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf-next 2/3] bpf: btf: add btf json print functionality
Date: Sun, 1 Jul 2018 11:31:47 +0100 [thread overview]
Message-ID: <20180701103146.GA1388@w1t1fb> (raw)
In-Reply-To: <0360a47f-1056-3117-31ec-7c3f5d6dbccb@iogearbox.net>
On Wed, Jun 27, 2018 at 02:56:49PM +0200, Daniel Borkmann wrote:
> On 06/27/2018 01:47 PM, Okash Khawaja wrote:
> > On Wed, Jun 27, 2018 at 12:34:35PM +0200, Daniel Borkmann wrote:
> >> On 06/27/2018 12:35 AM, Jakub Kicinski wrote:
> >>> On Tue, 26 Jun 2018 15:27:09 -0700, Martin KaFai Lau wrote:
> >>>> On Tue, Jun 26, 2018 at 01:31:33PM -0700, Jakub Kicinski wrote:
> >> [...]
> >>>>> Implementing both outputs in one series will help you structure your
> >>>>> code to best suit both of the formats up front.
> >>>> hex and "formatted" are the only things missing? As always, things
> >>>> can be refactored when new use case comes up. Lets wait for
> >>>> Okash input.
> >>>>
> >>>> Regardless, plaintext is our current use case. Having the current
> >>>> patchset in does not stop us or others from contributing other use
> >>>> cases (json, "bpftool map find"...etc), and IMO it is actually
> >>>> the opposite. Others may help us get there faster than us alone.
> >>>> We should not stop making forward progress and take this patch
> >>>> as hostage because "abc" and "xyz" are not done together.
> >>>
> >>> Parity between JSON and plain text output is non negotiable.
> >>
> >> Longish discussion and some confusion in this thread. :-) First of all
> >> thanks a lot for working on it, very useful!
> > Thanks :)
> >
> >> My $0.02 on it is that so far
> >> great care has been taken in bpftool to indeed have feature parity between
> >> JSON and plain text, so it would be highly desirable to keep continuing
> >> this practice if the consensus is that it indeed is feasible and makes
> >> sense wrt BTF data. There has been mentioned that given BTF data can be
> >> dynamic depending on what the user loads via bpf(2) so a potential JSON
> >> output may look different/break each time anyway. This however could all be
> >> embedded under a container object that has a fixed key like 'formatted'
> >> where tools like jq(1) can query into it. I think this would be fine since
> >> the rest of the (non-dynamic) output is still retained as-is and then
> >> wouldn't confuse or collide with existing users, and anyone programmatically
> >> parsing deeper into the BTF data under such JSON container object needs
> >> to have awareness of what specific data it wants to query from it; so
> >> there's no conflict wrt breaking anything here. Imho, both outputs would
> >> be very valuable.
> > Okay I can add "formatted" object under json output.
> >
> > One thing to note here is that the fixed output will change if the map
> > itself changes. So someone writing a program that consumes that fixed
> > output will have to account for his program breaking in future, thus
>
> Yes, that aspect is fine though, any program/script parsing this would need
> to be aware of the underlying map type to make sense of it (e.g. per-cpu vs
> non per-cpu maps to name one). But that info it could query/verify already
> beforehand via bpftool as well (via normal map info dump for a given id).
>
> > breaking backward compatibility anyway as far as the developer is
> > concerned :)
> >
> > I will go ahead with work on "formatted" object.
>
> Cool, thanks,
> Daniel
hi,
couple of questions:
1. just to be sure, formatted section will be on the same level as "key"
and "value"? so something like following:
$ bpftool map dump -p id 8
[{
"key": ["0x00","0x00","0x00","0x00"
],
"value": [...
],
"formatted": {
"key": 0,
"value": {
"int_field": 3,
"pointerfield": 2152930552,
...
}
}
}]
2. i noticed that the ouput in v1 has all the keys and values on the
same level. in v2, i'll change them so that each key-value pair is a
separate object. let me know what you think.
finally, i noticed there is a map lookup command which also prints map
entries. do want that to also be btf-printed in this patchset?
thanks,
okash
next prev parent reply other threads:[~2018-07-01 10:31 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-20 20:30 [PATCH bpf-next 0/3] bpf: btf: json print btf info with bpftool map dump Okash Khawaja
2018-06-20 20:30 ` [PATCH bpf-next 1/3] bpf: btf: export btf types and name by offset from lib Okash Khawaja
2018-06-20 22:40 ` Song Liu
2018-06-20 22:48 ` Okash Khawaja
2018-06-20 23:24 ` Song Liu
2018-06-20 20:30 ` [PATCH bpf-next 2/3] bpf: btf: add btf json print functionality Okash Khawaja
2018-06-20 23:14 ` Song Liu
2018-06-21 10:31 ` Okash Khawaja
2018-06-21 10:42 ` Quentin Monnet
2018-06-22 10:24 ` Okash Khawaja
2018-06-22 10:39 ` Quentin Monnet
2018-06-22 18:44 ` Jakub Kicinski
2018-06-21 21:59 ` Jakub Kicinski
2018-06-21 22:51 ` Martin KaFai Lau
2018-06-21 23:07 ` Jakub Kicinski
2018-06-21 23:58 ` Martin KaFai Lau
2018-06-22 0:25 ` Jakub Kicinski
2018-06-22 1:20 ` Martin KaFai Lau
2018-06-22 11:17 ` Okash Khawaja
2018-06-22 18:43 ` Jakub Kicinski
2018-06-22 18:40 ` Jakub Kicinski
2018-06-22 20:58 ` Martin KaFai Lau
2018-06-22 21:27 ` Jakub Kicinski
2018-06-22 21:49 ` Jakub Kicinski
2018-06-22 23:19 ` Martin KaFai Lau
2018-06-22 23:40 ` Jakub Kicinski
2018-06-22 23:58 ` Martin KaFai Lau
2018-06-22 22:48 ` Okash Khawaja
2018-06-22 22:54 ` Martin KaFai Lau
2018-06-22 23:32 ` Jakub Kicinski
2018-06-23 0:26 ` Martin KaFai Lau
2018-06-26 16:48 ` Okash Khawaja
2018-06-26 20:31 ` Jakub Kicinski
2018-06-26 22:27 ` Martin KaFai Lau
2018-06-26 22:35 ` Jakub Kicinski
2018-06-27 10:34 ` Daniel Borkmann
2018-06-27 11:47 ` Okash Khawaja
2018-06-27 12:56 ` Daniel Borkmann
2018-07-01 10:31 ` Okash Khawaja [this message]
2018-07-02 17:19 ` Jakub Kicinski
2018-06-20 20:30 ` [PATCH bpf-next 3/3] bpf: btf: json print map dump with btf info Okash Khawaja
2018-06-20 23:22 ` Song Liu
2018-06-21 10:05 ` Okash Khawaja
2018-06-21 10:24 ` Quentin Monnet
2018-06-21 14:26 ` Okash Khawaja
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=20180701103146.GA1388@w1t1fb \
--to=osk@fb.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=jakub.kicinski@netronome.com \
--cc=kafai@fb.com \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=quentin.monnet@netronome.com \
--cc=yhs@fb.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).