Message ID | 20200616100512.2168860-1-jolsa@kernel.org |
---|---|
Headers | show |
Series | bpf: Add d_path helper | expand |
Jiri Olsa wrote: > hi, > adding d_path helper to return full path for 'path' object. > > I originally added and used 'file_path' helper, which did the same, > but used 'struct file' object. Then realized that file_path is just > a wrapper for d_path, so we'd cover more calling sites if we add > d_path helper and allowed resolving BTF object within another object, > so we could call d_path also with file pointer, like: > > bpf_d_path(&file->f_path, buf, size); > > This feature is mainly to be able to add dpath (filepath originally) > function to bpftrace: > > # bpftrace -e 'kfunc:vfs_open { printf("%s\n", dpath(args->path)); }' > > v3 changes: > - changed tests to use seleton and vmlinux.h [Andrii] > - refactored to define ID lists in C object [Andrii] > - changed btf_struct_access for nested ID check, > instead of adding new function for that [Andrii] > - fail build with CONFIG_DEBUG_INFO_BTF if libelf is not detected [Andrii] > > Also available at: > https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git > bpf/d_path > > thanks, > jirka Hi Jira, Apologize for waiting until v3 to look at this series, but a couple general requests as I review this. In the cover letter can we get some more details. The above is really terse/cryptic in my opinion. The bpftrace example gives good motiviation, but nothing above mentions a new .BTF_ids section and the flow to create and use this section. Also if we add a BTF_ids section adding documentation in btf.rst should happen as well. I would like to see something in the ELF File Format Interface section and BTF Generation sections. I'm not going to nitpick if its in this series or a stand-alone patch but do want to see it. So far the Documentation on BTF is fairly good and I want to avoid these kind of gaps. Thanks! John
On Thu, Jun 18, 2020 at 01:57:19PM -0700, John Fastabend wrote: > Jiri Olsa wrote: > > hi, > > adding d_path helper to return full path for 'path' object. > > > > I originally added and used 'file_path' helper, which did the same, > > but used 'struct file' object. Then realized that file_path is just > > a wrapper for d_path, so we'd cover more calling sites if we add > > d_path helper and allowed resolving BTF object within another object, > > so we could call d_path also with file pointer, like: > > > > bpf_d_path(&file->f_path, buf, size); > > > > This feature is mainly to be able to add dpath (filepath originally) > > function to bpftrace: > > > > # bpftrace -e 'kfunc:vfs_open { printf("%s\n", dpath(args->path)); }' > > > > v3 changes: > > - changed tests to use seleton and vmlinux.h [Andrii] > > - refactored to define ID lists in C object [Andrii] > > - changed btf_struct_access for nested ID check, > > instead of adding new function for that [Andrii] > > - fail build with CONFIG_DEBUG_INFO_BTF if libelf is not detected [Andrii] > > > > Also available at: > > https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git > > bpf/d_path > > > > thanks, > > jirka > > Hi Jira, Apologize for waiting until v3 to look at this series, but a > couple general requests as I review this. > > In the cover letter can we get some more details. The above is really > terse/cryptic in my opinion. The bpftrace example gives good motiviation, > but nothing above mentions a new .BTF_ids section and the flow to create > and use this section. ok, will add more details in next version > > Also if we add a BTF_ids section adding documentation in btf.rst should > happen as well. I would like to see something in the ELF File Format > Interface section and BTF Generation sections. did not know there was bpf.rst ;-) will update > > I'm not going to nitpick if its in this series or a stand-alone patch > but do want to see it. So far the Documentation on BTF is fairly > good and I want to avoid these kind of gaps. sure, thanks jirka > > Thanks! > John >