netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Quentin Monnet <quentin.monnet@netronome.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Alexei Starovoitov <ast@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
	Martin KaFai Lau <kafai@fb.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Song Liu <songliubraving@fb.com>,
	Stanislav Fomichev <sdf@google.com>, Yonghong Song <yhs@fb.com>,
	bpf@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH 1/1] bpftool: Allow referring to maps by its name
Date: Fri, 15 Mar 2019 12:16:32 -0700	[thread overview]
Message-ID: <20190315121632.246824dc@cakuba.netronome.com> (raw)
In-Reply-To: <20190315183211.GB24482@kernel.org>

On Fri, 15 Mar 2019 15:41:41 -0300, Arnaldo Carvalho de Melo wrote:
> While developing 'perf trace' and looking at BPF maps it puts in place I
> noticed that one needs to first use 'bpftool map' to lookup a map id to
> then use 'bpftool map dump map id <map-id-looked-up>'.
> 
> This is needed because everytime we restart 'perf trace' the map IDs
> gets changed so we need to do the ID lookup again.
> 
> To speed up this sequence, allow specifying just the map name, look up
> its ID and then use the existing routines as if the user had provided
> the map id.

I can see how it could be useful for quick debug.  Names are not
guaranteed to be unique, though, do you not care about potential
duplicates?

> This:
> 
>   # bpftool map
>   13: lpm_trie  flags 0x1
>   	key 8B  value 8B  max_entries 1  memlock 4096B
>   14: lpm_trie  flags 0x1
>   	key 20B  value 8B  max_entries 1  memlock 4096B
>   15: lpm_trie  flags 0x1
>   	key 8B  value 8B  max_entries 1  memlock 4096B
>   16: lpm_trie  flags 0x1
>   	key 20B  value 8B  max_entries 1  memlock 4096B
>   17: lpm_trie  flags 0x1
>   	key 8B  value 8B  max_entries 1  memlock 4096B
>   18: lpm_trie  flags 0x1
>   	key 20B  value 8B  max_entries 1  memlock 4096B
>   21: lpm_trie  flags 0x1
>   	key 8B  value 8B  max_entries 1  memlock 4096B
>   22: lpm_trie  flags 0x1
>   	key 20B  value 8B  max_entries 1  memlock 4096B
>   28: perf_event_array  name __augmented_sys  flags 0x0
>   	key 4B  value 4B  max_entries 8  memlock 4096B
>   29: array  name syscalls  flags 0x0
>   	key 4B  value 1B  max_entries 512  memlock 8192B
>   30: hash  name pids_filtered  flags 0x0
>   	key 4B  value 1B  max_entries 64  memlock 8192B
>   #
>    # bpftool map dump id 30
>   [{
>           "key": 26554,
>           "value": true
>       },{
>           "key": 2592,
>           "value": true
>       }
>   ]
>   #
> 
> Now is equivalent to:
> 
>   # bpftool map dump pids_filtered

Please do keep the current model of name val, IOW dump map *name* pids..

>   [{
>           "key": 26554,
>           "value": true
>       },{
>           "key": 2592,
>           "value": true
>       }
>   ]
>   #
> 
> Cc: Alexei Starovoitov <ast@kernel.org>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: Jakub Kicinski <jakub.kicinski@netronome.com>
> cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Martin KaFai Lau <kafai@fb.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Quentin Monnet <quentin.monnet@netronome.com>
> Cc: Song Liu <songliubraving@fb.com>
> Cc: Stanislav Fomichev <sdf@google.com>
> Cc: Yonghong Song <yhs@fb.com>
> Link: https://lkml.kernel.org/n/tip-rrnxuhvety3j3rf0r9zlbfro@git.kernel.org
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Please also update the bash completions and all the help/mans/docs.

  reply	other threads:[~2019-03-15 19:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-15 18:41 [PATCH 1/1] bpftool: Allow referring to maps by its name Arnaldo Carvalho de Melo
2019-03-15 19:16 ` Jakub Kicinski [this message]
2019-03-15 19:41   ` Quentin Monnet
2019-03-15 19:48     ` Arnaldo Carvalho de Melo
2019-03-15 20:25       ` Jakub Kicinski
2019-03-15 19:51   ` Arnaldo Carvalho de Melo
2019-03-15 20:18     ` Jakub Kicinski

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=20190315121632.246824dc@cakuba.netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=acme@redhat.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jolsa@kernel.org \
    --cc=kafai@fb.com \
    --cc=namhyung@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=quentin.monnet@netronome.com \
    --cc=sdf@google.com \
    --cc=songliubraving@fb.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).