Re: [PATCH v2 dwarves] btf: Remove ftrace filter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 06, 2021 at 07:54:37PM -0700, Nathan Chancellor wrote:
> On Thu, May 06, 2021 at 01:56:22PM -0700, Martin KaFai Lau wrote:
> > BTF is currently generated for functions that are in ftrace list
> > or extern.
> > 
> > A recent use case also needs BTF generated for functions included in
> > allowlist.  In particular, the kernel
> > commit e78aea8b2170 ("bpf: tcp: Put some tcp cong functions in allowlist for bpf-tcp-cc")
> > allows bpf program to directly call a few tcp cc kernel functions. Those
> > kernel functions are currently allowed only if CONFIG_DYNAMIC_FTRACE
> > is set to ensure they are in the ftrace list but this kconfig dependency
> > is unnecessary.
> > 
> > Those kernel functions are specified under an ELF section .BTF_ids.
> > There was an earlier attempt [0] to add another filter for the functions in
> > the .BTF_ids section.  That discussion concluded that the ftrace filter
> > should be removed instead.
> > 
> > This patch is to remove the ftrace filter and its related functions.
> > 
> > Number of BTF FUNC with and without is_ftrace_func():
> > My kconfig in x86: 40643 vs 46225
> > Jiri reported on arm: 25022 vs 55812
> > 
> > [0]: https://lore.kernel.org/dwarves/20210423213728.3538141-1-kafai@xxxxxx/
> > 
> > Cc: Andrii Nakryiko <andrii@xxxxxxxxxx>
> > Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
> > Signed-off-by: Martin KaFai Lau <kafai@xxxxxx>
> 
> This fixes an issue with Fedora's s390x config that CKI noticed:
> 
> https://groups.google.com/g/clang-built-linux/c/IzthpckBJvc/m/MPWGDmXiAwAJ 
> 
> Tested-by: Nathan Chancellor <nathan@xxxxxxxxxx> # build
Thanks all for reviewing and testing.

In my cross compile ppc64 test, it does not solve the issue.
The problem is the tcp-cc functions (e.g. "cublictcp_*")
are not STT_FUNC in ppc64, so they are not collected in collect_function().
The ".cubictcp_*" is STT_FUNC though.

Since only the x86 (64 and 32) bpf jit can call these tcp-cc functions now
and there is no usage for adding them to .BTF_ids for other ARCHs,
I have post a patch to limit them to x86:
https://lore.kernel.org/bpf/20210508005011.3863757-1-kafai@xxxxxx/

Can you try the above kernel patch without pahole change?
(i.e. use pahole 1.21 as-is).  With the above kernel patch
and pahole 1.21, I have cross compiled arm64, ppc64, s390, and sparc64.

[ p.s. vfs_truncate should work as is in ppc64 since functions_cnt
       should be 0 in ppc64 and then it will rely on fn->external. ]



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux