Re: [PATCH v1] function_graph: Support recording and printing the function return address
From: kernel test robot
Date: Sat Sep 14 2024 - 18:27:36 EST
Hi Donglin,
kernel test robot noticed the following build errors:
[auto build test ERROR on shuah-kselftest/next]
[also build test ERROR on shuah-kselftest/fixes linus/master v6.11-rc7]
[cannot apply to next-20240913]
[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/function_graph-Support-recording-and-printing-the-function-return-address/20240913-204403
base: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git next
patch link: https://lore.kernel.org/r/20240913123456.600950-1-dolinux.peng%40gmail.com
patch subject: [PATCH v1] function_graph: Support recording and printing the function return address
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240915/202409150605.HgUmU8ea-lkp@xxxxxxxxx/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240915/202409150605.HgUmU8ea-lkp@xxxxxxxxx/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 <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409150605.HgUmU8ea-lkp@xxxxxxxxx/
All errors (new ones prefixed by >>):
In file included from kernel/trace/trace.c:8677:
>> kernel/trace/trace_selftest.c:910:18: error: incompatible function pointer types initializing 'trace_func_graph_ent_t' (aka 'int (*)(struct ftrace_graph_ent *, struct fgraph_ops *, struct fgraph_extras *)') with an expression of type 'int (struct ftrace_graph_ent *, struct fgraph_ops *)' [-Wincompatible-function-pointer-types]
910 | .entryfunc = store_entry,
| ^~~~~~~~~~~
kernel/trace/trace_selftest.c:918:18: error: incompatible function pointer types initializing 'trace_func_graph_ent_t' (aka 'int (*)(struct ftrace_graph_ent *, struct fgraph_ops *, struct fgraph_extras *)') with an expression of type 'int (struct ftrace_graph_ent *, struct fgraph_ops *)' [-Wincompatible-function-pointer-types]
918 | .entryfunc = store_entry,
| ^~~~~~~~~~~
kernel/trace/trace_selftest.c:926:18: error: incompatible function pointer types initializing 'trace_func_graph_ent_t' (aka 'int (*)(struct ftrace_graph_ent *, struct fgraph_ops *, struct fgraph_extras *)') with an expression of type 'int (struct ftrace_graph_ent *, struct fgraph_ops *)' [-Wincompatible-function-pointer-types]
926 | .entryfunc = store_entry,
| ^~~~~~~~~~~
kernel/trace/trace_selftest.c:934:18: error: incompatible function pointer types initializing 'trace_func_graph_ent_t' (aka 'int (*)(struct ftrace_graph_ent *, struct fgraph_ops *, struct fgraph_extras *)') with an expression of type 'int (struct ftrace_graph_ent *, struct fgraph_ops *)' [-Wincompatible-function-pointer-types]
934 | .entryfunc = store_entry,
| ^~~~~~~~~~~
>> kernel/trace/trace_selftest.c:1029:38: error: too few arguments to function call, expected 3, have 2
1029 | return trace_graph_entry(trace, gops);
| ~~~~~~~~~~~~~~~~~ ^
kernel/trace/trace.h:689:5: note: 'trace_graph_entry' declared here
689 | int trace_graph_entry(struct ftrace_graph_ent *trace, struct fgraph_ops *gops,
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
690 | struct fgraph_extras *priv);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from kernel/trace/trace.c:8677:
kernel/trace/trace_selftest.c:1033:16: error: incompatible function pointer types initializing 'trace_func_graph_ent_t' (aka 'int (*)(struct ftrace_graph_ent *, struct fgraph_ops *, struct fgraph_extras *)') with an expression of type 'int (*)(struct ftrace_graph_ent *, struct fgraph_ops *)' [-Wincompatible-function-pointer-types]
1033 | .entryfunc = &trace_graph_entry_watchdog,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
6 errors generated.
vim +910 kernel/trace/trace_selftest.c
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 906)
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 907) static struct fgraph_fixture store_bytes[4] __initdata = {
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 908) [0] = {
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 909) .gops = {
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 @910) .entryfunc = store_entry,
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 911) .retfunc = store_return,
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 912) },
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 913) .store_size = 1,
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 914) .store_type_name = "byte",
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 915) },
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 916) [1] = {
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 917) .gops = {
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 918) .entryfunc = store_entry,
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 919) .retfunc = store_return,
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 920) },
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 921) .store_size = 2,
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 922) .store_type_name = "short",
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 923) },
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 924) [2] = {
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 925) .gops = {
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 926) .entryfunc = store_entry,
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 927) .retfunc = store_return,
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 928) },
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 929) .store_size = 4,
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 930) .store_type_name = "word",
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 931) },
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 932) [3] = {
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 933) .gops = {
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 934) .entryfunc = store_entry,
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 935) .retfunc = store_return,
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 936) },
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 937) .store_size = 8,
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 938) .store_type_name = "long long",
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 939) },
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 940) };
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 941)
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 942) static __init int test_graph_storage_multi(void)
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 943) {
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 944) struct fgraph_fixture *fixture;
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 945) bool printed = false;
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 946) int i, ret;
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 947)
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 948) pr_cont("PASSED\n");
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 949) pr_info("Testing multiple fgraph storage on a function: ");
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 950)
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 951) for (i = 0; i < ARRAY_SIZE(store_bytes); i++) {
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 952) fixture = &store_bytes[i];
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 953) ret = init_fgraph_fixture(fixture);
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 954) if (ret && ret != -ENODEV) {
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 955) pr_cont("*Could not set filter* ");
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 956) printed = true;
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 957) goto out;
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 958) }
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 959)
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 960) ret = register_ftrace_graph(&fixture->gops);
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 961) if (ret) {
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 962) pr_warn("Failed to init store_bytes fgraph tracing\n");
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 963) printed = true;
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 964) goto out;
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 965) }
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 966) }
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 967)
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 968) DYN_FTRACE_TEST_NAME();
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 969) out:
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 970) while (--i >= 0) {
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 971) fixture = &store_bytes[i];
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 972) unregister_ftrace_graph(&fixture->gops);
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 973)
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 974) if (fixture->error_str && !printed) {
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 975) pr_cont("*** %s ***", fixture->error_str);
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 976) printed = true;
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 977) }
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 978) }
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 979) return printed ? -1 : 0;
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 980) }
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 981)
47c3c70aa36971 Steven Rostedt (VMware 2024-06-03 982) /* Test the storage passed across function_graph entry and return */
47c3c70aa36971 Steven Rostedt (VMware 2024-06-03 983) static __init int test_graph_storage(void)
47c3c70aa36971 Steven Rostedt (VMware 2024-06-03 984) {
47c3c70aa36971 Steven Rostedt (VMware 2024-06-03 985) int ret;
47c3c70aa36971 Steven Rostedt (VMware 2024-06-03 986)
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 987) ret = test_graph_storage_single(&store_bytes[0]);
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 988) if (ret)
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 989) return ret;
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 990) ret = test_graph_storage_single(&store_bytes[1]);
47c3c70aa36971 Steven Rostedt (VMware 2024-06-03 991) if (ret)
47c3c70aa36971 Steven Rostedt (VMware 2024-06-03 992) return ret;
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 993) ret = test_graph_storage_single(&store_bytes[2]);
47c3c70aa36971 Steven Rostedt (VMware 2024-06-03 994) if (ret)
47c3c70aa36971 Steven Rostedt (VMware 2024-06-03 995) return ret;
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 996) ret = test_graph_storage_single(&store_bytes[3]);
47c3c70aa36971 Steven Rostedt (VMware 2024-06-03 997) if (ret)
47c3c70aa36971 Steven Rostedt (VMware 2024-06-03 998) return ret;
dd120af2d5f8f3 Masami Hiramatsu (Google 2024-06-03 999) ret = test_graph_storage_multi();
47c3c70aa36971 Steven Rostedt (VMware 2024-06-03 1000) if (ret)
47c3c70aa36971 Steven Rostedt (VMware 2024-06-03 1001) return ret;
47c3c70aa36971 Steven Rostedt (VMware 2024-06-03 1002) return 0;
47c3c70aa36971 Steven Rostedt (VMware 2024-06-03 1003) }
47c3c70aa36971 Steven Rostedt (VMware 2024-06-03 1004) #else
47c3c70aa36971 Steven Rostedt (VMware 2024-06-03 1005) static inline int test_graph_storage(void) { return 0; }
47c3c70aa36971 Steven Rostedt (VMware 2024-06-03 1006) #endif /* CONFIG_DYNAMIC_FTRACE */
47c3c70aa36971 Steven Rostedt (VMware 2024-06-03 1007)
cf586b61f80229 Frederic Weisbecker 2009-03-22 1008 /* Maximum number of functions to trace before diagnosing a hang */
cf586b61f80229 Frederic Weisbecker 2009-03-22 1009 #define GRAPH_MAX_FUNC_TEST 100000000
cf586b61f80229 Frederic Weisbecker 2009-03-22 1010
cf586b61f80229 Frederic Weisbecker 2009-03-22 1011 static unsigned int graph_hang_thresh;
cf586b61f80229 Frederic Weisbecker 2009-03-22 1012
cf586b61f80229 Frederic Weisbecker 2009-03-22 1013 /* Wrap the real function entry probe to avoid possible hanging */
37238abe3cb47b Steven Rostedt (VMware 2024-06-03 1014) static int trace_graph_entry_watchdog(struct ftrace_graph_ent *trace,
37238abe3cb47b Steven Rostedt (VMware 2024-06-03 1015) struct fgraph_ops *gops)
cf586b61f80229 Frederic Weisbecker 2009-03-22 1016 {
cf586b61f80229 Frederic Weisbecker 2009-03-22 1017 /* This is harmlessly racy, we want to approximately detect a hang */
cf586b61f80229 Frederic Weisbecker 2009-03-22 1018 if (unlikely(++graph_hang_thresh > GRAPH_MAX_FUNC_TEST)) {
cf586b61f80229 Frederic Weisbecker 2009-03-22 1019 ftrace_graph_stop();
cf586b61f80229 Frederic Weisbecker 2009-03-22 1020 printk(KERN_WARNING "BUG: Function graph tracer hang!\n");
19f0423fd55c30 Huang Yiwei 2024-02-23 1021 if (ftrace_dump_on_oops_enabled()) {
7fe70b579c9e3d Steven Rostedt (Red Hat 2013-03-15 1022) ftrace_dump(DUMP_ALL);
7fe70b579c9e3d Steven Rostedt (Red Hat 2013-03-15 1023) /* ftrace_dump() disables tracing */
7fe70b579c9e3d Steven Rostedt (Red Hat 2013-03-15 1024) tracing_on();
7fe70b579c9e3d Steven Rostedt (Red Hat 2013-03-15 1025) }
cf586b61f80229 Frederic Weisbecker 2009-03-22 1026 return 0;
cf586b61f80229 Frederic Weisbecker 2009-03-22 1027 }
cf586b61f80229 Frederic Weisbecker 2009-03-22 1028
37238abe3cb47b Steven Rostedt (VMware 2024-06-03 @1029) return trace_graph_entry(trace, gops);
cf586b61f80229 Frederic Weisbecker 2009-03-22 1030 }
cf586b61f80229 Frederic Weisbecker 2009-03-22 1031
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki