Subject: Re: [PATCH net-next v2 3/3] tools: bpftool: add documentation

From: Daniel Borkmann <[email-masked]>
Date: Tue, 03 Oct 2017 16:15:24 +0200

On 10/03/2017 03:35 AM, Jakub Kicinski wrote:
> On Mon, 2 Oct 2017 17:55:02 -0700, Alexei Starovoitov wrote:
>>> +EXAMPLES
>>> +========
>>> +**# bpftool prog show**
>>> +::
>>> +
>>> +  10: xdp  name:some_prog  tag 00:5a:3d:21:23:62:0c:8b
>>
>> could you please remove ':' in the output to match what
>> show_fdinfo and kallsyms do ?

Yep, iproute2 as well, so would be better indeed.

> Ack.
>
>>> +	loaded_at:2024.771  uid:0
>>
>> may be translate that to something human readable?
>
> Oh yes, the code will print a proper date/time, I forgot to
> regenerate the doc :S
>
>>> +	xlated:528B  jited:370B  memlock:4096B  map_ids:10
>>> +
>>> +|
>>> +| **# bpftool prog dump xlated id 10 file /tmp/t**
>>> +| **# ls -l /tmp/t**
>>> +|   -rw------- 1 root root 560 Jul 22 01:42 /tmp/t
>>> +
>>> +|
>>> +| **# mount -t bpf none /sys/fs/bpf/**
>>> +| **# bpftool prog pin id 10 /sys/fs/bpf/prog**
>>> +| **# bpftool prog dum jited pinned /sys/fs/bpf/prog**
>>> +
>>> +::
>>> +
>>> +    push   %rbp
>>> +    mov    %rsp,%rbp
>>> +    sub    $0x228,%rsp
>>> +    sub    $0x28,%rbp
>>> +    mov    %rbx,0x0(%rbp)
>>
>> imo too many steps to dump disasm output.
>> Can it print it if we just say:
>> bpftool prog dump jited id 10
>> and
>> dump xlated
>
> Yes those will work.  This example kind of shows pinning and dumping at
> the some time.  Perhaps that's ill advised.
>
>> will pretty print them as verifier output as well?
>
> We tried to use LLVM as a library for this but the interface is
> painfully unstable and it's a heavy dependency.  The current thinking
> is to try to put the instruction printing code in some higher level
> library, but I would rather leave that as a follow up.
>
>> All that can be changed later. Thanks for the doc.

Fine with that as well, so:

Acked-by: Daniel Borkmann <[email-masked]>