lkml.org 
[lkml]   [2019]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC] Loading BTF and pretty printing maps with bpftool
Date
On Fri, Jan 25, 2019 at 11:20:57AM +0100, Arnaldo Carvalho de Melo wrote:
> # bpftool version
> bpftool v5.0.0-rc3
> #
>
> # bpftool prog | tail -6
> 309: tracepoint name sys_enter tag 819967866022f1e1 gpl
> loaded_at 2019-01-25T11:05:41+0100 uid 0
> xlated 528B jited 381B memlock 4096B map_ids 200,199,198
> 310: tracepoint name sys_exit tag c1bd85c092d6e4aa gpl
> loaded_at 2019-01-25T11:05:41+0100 uid 0
> xlated 256B jited 191B memlock 4096B map_ids 200,199
> #
>
> And the maps:
>
> # bpftool map | tail -6
> 198: perf_event_array name __augmented_sys flags 0x0
> key 4B value 4B max_entries 8 memlock 4096B
> 199: array name syscalls flags 0x0
> key 4B value 1B max_entries 512 memlock 8192B
> 200: hash name pids_filtered flags 0x0
> key 4B value 1B max_entries 64 memlock 8192B
> #
>
> So, dumping the entries for those entries:
>
> [root@quaco ~]# egrep sleep /tmp/build/perf/arch/x86/include/generated/asm/syscalls_64.c
> [35] = "nanosleep",
> [230] = "clock_nanosleep",
> [root@quaco ~]#
>
> Looking at just the open and nanosleep:
>
> # bpftool map dump id 199 | grep "value: 01"
> key: 23 00 00 00 value: 01
> key: e6 00 00 00 value: 01
> #
>
> # bpftool map lookup id 199 key 35
> Error: key expected 4 bytes got 1
> #
>
> # bpftool map lookup id 199 key 35 00 00 00
> key: 23 00 00 00 value: 01
> # bpftool map lookup id 199 key 230 00 00 00
> key: e6 00 00 00 value: 01
> #
>
> I thought it was that --pretty option, so I tried:
>
> # bpftool map --pretty lookup id 199 key 230 00 00 00
> {
> "key": ["0xe6","0x00","0x00","0x00"
> ],
> "value": ["0x01"
> ]
> }
> #
libbpf pr_warning on failing to load BTF
or failing to create a MAP after BTF has been loaded and
____btf_map_xxx can be found.

Did you see any of them? It seems it can load the BTF
from your email.

It may be useful to set the libbpf's __pr_debug which
should be NULL by default iirc.

\
 
 \ /
  Last update: 2019-01-26 06:38    [W:0.038 / U:0.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site