On Mon, Dec 7, 2020 at 10:45 PM Saeed Mahameed <saeed@xxxxxxxxxx> wrote: > > On Mon, 2020-12-07 at 22:38 -0800, Andrii Nakryiko wrote: > > On Mon, Dec 7, 2020 at 10:26 PM Saeed Mahameed <saeed@xxxxxxxxxx> > > wrote: > > > On Mon, 2020-12-07 at 19:14 -0800, Andrii Nakryiko wrote: > > > > On Sun, Dec 6, 2020 at 9:21 PM <saeed@xxxxxxxxxx> wrote: > > > > > From: Saeed Mahameed <saeedm@xxxxxxxxxx> > > > > > > [...] > > > > > > > > > > I am not sure why this hasn't been added by the original > > > > > patchset > > > > > > > > because I never though of dumping module BTF by id, given there > > > > is > > > > nicely named /sys/kernel/btf/<module> :) > > > > > > > > > > What if i didn't compile my kernel with SYSFS ? a user experience > > > is a > > > user experience, there is no reason to not support dump a module > > > btf by > > > id or to have different behavior for different BTF sources. > > > > Hm... I didn't claim otherwise and didn't oppose the feature, why the > > lecture about user experience? > > > > Sorry wasn't a lecture, just wanted to emphasize the motivation. > > > Not having sysfs is a valid point. In such cases, if BTF dumping is > > from ID and we see that it's a module BTF, finding vmlinux BTF from > > ID > > makes sense. > > > > > I can revise this patch to support -B option and lookup vmlinux > > > file if > > > not provided for module btf dump by ids. > > > > yep > > > > > but we still need to pass base_btf to btf__get_from_id() in order > > > to > > > support that, as was done for btf__parse_split() ... :/ > > > > btf__get_from_id_split() might be needed, yes. > > > > > Are you sure you don't like the current patch/libbpf API ? it is > > > pretty > > > straight forward and correct. > > > > I definitely don't like adding btf_get_kernel_id() API to libbpf. > > There is nothing special about it to warrant adding it as a public > > API. Everything we discussed can be done by bpftool. > > > > What about the case where sysfs isn't available ? > we still need to find vmlinux's btf id.. Right, but bpftool is perfectly capable of doing that without adding APIs to libbpf. That's why I wrote above: > > Not having sysfs is a valid point. In such cases, if BTF dumping is > > from ID and we see that it's a module BTF, finding vmlinux BTF from > > ID > > makes sense. > > >