kernel/sched/core.c:5370:37: warning: cast between incompatible function types from 'long int (*)(void)' to 'int (*)(void)'

From: kernel test robot
Date: Wed Mar 31 2021 - 02:17:39 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 5e46d1b78a03d52306f21f77a4e4a144b6d31486
commit: 826bfeb37bb4302ee6042f330c4c0c757152bdb8 preempt/dynamic: Support dynamic preempt with preempt= boot option
date: 6 weeks ago
config: x86_64-randconfig-r011-20210331 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=826bfeb37bb4302ee6042f330c4c0c757152bdb8
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 826bfeb37bb4302ee6042f330c4c0c757152bdb8
# save the attached .config to linux build tree
make W=1 ARCH=x86_64

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

All warnings (new ones prefixed by >>):

kernel/sched/core.c: In function 'schedule_tail':
kernel/sched/core.c:4252:13: warning: variable 'rq' set but not used [-Wunused-but-set-variable]
4252 | struct rq *rq;
| ^~
In file included from include/linux/err.h:5,
from include/linux/kthread.h:5,
from include/trace/events/sched.h:8,
from kernel/sched/core.c:10:
kernel/sched/core.c: In function 'setup_preempt_mode':
>> kernel/sched/core.c:5370:37: warning: cast between incompatible function types from 'long int (*)(void)' to 'int (*)(void)' [-Wcast-function-type]
5370 | static_call_update(might_resched, (typeof(&__cond_resched)) __static_call_return0);
| ^
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
include/linux/compiler_types.h:300:3: note: in expansion of macro 'if'
300 | if (!(condition)) \
| ^~
include/linux/compiler_types.h:308:2: note: in expansion of macro '__compiletime_assert'
308 | __compiletime_assert(condition, msg, prefix, suffix)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:320:2: note: in expansion of macro '_compiletime_assert'
320 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
include/linux/static_call.h:116:2: note: in expansion of macro 'BUILD_BUG_ON'
116 | BUILD_BUG_ON(!__same_type(*(func), STATIC_CALL_TRAMP(name))); \
| ^~~~~~~~~~~~
include/linux/static_call.h:116:16: note: in expansion of macro '__same_type'
116 | BUILD_BUG_ON(!__same_type(*(func), STATIC_CALL_TRAMP(name))); \
| ^~~~~~~~~~~
kernel/sched/core.c:5370:3: note: in expansion of macro 'static_call_update'
5370 | static_call_update(might_resched, (typeof(&__cond_resched)) __static_call_return0);
| ^~~~~~~~~~~~~~~~~~
>> kernel/sched/core.c:5370:37: warning: cast between incompatible function types from 'long int (*)(void)' to 'int (*)(void)' [-Wcast-function-type]
5370 | static_call_update(might_resched, (typeof(&__cond_resched)) __static_call_return0);
| ^
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
include/linux/compiler_types.h:300:3: note: in expansion of macro 'if'
300 | if (!(condition)) \
| ^~
include/linux/compiler_types.h:308:2: note: in expansion of macro '__compiletime_assert'
308 | __compiletime_assert(condition, msg, prefix, suffix)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:320:2: note: in expansion of macro '_compiletime_assert'
320 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
include/linux/static_call.h:116:2: note: in expansion of macro 'BUILD_BUG_ON'
116 | BUILD_BUG_ON(!__same_type(*(func), STATIC_CALL_TRAMP(name))); \
| ^~~~~~~~~~~~
include/linux/static_call.h:116:16: note: in expansion of macro '__same_type'
116 | BUILD_BUG_ON(!__same_type(*(func), STATIC_CALL_TRAMP(name))); \
| ^~~~~~~~~~~
kernel/sched/core.c:5370:3: note: in expansion of macro 'static_call_update'
5370 | static_call_update(might_resched, (typeof(&__cond_resched)) __static_call_return0);
| ^~~~~~~~~~~~~~~~~~
>> kernel/sched/core.c:5370:37: warning: cast between incompatible function types from 'long int (*)(void)' to 'int (*)(void)' [-Wcast-function-type]
5370 | static_call_update(might_resched, (typeof(&__cond_resched)) __static_call_return0);
| ^
include/linux/compiler.h:69:3: note: in definition of macro '__trace_if_value'
69 | (cond) ? \
| ^~~~
include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
| ^~~~~~~~~~~~~~
include/linux/compiler_types.h:300:3: note: in expansion of macro 'if'
300 | if (!(condition)) \
| ^~
include/linux/compiler_types.h:308:2: note: in expansion of macro '__compiletime_assert'
308 | __compiletime_assert(condition, msg, prefix, suffix)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:320:2: note: in expansion of macro '_compiletime_assert'
320 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
include/linux/static_call.h:116:2: note: in expansion of macro 'BUILD_BUG_ON'
116 | BUILD_BUG_ON(!__same_type(*(func), STATIC_CALL_TRAMP(name))); \
| ^~~~~~~~~~~~
include/linux/static_call.h:116:16: note: in expansion of macro '__same_type'
116 | BUILD_BUG_ON(!__same_type(*(func), STATIC_CALL_TRAMP(name))); \
| ^~~~~~~~~~~
kernel/sched/core.c:5370:3: note: in expansion of macro 'static_call_update'
5370 | static_call_update(might_resched, (typeof(&__cond_resched)) __static_call_return0);
| ^~~~~~~~~~~~~~~~~~
In file included from include/linux/tracepoint.h:22,
from include/trace/events/sched.h:10,
from kernel/sched/core.c:10:
>> kernel/sched/core.c:5370:37: warning: cast between incompatible function types from 'long int (*)(void)' to 'int (*)(void)' [-Wcast-function-type]
5370 | static_call_update(might_resched, (typeof(&__cond_resched)) __static_call_return0);
| ^
include/linux/static_call.h:118:39: note: in definition of macro 'static_call_update'
118 | STATIC_CALL_TRAMP_ADDR(name), func); \
| ^~~~
In file included from include/linux/err.h:5,
from include/linux/kthread.h:5,
from include/trace/events/sched.h:8,
from kernel/sched/core.c:10:
kernel/sched/core.c:5383:36: warning: cast between incompatible function types from 'long int (*)(void)' to 'int (*)(void)' [-Wcast-function-type]
5383 | static_call_update(cond_resched, (typeof(&__cond_resched)) __static_call_return0);
| ^
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
include/linux/compiler_types.h:300:3: note: in expansion of macro 'if'
300 | if (!(condition)) \
| ^~
include/linux/compiler_types.h:308:2: note: in expansion of macro '__compiletime_assert'
308 | __compiletime_assert(condition, msg, prefix, suffix)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:320:2: note: in expansion of macro '_compiletime_assert'
320 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
include/linux/static_call.h:116:2: note: in expansion of macro 'BUILD_BUG_ON'
116 | BUILD_BUG_ON(!__same_type(*(func), STATIC_CALL_TRAMP(name))); \
| ^~~~~~~~~~~~
include/linux/static_call.h:116:16: note: in expansion of macro '__same_type'
116 | BUILD_BUG_ON(!__same_type(*(func), STATIC_CALL_TRAMP(name))); \
| ^~~~~~~~~~~
kernel/sched/core.c:5383:3: note: in expansion of macro 'static_call_update'
5383 | static_call_update(cond_resched, (typeof(&__cond_resched)) __static_call_return0);
| ^~~~~~~~~~~~~~~~~~
kernel/sched/core.c:5383:36: warning: cast between incompatible function types from 'long int (*)(void)' to 'int (*)(void)' [-Wcast-function-type]
5383 | static_call_update(cond_resched, (typeof(&__cond_resched)) __static_call_return0);
| ^
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
include/linux/compiler_types.h:300:3: note: in expansion of macro 'if'
300 | if (!(condition)) \
| ^~
include/linux/compiler_types.h:308:2: note: in expansion of macro '__compiletime_assert'
308 | __compiletime_assert(condition, msg, prefix, suffix)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:320:2: note: in expansion of macro '_compiletime_assert'
320 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
include/linux/static_call.h:116:2: note: in expansion of macro 'BUILD_BUG_ON'
116 | BUILD_BUG_ON(!__same_type(*(func), STATIC_CALL_TRAMP(name))); \
| ^~~~~~~~~~~~
include/linux/static_call.h:116:16: note: in expansion of macro '__same_type'
116 | BUILD_BUG_ON(!__same_type(*(func), STATIC_CALL_TRAMP(name))); \
| ^~~~~~~~~~~
kernel/sched/core.c:5383:3: note: in expansion of macro 'static_call_update'
5383 | static_call_update(cond_resched, (typeof(&__cond_resched)) __static_call_return0);
| ^~~~~~~~~~~~~~~~~~
kernel/sched/core.c:5383:36: warning: cast between incompatible function types from 'long int (*)(void)' to 'int (*)(void)' [-Wcast-function-type]
5383 | static_call_update(cond_resched, (typeof(&__cond_resched)) __static_call_return0);
| ^
include/linux/compiler.h:69:3: note: in definition of macro '__trace_if_value'
69 | (cond) ? \
| ^~~~
include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
| ^~~~~~~~~~~~~~
include/linux/compiler_types.h:300:3: note: in expansion of macro 'if'
300 | if (!(condition)) \
| ^~
include/linux/compiler_types.h:308:2: note: in expansion of macro '__compiletime_assert'
308 | __compiletime_assert(condition, msg, prefix, suffix)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:320:2: note: in expansion of macro '_compiletime_assert'
320 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
include/linux/static_call.h:116:2: note: in expansion of macro 'BUILD_BUG_ON'
116 | BUILD_BUG_ON(!__same_type(*(func), STATIC_CALL_TRAMP(name))); \
| ^~~~~~~~~~~~
include/linux/static_call.h:116:16: note: in expansion of macro '__same_type'
116 | BUILD_BUG_ON(!__same_type(*(func), STATIC_CALL_TRAMP(name))); \
| ^~~~~~~~~~~
kernel/sched/core.c:5383:3: note: in expansion of macro 'static_call_update'


vim +5370 kernel/sched/core.c

5336
5337 /*
5338 * SC:cond_resched
5339 * SC:might_resched
5340 * SC:preempt_schedule
5341 * SC:preempt_schedule_notrace
5342 * SC:irqentry_exit_cond_resched
5343 *
5344 *
5345 * NONE:
5346 * cond_resched <- __cond_resched
5347 * might_resched <- RET0
5348 * preempt_schedule <- NOP
5349 * preempt_schedule_notrace <- NOP
5350 * irqentry_exit_cond_resched <- NOP
5351 *
5352 * VOLUNTARY:
5353 * cond_resched <- __cond_resched
5354 * might_resched <- __cond_resched
5355 * preempt_schedule <- NOP
5356 * preempt_schedule_notrace <- NOP
5357 * irqentry_exit_cond_resched <- NOP
5358 *
5359 * FULL:
5360 * cond_resched <- RET0
5361 * might_resched <- RET0
5362 * preempt_schedule <- preempt_schedule
5363 * preempt_schedule_notrace <- preempt_schedule_notrace
5364 * irqentry_exit_cond_resched <- irqentry_exit_cond_resched
5365 */
5366 static int __init setup_preempt_mode(char *str)
5367 {
5368 if (!strcmp(str, "none")) {
5369 static_call_update(cond_resched, __cond_resched);
> 5370 static_call_update(might_resched, (typeof(&__cond_resched)) __static_call_return0);
5371 static_call_update(preempt_schedule, (typeof(&preempt_schedule)) NULL);
5372 static_call_update(preempt_schedule_notrace, (typeof(&preempt_schedule_notrace)) NULL);
5373 static_call_update(irqentry_exit_cond_resched, (typeof(&irqentry_exit_cond_resched)) NULL);
5374 pr_info("Dynamic Preempt: %s\n", str);
5375 } else if (!strcmp(str, "voluntary")) {
5376 static_call_update(cond_resched, __cond_resched);
5377 static_call_update(might_resched, __cond_resched);
5378 static_call_update(preempt_schedule, (typeof(&preempt_schedule)) NULL);
5379 static_call_update(preempt_schedule_notrace, (typeof(&preempt_schedule_notrace)) NULL);
5380 static_call_update(irqentry_exit_cond_resched, (typeof(&irqentry_exit_cond_resched)) NULL);
5381 pr_info("Dynamic Preempt: %s\n", str);
5382 } else if (!strcmp(str, "full")) {
5383 static_call_update(cond_resched, (typeof(&__cond_resched)) __static_call_return0);
5384 static_call_update(might_resched, (typeof(&__cond_resched)) __static_call_return0);
5385 static_call_update(preempt_schedule, __preempt_schedule_func);
5386 static_call_update(preempt_schedule_notrace, __preempt_schedule_notrace_func);
5387 static_call_update(irqentry_exit_cond_resched, irqentry_exit_cond_resched);
5388 pr_info("Dynamic Preempt: %s\n", str);
5389 } else {
5390 pr_warn("Dynamic Preempt: Unsupported preempt mode %s, default to full\n", str);
5391 return 1;
5392 }
5393 return 0;
5394 }
5395 __setup("preempt=", setup_preempt_mode);
5396

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

Attachment: .config.gz
Description: application/gzip