From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jakub Kicinski Subject: Re: [PATCH bpf-next 2/2] bpftool: support loading flow dissector Date: Wed, 7 Nov 2018 13:12:23 -0800 Message-ID: <20181107131223.02f1c16c@cakuba.netronome.com> References: <20181107193552.77894-1-sdf@google.com> <20181107193552.77894-3-sdf@google.com> <20181107120340.27001209@cakuba.netronome.com> <20181107210009.y6jucu5oehlladkq@mini-arch> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Stanislav Fomichev , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, shuah@kernel.org, quentin.monnet@netronome.com, guro@fb.com, jiong.wang@netronome.com, bhole_prashant_q7@lab.ntt.co.jp, john.fastabend@gmail.com, jbenc@redhat.com, treeze.taeung@gmail.com, yhs@fb.com, osk@fb.com, sandipan@linux.vnet.ibm.com To: Stanislav Fomichev Return-path: Received: from mail-pl1-f181.google.com ([209.85.214.181]:47002 "EHLO mail-pl1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727018AbeKHGoi (ORCPT ); Thu, 8 Nov 2018 01:44:38 -0500 Received: by mail-pl1-f181.google.com with SMTP id c13-v6so8411744plz.13 for ; Wed, 07 Nov 2018 13:12:28 -0800 (PST) In-Reply-To: <20181107210009.y6jucu5oehlladkq@mini-arch> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, 7 Nov 2018 13:00:09 -0800, Stanislav Fomichev wrote: > > > + } > > > + > > > + if (attr.prog_type == BPF_PROG_TYPE_FLOW_DISSECTOR) { > > > + err = build_flow_dissector_jmp_table(obj, prog, "jmp_table"); > > > + if (err) { > > > + p_err("failed to build flow dissector jump table"); > > > + goto err_close_obj; > > > + } > > > + /* flow dissector consist of multiple programs, > > > + * we want to pin them all > > > > Why pin them all shouldn't the main program be the only one pinned? > If I pin only the main program, the tail ones disappear from the jmp_table map > when bpftool exits. > Am I missing something? > Should BPF_MAP_TYPE_PROG_ARRAY hold the referenced progs? It does. # bpftool map create /sys/fs/bpf/map \ type prog_array key 4 value 4 entries 4 \ name tail_call_map # bpftool prog load perf_event_output_stack.o /sys/fs/bpf/prog \ type xdp # bpftool map update pinned /sys/fs/bpf/map \ key 0 0 0 0 \ value pinned /sys/fs/bpf/prog # bpftool prog 11: xdp name xdp_prog1 tag 6f1b482b27443edf gpl loaded_at 2018-11-07T13:09:20-0800 uid 0 xlated 144B jited 130B memlock 4096B map_ids 14 # rm /sys/fs/bpf/prog # bpftool prog 11: xdp name xdp_prog1 tag 6f1b482b27443edf gpl loaded_at 2018-11-07T13:09:20-0800 uid 0 xlated 144B jited 130B memlock 4096B map_ids 14 # rm /sys/fs/bpf/map # bpftool prog # bpftool prog show id 11 Error: get by id (11): No such file or directory I think we should remove all this auto tail call construction unless we have solid annotations in the elf file which can clearly guide the loader.