Re: [PATCH v3 1/2] fgraph: Enhance funcgraph-retval with BTF-based type-aware output
From: Donglin Peng <hidden>
Date: 2025-12-15 04:56:49
Also in:
bpf, lkml, oe-kbuild-all
On Sun, Dec 14, 2025 at 9:15 AM kernel test robot [off-list ref] wrote:
Hi Donglin, kernel test robot noticed the following build errors: [auto build test ERROR on trace/for-next] [also build test ERROR on linus/master v6.18 next-20251212] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Donglin-Peng/fgraph-Enhance-funcgraph-retval-with-BTF-based-type-aware-output/20251209-201633 base: https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace for-next patch link: https://lore.kernel.org/r/20251209121349.525641-2-dolinux.peng%40gmail.com patch subject: [PATCH v3 1/2] fgraph: Enhance funcgraph-retval with BTF-based type-aware output config: arm-randconfig-002-20251214 (https://download.01.org/0day-ci/archive/20251214/202512140850.JdD1lPmn-lkp@intel.com/config) compiler: arm-linux-gnueabi-gcc (GCC) 10.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251214/202512140850.JdD1lPmn-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot [off-list ref] | Closes: https://lore.kernel.org/oe-kbuild-all/202512140850.JdD1lPmn-lkp@intel.com/ (local) All errors (new ones prefixed by >>): arm-linux-gnueabi-ld: kernel/trace/trace_functions_graph.o: in function `trim_retval':quoted
quoted
kernel/trace/trace_functions_graph.c:888: undefined reference to `btf_find_func_proto'
Thanks. I will address this in the next version. The issue occurs because CONFIG_FUNCTION_GRAPH_RETVAL and CONFIG_DEBUG_INFO_BTF are enabled, but CONFIG_PROBE_EVENTS_BTF_ARGS is disabled. This prevents trace_btf.c from being compiled, while the function btf_find_func_proto it provides is still required. Thanks, Donglin
vim +888 kernel/trace/trace_functions_graph.c
872
873 static void trim_retval(unsigned long func, unsigned long *retval, bool *print_retval,
874 int *fmt)
875 {
876 const struct btf_type *t;
877 char name[KSYM_NAME_LEN];
878 struct btf *btf;
879 u32 v, msb;
880 int kind;
881
882 if (!IS_ENABLED(CONFIG_DEBUG_INFO_BTF))
883 return;
884
885 if (lookup_symbol_name(func, name))
886 return;
887
> 888 t = btf_find_func_proto(name, &btf);
889 if (IS_ERR_OR_NULL(t))
890 return;
891
892 t = btf_type_skip_modifiers(btf, t->type, NULL);
893 kind = t ? BTF_INFO_KIND(t->info) : BTF_KIND_UNKN;
894 switch (kind) {
895 case BTF_KIND_UNKN:
896 *print_retval = false;
897 break;
898 case BTF_KIND_STRUCT:
899 case BTF_KIND_UNION:
900 case BTF_KIND_ENUM:
901 case BTF_KIND_ENUM64:
902 if (kind == BTF_KIND_STRUCT || kind == BTF_KIND_UNION)
903 *fmt = RETVAL_FMT_HEX;
904 else
905 *fmt = RETVAL_FMT_DEC;
906
907 if (t->size > sizeof(unsigned long)) {
908 *fmt |= RETVAL_FMT_TRUNC;
909 } else {
910 msb = BITS_PER_BYTE * t->size - 1;
911 *retval &= GENMASK(msb, 0);
912 }
913 break;
914 case BTF_KIND_INT:
915 v = *(u32 *)(t + 1);
916 if (BTF_INT_ENCODING(v) == BTF_INT_BOOL) {
917 *fmt = RETVAL_FMT_BOOL;
918 msb = 0;
919 } else {
920 if (BTF_INT_ENCODING(v) == BTF_INT_SIGNED)
921 *fmt = RETVAL_FMT_DEC;
922 else
923 *fmt = RETVAL_FMT_HEX;
924
925 if (t->size > sizeof(unsigned long)) {
926 *fmt |= RETVAL_FMT_TRUNC;
927 msb = BITS_PER_LONG - 1;
928 } else {
929 msb = BTF_INT_BITS(v) - 1;
930 }
931 }
932 *retval &= GENMASK(msb, 0);
933 break;
934 default:
935 *fmt = RETVAL_FMT_HEX;
936 break;
937 }
938 }
939
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki