[jolsa-perf:bpf/batch 6/27] include/linux/ftrace.h:351:41: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function

From: kernel test robot
Date: Fri Aug 27 2021 - 00:47:25 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git bpf/batch
head: b81b17307e02f8e6d4abf87e7ec2d7e5aea1e0b5
commit: 9e645faaf9e6f3027cffe59497005d2fef66550d [6/27] ftrace: Add multi direct register/unregister interface
config: riscv-buildonly-randconfig-r006-20210826 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 1076082a0d97bd5c16a25ee7cf3dbb6ee4b5a9fe)
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
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git/commit/?id=9e645faaf9e6f3027cffe59497005d2fef66550d
git remote add jolsa-perf https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
git fetch --no-tags jolsa-perf bpf/batch
git checkout 9e645faaf9e6f3027cffe59497005d2fef66550d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

In file included from kernel/sched/core.c:10:
In file included from include/trace/events/sched.h:738:
In file included from include/trace/define_trace.h:102:
In file included from include/trace/trace_events.h:21:
In file included from include/linux/trace_events.h:10:
In file included from include/linux/perf_event.h:49:
>> include/linux/ftrace.h:351:41: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
>> include/linux/ftrace.h:351:5: warning: no previous prototype for function 'register_ftrace_direct_multi' [-Wmissing-prototypes]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:351:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
static
include/linux/ftrace.h:355:43: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
>> include/linux/ftrace.h:355:5: warning: no previous prototype for function 'unregister_ftrace_direct_multi' [-Wmissing-prototypes]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
include/linux/ftrace.h:355:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
static
kernel/sched/core.c:3268:13: warning: variable 'rq' set but not used [-Wunused-but-set-variable]
struct rq *rq;
^
kernel/sched/core.c:3258:20: warning: unused function 'rq_has_pinned_tasks' [-Wunused-function]
static inline bool rq_has_pinned_tasks(struct rq *rq)
^
kernel/sched/core.c:5109:20: warning: unused function 'sched_tick_start' [-Wunused-function]
static inline void sched_tick_start(int cpu) { }
^
kernel/sched/core.c:5110:20: warning: unused function 'sched_tick_stop' [-Wunused-function]
static inline void sched_tick_stop(int cpu) { }
^
kernel/sched/core.c:5767:20: warning: unused function 'sched_core_cpu_starting' [-Wunused-function]
static inline void sched_core_cpu_starting(unsigned int cpu) {}
^
9 warnings generated.
--
In file included from kernel/sched/loadavg.c:9:
In file included from kernel/sched/sched.h:50:
In file included from include/linux/init_task.h:9:
>> include/linux/ftrace.h:351:41: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
>> include/linux/ftrace.h:351:5: warning: no previous prototype for function 'register_ftrace_direct_multi' [-Wmissing-prototypes]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:351:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
static
include/linux/ftrace.h:355:43: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
>> include/linux/ftrace.h:355:5: warning: no previous prototype for function 'unregister_ftrace_direct_multi' [-Wmissing-prototypes]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
include/linux/ftrace.h:355:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
static
4 warnings generated.
--
In file included from kernel/sched/fair.c:23:
In file included from kernel/sched/sched.h:50:
In file included from include/linux/init_task.h:9:
>> include/linux/ftrace.h:351:41: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
>> include/linux/ftrace.h:351:5: warning: no previous prototype for function 'register_ftrace_direct_multi' [-Wmissing-prototypes]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:351:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
static
include/linux/ftrace.h:355:43: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
>> include/linux/ftrace.h:355:5: warning: no previous prototype for function 'unregister_ftrace_direct_multi' [-Wmissing-prototypes]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
include/linux/ftrace.h:355:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
static
kernel/sched/fair.c:591:5: warning: no previous prototype for function 'sched_update_scaling' [-Wmissing-prototypes]
int sched_update_scaling(void)
^
kernel/sched/fair.c:591:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int sched_update_scaling(void)
^
static
kernel/sched/fair.c:5438:6: warning: no previous prototype for function 'init_cfs_bandwidth' [-Wmissing-prototypes]
void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b) {}
^
kernel/sched/fair.c:5438:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b) {}
^
static
kernel/sched/fair.c:11457:6: warning: no previous prototype for function 'free_fair_sched_group' [-Wmissing-prototypes]
void free_fair_sched_group(struct task_group *tg) { }
^
kernel/sched/fair.c:11457:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void free_fair_sched_group(struct task_group *tg) { }
^
static
kernel/sched/fair.c:11459:5: warning: no previous prototype for function 'alloc_fair_sched_group' [-Wmissing-prototypes]
int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
^
kernel/sched/fair.c:11459:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
^
static
kernel/sched/fair.c:11464:6: warning: no previous prototype for function 'online_fair_sched_group' [-Wmissing-prototypes]
void online_fair_sched_group(struct task_group *tg) { }
^
kernel/sched/fair.c:11464:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void online_fair_sched_group(struct task_group *tg) { }
^
static
kernel/sched/fair.c:11466:6: warning: no previous prototype for function 'unregister_fair_sched_group' [-Wmissing-prototypes]
void unregister_fair_sched_group(struct task_group *tg) { }
^
kernel/sched/fair.c:11466:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void unregister_fair_sched_group(struct task_group *tg) { }
^
static
kernel/sched/fair.c:450:20: warning: unused function 'list_del_leaf_cfs_rq' [-Wunused-function]
static inline void list_del_leaf_cfs_rq(struct cfs_rq *cfs_rq)
^
kernel/sched/fair.c:2939:20: warning: unused function 'account_numa_enqueue' [-Wunused-function]
static inline void account_numa_enqueue(struct rq *rq, struct task_struct *p)
^
kernel/sched/fair.c:2943:20: warning: unused function 'account_numa_dequeue' [-Wunused-function]
static inline void account_numa_dequeue(struct rq *rq, struct task_struct *p)
^
kernel/sched/fair.c:2947:20: warning: unused function 'update_scan_period' [-Wunused-function]
static inline void update_scan_period(struct task_struct *p, int new_cpu)
^
kernel/sched/fair.c:4110:20: warning: unused function 'cfs_rq_is_decayed' [-Wunused-function]
static inline bool cfs_rq_is_decayed(struct cfs_rq *cfs_rq)
^
kernel/sched/fair.c:4124:20: warning: unused function 'remove_entity_load_avg' [-Wunused-function]
static inline void remove_entity_load_avg(struct sched_entity *se) {}
^
kernel/sched/fair.c:5419:20: warning: unused function 'sync_throttle' [-Wunused-function]
static inline void sync_throttle(struct task_group *tg, int cpu) {}
^
kernel/sched/fair.c:5432:19: warning: unused function 'throttled_lb_pair' [-Wunused-function]
static inline int throttled_lb_pair(struct task_group *tg,
^
kernel/sched/fair.c:5444:37: warning: unused function 'tg_cfs_bandwidth' [-Wunused-function]
static inline struct cfs_bandwidth *tg_cfs_bandwidth(struct task_group *tg)
^
kernel/sched/fair.c:5448:20: warning: unused function 'destroy_cfs_bandwidth' [-Wunused-function]
static inline void destroy_cfs_bandwidth(struct cfs_bandwidth *cfs_b) {}
^
kernel/sched/fair.c:5449:20: warning: unused function 'update_runtime_enabled' [-Wunused-function]
static inline void update_runtime_enabled(struct rq *rq) {}
^
kernel/sched/fair.c:5450:20: warning: unused function 'unthrottle_offline_cfs_rqs' [-Wunused-function]
static inline void unthrottle_offline_cfs_rqs(struct rq *rq) {}
^
22 warnings generated.
--
In file included from kernel/sched/rt.c:6:
In file included from kernel/sched/sched.h:50:
In file included from include/linux/init_task.h:9:
>> include/linux/ftrace.h:351:41: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
>> include/linux/ftrace.h:351:5: warning: no previous prototype for function 'register_ftrace_direct_multi' [-Wmissing-prototypes]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:351:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
static
include/linux/ftrace.h:355:43: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
>> include/linux/ftrace.h:355:5: warning: no previous prototype for function 'unregister_ftrace_direct_multi' [-Wmissing-prototypes]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
include/linux/ftrace.h:355:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
static
kernel/sched/rt.c:253:6: warning: no previous prototype for function 'free_rt_sched_group' [-Wmissing-prototypes]
void free_rt_sched_group(struct task_group *tg) { }
^
kernel/sched/rt.c:253:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void free_rt_sched_group(struct task_group *tg) { }
^
static
kernel/sched/rt.c:255:5: warning: no previous prototype for function 'alloc_rt_sched_group' [-Wmissing-prototypes]
int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent)
^
kernel/sched/rt.c:255:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent)
^
static
kernel/sched/rt.c:669:6: warning: no previous prototype for function 'sched_rt_bandwidth_account' [-Wmissing-prototypes]
bool sched_rt_bandwidth_account(struct rt_rq *rt_rq)
^
kernel/sched/rt.c:669:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
bool sched_rt_bandwidth_account(struct rt_rq *rt_rq)
^
static
kernel/sched/rt.c:421:20: warning: unused function 'need_pull_rt_task' [-Wunused-function]
static inline bool need_pull_rt_task(struct rq *rq, struct task_struct *prev)
^
kernel/sched/rt.c:426:20: warning: unused function 'pull_rt_task' [-Wunused-function]
static inline void pull_rt_task(struct rq *this_rq)
^
kernel/sched/rt.c:476:20: warning: unused function 'rt_task_fits_capacity' [-Wunused-function]
static inline bool rt_task_fits_capacity(struct task_struct *p, int cpu)
^
kernel/sched/rt.c:1113:6: warning: unused function 'inc_rt_prio_smp' [-Wunused-function]
void inc_rt_prio_smp(struct rt_rq *rt_rq, int prio, int prev_prio) {}
^
kernel/sched/rt.c:1115:6: warning: unused function 'dec_rt_prio_smp' [-Wunused-function]
void dec_rt_prio_smp(struct rt_rq *rt_rq, int prio, int prev_prio) {}
^
12 warnings generated.
--
In file included from kernel/sched/deadline.c:18:
In file included from kernel/sched/sched.h:50:
In file included from include/linux/init_task.h:9:
>> include/linux/ftrace.h:351:41: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
>> include/linux/ftrace.h:351:5: warning: no previous prototype for function 'register_ftrace_direct_multi' [-Wmissing-prototypes]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:351:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
static
include/linux/ftrace.h:355:43: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
>> include/linux/ftrace.h:355:5: warning: no previous prototype for function 'unregister_ftrace_direct_multi' [-Wmissing-prototypes]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
include/linux/ftrace.h:355:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
static
kernel/sched/deadline.c:686:20: warning: unused function 'need_pull_dl_task' [-Wunused-function]
static inline bool need_pull_dl_task(struct rq *rq, struct task_struct *prev)
^
kernel/sched/deadline.c:691:20: warning: unused function 'pull_dl_task' [-Wunused-function]
static inline void pull_dl_task(struct rq *rq)
^
6 warnings generated.
--
In file included from kernel/sched/psi.c:146:
In file included from kernel/sched/sched.h:50:
In file included from include/linux/init_task.h:9:
>> include/linux/ftrace.h:351:41: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
>> include/linux/ftrace.h:351:5: warning: no previous prototype for function 'register_ftrace_direct_multi' [-Wmissing-prototypes]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:351:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
static
include/linux/ftrace.h:355:43: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
>> include/linux/ftrace.h:355:5: warning: no previous prototype for function 'unregister_ftrace_direct_multi' [-Wmissing-prototypes]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
include/linux/ftrace.h:355:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
static
kernel/sched/psi.c:1112:21: warning: no previous prototype for function 'psi_trigger_create' [-Wmissing-prototypes]
struct psi_trigger *psi_trigger_create(struct psi_group *group,
^
kernel/sched/psi.c:1112:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
struct psi_trigger *psi_trigger_create(struct psi_group *group,
^
static
kernel/sched/psi.c:1246:6: warning: no previous prototype for function 'psi_trigger_replace' [-Wmissing-prototypes]
void psi_trigger_replace(void **trigger_ptr, struct psi_trigger *new)
^
kernel/sched/psi.c:1246:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void psi_trigger_replace(void **trigger_ptr, struct psi_trigger *new)
^
static
kernel/sched/psi.c:1258:10: warning: no previous prototype for function 'psi_trigger_poll' [-Wmissing-prototypes]
__poll_t psi_trigger_poll(void **trigger_ptr,
^
kernel/sched/psi.c:1258:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
__poll_t psi_trigger_poll(void **trigger_ptr,
^
static
7 warnings generated.


vim +351 include/linux/ftrace.h

307
308 #ifdef CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
309 extern int ftrace_direct_func_count;
310 int register_ftrace_direct(unsigned long ip, unsigned long addr);
311 int unregister_ftrace_direct(unsigned long ip, unsigned long addr);
312 int modify_ftrace_direct(unsigned long ip, unsigned long old_addr, unsigned long new_addr);
313 struct ftrace_direct_func *ftrace_find_direct_func(unsigned long addr);
314 int ftrace_modify_direct_caller(struct ftrace_func_entry *entry,
315 struct dyn_ftrace *rec,
316 unsigned long old_addr,
317 unsigned long new_addr);
318 unsigned long ftrace_find_rec_direct(unsigned long ip);
319 int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr);
320 int unregister_ftrace_direct_multi(struct ftrace_ops *ops);
321 #else
322 # define ftrace_direct_func_count 0
323 static inline int register_ftrace_direct(unsigned long ip, unsigned long addr)
324 {
325 return -ENOTSUPP;
326 }
327 static inline int unregister_ftrace_direct(unsigned long ip, unsigned long addr)
328 {
329 return -ENOTSUPP;
330 }
331 static inline int modify_ftrace_direct(unsigned long ip,
332 unsigned long old_addr, unsigned long new_addr)
333 {
334 return -ENOTSUPP;
335 }
336 static inline struct ftrace_direct_func *ftrace_find_direct_func(unsigned long addr)
337 {
338 return NULL;
339 }
340 static inline int ftrace_modify_direct_caller(struct ftrace_func_entry *entry,
341 struct dyn_ftrace *rec,
342 unsigned long old_addr,
343 unsigned long new_addr)
344 {
345 return -ENODEV;
346 }
347 static inline unsigned long ftrace_find_rec_direct(unsigned long ip)
348 {
349 return 0;
350 }
> 351 int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
352 {
353 return -ENODEV;
354 }
> 355 int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
356 {
357 return -ENODEV;
358 }
359 #endif /* CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS */
360

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip