From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexei Starovoitov Subject: Re: [PATCH bpf-next v3 2/7] bpf: introduce bpf subcommand BPF_TASK_FD_QUERY Date: Wed, 23 May 2018 14:04:01 -0700 Message-ID: <20180523210359.dz2zwqcb76hebrtn@ast-mbp> References: <20180522163048.3128924-1-yhs@fb.com> <20180522163048.3128924-3-yhs@fb.com> <20180523171320.ziswsvpsyelxb6fz@kafai-mbp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Yonghong Song , peterz@infradead.org, ast@fb.com, daniel@iogearbox.net, netdev@vger.kernel.org, kernel-team@fb.com To: Martin KaFai Lau Return-path: Received: from mail-pl0-f66.google.com ([209.85.160.66]:46815 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933737AbeEWVEF (ORCPT ); Wed, 23 May 2018 17:04:05 -0400 Received: by mail-pl0-f66.google.com with SMTP id 30-v6so13747388pld.13 for ; Wed, 23 May 2018 14:04:05 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20180523171320.ziswsvpsyelxb6fz@kafai-mbp> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, May 23, 2018 at 10:13:22AM -0700, Martin KaFai Lau wrote: > > + __u32 prog_id; /* output: prod_id */ > > + __u32 attach_info; /* output: BPF_ATTACH_* */ > > + __u64 probe_offset; /* output: probe_offset */ > > + __u64 probe_addr; /* output: probe_addr */ > > + } task_fd_query; > > } __attribute__((aligned(8))); > > > > /* The description below is an attempt at providing documentation to eBPF > > @@ -2458,4 +2475,14 @@ struct bpf_fib_lookup { > > __u8 dmac[6]; /* ETH_ALEN */ > > }; > > > > +/* used by based query */ > > +enum { > Nit. Instead of a comment, is it better to give this > enum a descriptive name? > > > + BPF_ATTACH_RAW_TRACEPOINT, /* tp name */ > > + BPF_ATTACH_TRACEPOINT, /* tp name */ > > + BPF_ATTACH_KPROBE, /* (symbol + offset) or addr */ > > + BPF_ATTACH_KRETPROBE, /* (symbol + offset) or addr */ > > + BPF_ATTACH_UPROBE, /* filename + offset */ > > + BPF_ATTACH_URETPROBE, /* filename + offset */ > > +}; One more nit here. Can we come up with better names for the above? 'attach' is a verb. I cannot help but read above as it's an action for the kernel to attach to something and not the type of event where the program was attached to. Since we pass task+fd into that BPF_TASK_FD_QUERY command how about returning BPF_FD_TYPE_KPROBE, BPF_FD_TYPE_TRACEPOINT, ... ?