tree: https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git ftrace/core head: c6315a8ad7fa1fb8663b0ae15020bc87e12a8f6b commit: e62d91d8206ec14abe6584091b2b5faad08cfa36 [57/59] ftrace/direct: Do not disable when switching direct callers config: i386-randconfig-a005-20211019 (attached as .config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project b37efed957ed0a0193d80020aefd55cb587dfc1f) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git/commit/?id=e62d91d8206ec14abe6584091b2b5faad08cfa36 git remote add rostedt-trace https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git git fetch --no-tags rostedt-trace ftrace/core git checkout e62d91d8206ec14abe6584091b2b5faad08cfa36 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=i386 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): In file included from kernel/trace/ftrace.c:29: include/linux/ftrace.h:49:41: warning: declaration of 'struct ftrace_regs' will not be visible outside of this function [-Wvisibility] struct ftrace_ops *op, struct ftrace_regs *fregs); ^ kernel/trace/ftrace.c:297:5: warning: no previous prototype for function '__register_ftrace_function' [-Wmissing-prototypes] int __register_ftrace_function(struct ftrace_ops *ops) ^ kernel/trace/ftrace.c:297:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int __register_ftrace_function(struct ftrace_ops *ops) ^ static kernel/trace/ftrace.c:340:5: warning: no previous prototype for function '__unregister_ftrace_function' [-Wmissing-prototypes] int __unregister_ftrace_function(struct ftrace_ops *ops) ^ kernel/trace/ftrace.c:340:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int __unregister_ftrace_function(struct ftrace_ops *ops) ^ static kernel/trace/ftrace.c:3905:15: warning: no previous prototype for function 'arch_ftrace_match_adjust' [-Wmissing-prototypes] char * __weak arch_ftrace_match_adjust(char *str, const char *search) ^ kernel/trace/ftrace.c:3905:1: note: declare 'static' if the function is not intended to be used outside of this translation unit char * __weak arch_ftrace_match_adjust(char *str, const char *search) ^ static >> kernel/trace/ftrace.c:5608:2: warning: unused label 'out_unlock' [-Wunused-label] out_unlock: ^~~~~~~~~~~ kernel/trace/ftrace.c:7256:6: error: conflicting types for 'arch_ftrace_ops_list_func' void arch_ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, ^ include/linux/ftrace.h:48:6: note: previous declaration is here void arch_ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, ^ 5 warnings and 1 error generated. vim +/out_unlock +5608 kernel/trace/ftrace.c 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5546 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5547 /** 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5548 * modify_ftrace_direct_multi - Modify an existing direct 'multi' call 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5549 * to call something else 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5550 * @ops: The address of the struct ftrace_ops object 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5551 * @addr: The address of the new trampoline to call at @ops functions 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5552 * 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5553 * This is used to unregister currently registered direct caller and 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5554 * register new one @addr on functions registered in @ops object. 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5555 * 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5556 * Note there's window between ftrace_shutdown and ftrace_startup calls 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5557 * where there will be no callbacks called. 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5558 * 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5559 * Returns: zero on success. Non zero on error, which includes: 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5560 * -EINVAL - The @ops object was not properly registered. 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5561 */ 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5562 int modify_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr) 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5563 { e62d91d8206ec1 Steven Rostedt (VMware 2021-10-14 5564) struct ftrace_hash *hash; 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5565 struct ftrace_func_entry *entry, *iter; e62d91d8206ec1 Steven Rostedt (VMware 2021-10-14 5566) static struct ftrace_ops tmp_ops = { e62d91d8206ec1 Steven Rostedt (VMware 2021-10-14 5567) .func = ftrace_stub, e62d91d8206ec1 Steven Rostedt (VMware 2021-10-14 5568) .flags = FTRACE_OPS_FL_STUB, e62d91d8206ec1 Steven Rostedt (VMware 2021-10-14 5569) }; 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5570 int i, size; 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5571 int err; 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5572 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5573 if (check_direct_multi(ops)) 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5574 return -EINVAL; 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5575 if (!(ops->flags & FTRACE_OPS_FL_ENABLED)) 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5576 return -EINVAL; 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5577 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5578 mutex_lock(&direct_mutex); e62d91d8206ec1 Steven Rostedt (VMware 2021-10-14 5579) e62d91d8206ec1 Steven Rostedt (VMware 2021-10-14 5580) /* Enable the tmp_ops to have the same functions as the direct ops */ e62d91d8206ec1 Steven Rostedt (VMware 2021-10-14 5581) ftrace_ops_init(&tmp_ops); e62d91d8206ec1 Steven Rostedt (VMware 2021-10-14 5582) tmp_ops.func_hash = ops->func_hash; e62d91d8206ec1 Steven Rostedt (VMware 2021-10-14 5583) e62d91d8206ec1 Steven Rostedt (VMware 2021-10-14 5584) err = register_ftrace_function(&tmp_ops); e62d91d8206ec1 Steven Rostedt (VMware 2021-10-14 5585) if (err) e62d91d8206ec1 Steven Rostedt (VMware 2021-10-14 5586) goto out_direct; 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5587 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5588 /* e62d91d8206ec1 Steven Rostedt (VMware 2021-10-14 5589) * Now the ftrace_ops_list_func() is called to do the direct callers. e62d91d8206ec1 Steven Rostedt (VMware 2021-10-14 5590) * We can safely change the direct functions attached to each entry. 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5591 */ e62d91d8206ec1 Steven Rostedt (VMware 2021-10-14 5592) mutex_lock(&ftrace_lock); 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5593 e62d91d8206ec1 Steven Rostedt (VMware 2021-10-14 5594) hash = ops->func_hash->filter_hash; 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5595 size = 1 << hash->size_bits; 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5596 for (i = 0; i < size; i++) { 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5597 hlist_for_each_entry(iter, &hash->buckets[i], hlist) { 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5598 entry = __ftrace_lookup_ip(direct_functions, iter->ip); 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5599 if (!entry) 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5600 continue; 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5601 entry->direct = addr; 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5602 } 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5603 } 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5604 e62d91d8206ec1 Steven Rostedt (VMware 2021-10-14 5605) /* Removing the tmp_ops will add the updated direct callers to the functions */ e62d91d8206ec1 Steven Rostedt (VMware 2021-10-14 5606) unregister_ftrace_function(&tmp_ops); 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5607 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 @5608 out_unlock: 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5609 mutex_unlock(&ftrace_lock); e62d91d8206ec1 Steven Rostedt (VMware 2021-10-14 5610) out_direct: 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5611 mutex_unlock(&direct_mutex); 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5612 return err; 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5613 } 1caf3bc2e3d7d3 Jiri Olsa 2021-10-08 5614 EXPORT_SYMBOL_GPL(modify_ftrace_direct_multi); 763e34e74bb7d5 Steven Rostedt (VMware 2019-11-08 5615) #endif /* CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS */ 763e34e74bb7d5 Steven Rostedt (VMware 2019-11-08 5616) :::::: The code at line 5608 was first introduced by commit :::::: 1caf3bc2e3d7d3b7df018e845af7c9a230ab96b8 ftrace: Add multi direct modify interface :::::: TO: Jiri Olsa :::::: CC: Steven Rostedt (VMware) --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org