From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jesper Dangaard Brouer Subject: Re: [PATCH bpf-next 04/11] bpf: show prog and map id in fdinfo Date: Tue, 29 May 2018 19:27:58 +0200 Message-ID: <20180529192758.28240588@redhat.com> References: <20180528004344.3606-1-daniel@iogearbox.net> <20180528004344.3606-5-daniel@iogearbox.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: brouer@redhat.com, netdev@vger.kernel.org To: Daniel Borkmann Return-path: Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40290 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S936850AbeE2R2D (ORCPT ); Tue, 29 May 2018 13:28:03 -0400 In-Reply-To: <20180528004344.3606-5-daniel@iogearbox.net> Sender: netdev-owner@vger.kernel.org List-ID: On Mon, 28 May 2018 02:43:37 +0200 Daniel Borkmann wrote: > Its trivial and straight forward to expose it for scripts that can > then use it along with bpftool in order to inspect an individual > application's used maps and progs. Right now we dump some basic > information in the fdinfo file but with the help of the map/prog > id full introspection becomes possible now. > > Signed-off-by: Daniel Borkmann > Acked-by: Alexei Starovoitov > --- AFAICR iproute uses this proc fdinfo, for pinned maps. Have you tested if this change is handled gracefully by tc ? > kernel/bpf/syscall.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c > index 388d4fe..79341e8 100644 > --- a/kernel/bpf/syscall.c > +++ b/kernel/bpf/syscall.c > @@ -326,13 +326,15 @@ static void bpf_map_show_fdinfo(struct seq_file *m, struct file *filp) > "value_size:\t%u\n" > "max_entries:\t%u\n" > "map_flags:\t%#x\n" > - "memlock:\t%llu\n", > + "memlock:\t%llu\n" > + "map_id:\t%u\n", > map->map_type, > map->key_size, > map->value_size, > map->max_entries, > map->map_flags, > - map->pages * 1ULL << PAGE_SHIFT); > + map->pages * 1ULL << PAGE_SHIFT, > + map->id); > > if (owner_prog_type) { > seq_printf(m, "owner_prog_type:\t%u\n", > @@ -1069,11 +1071,13 @@ static void bpf_prog_show_fdinfo(struct seq_file *m, struct file *filp) > "prog_type:\t%u\n" > "prog_jited:\t%u\n" > "prog_tag:\t%s\n" > - "memlock:\t%llu\n", > + "memlock:\t%llu\n" > + "prog_id:\t%u\n", > prog->type, > prog->jited, > prog_tag, > - prog->pages * 1ULL << PAGE_SHIFT); > + prog->pages * 1ULL << PAGE_SHIFT, > + prog->aux->id); > } > #endif > -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer