Re: [PATCH 2/2] sched/debug: intruduce task_state_to_char helper function

From: Xie XiuQi
Date: Tue Aug 08 2017 - 21:17:01 EST


Hi,

I complied patch 2 incomplete, I'll fix it soon.

--
Xie XiuQi

On 2017/8/8 14:42, kbuild test robot wrote:
> Hi Xie,
>
> [auto build test ERROR on tip/sched/core]
> [also build test ERROR on v4.13-rc4 next-20170807]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/Xie-XiuQi/sched-debug-show-task-state-on-proc-sched_debug/20170808-135825
> config: i386-randconfig-x019-201732 (attached as .config)
> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=i386
>
> All errors (new ones prefixed by >>):
>
> kernel/sched/core.c: In function 'sched_show_task':
>>> kernel/sched/core.c:5114:64: error: expected ')' before ';' token
> printk(KERN_INFO "%-15.15s %c", p->comm, task_state_to_char(p);
> ^
>>> kernel/sched/core.c:5133:1: error: expected ';' before '}' token
> }
> ^
> kernel/sched/core.c:5109:6: warning: unused variable 'ppid' [-Wunused-variable]
> int ppid;
> ^~~~
> kernel/sched/core.c:5108:16: warning: unused variable 'free' [-Wunused-variable]
> unsigned long free = 0;
> ^~~~
> In file included from arch/x86/include/asm/current.h:4:0,
> from include/linux/sched.h:11,
> from kernel/sched/core.c:8:
> kernel/sched/core.c: At top level:
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'strcpy' which is not static
> ______f = { \
> ^
> include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
> #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> ^~~~~~~~~~
> include/linux/string.h:390:2: note: in expansion of macro 'if'
> if (p_size == (size_t)-1 && q_size == (size_t)-1)
> ^~
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'kmemdup' which is not static
> ______f = { \
> ^
> include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
> #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> ^~~~~~~~~~
> include/linux/string.h:380:2: note: in expansion of macro 'if'
> if (p_size < size)
> ^~
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'kmemdup' which is not static
> ______f = { \
> ^
> include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
> #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> ^~~~~~~~~~
> include/linux/string.h:378:2: note: in expansion of macro 'if'
> if (__builtin_constant_p(size) && p_size < size)
> ^~
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr_inv' which is not static
> ______f = { \
> ^
> include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
> #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> ^~~~~~~~~~
> include/linux/string.h:369:2: note: in expansion of macro 'if'
> if (p_size < size)
> ^~
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr_inv' which is not static
> ______f = { \
> ^
> include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
> #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> ^~~~~~~~~~
> include/linux/string.h:367:2: note: in expansion of macro 'if'
> if (__builtin_constant_p(size) && p_size < size)
> ^~
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr' which is not static
> ______f = { \
> ^
> include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
> #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> ^~~~~~~~~~
> include/linux/string.h:358:2: note: in expansion of macro 'if'
> if (p_size < size)
> ^~
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr' which is not static
> ______f = { \
> ^
> include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
> #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> ^~~~~~~~~~
> include/linux/string.h:356:2: note: in expansion of macro 'if'
> if (__builtin_constant_p(size) && p_size < size)
> ^~
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
> ______f = { \
> ^
> include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
> #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> ^~~~~~~~~~
> include/linux/string.h:348:2: note: in expansion of macro 'if'
> if (p_size < size || q_size < size)
> ^~
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
> ______f = { \
> ^
> include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
> #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> ^~~~~~~~~~
> include/linux/string.h:345:3: note: in expansion of macro 'if'
> if (q_size < size)
> ^~
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
> ______f = { \
> ^
> include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
> #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> ^~~~~~~~~~
> include/linux/string.h:343:3: note: in expansion of macro 'if'
> --
> kernel/sched/debug.c: In function 'print_task':
>>> kernel/sched/debug.c:432:24: error: implicit declaration of function 'task_sate_to_char' [-Werror=implicit-function-declaration]
> SEQ_printf(m, " %c", task_sate_to_char(p));
> ^
> kernel/sched/debug.c:33:17: note: in definition of macro 'SEQ_printf'
> seq_printf(m, x); \
> ^
> In file included from include/uapi/linux/stddef.h:1:0,
> from include/linux/stddef.h:4,
> from include/uapi/linux/posix_types.h:4,
> from include/uapi/linux/types.h:13,
> from include/linux/types.h:5,
> from include/linux/proc_fs.h:7,
> from kernel/sched/debug.c:13:
> kernel/sched/debug.c: At top level:
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'strcpy' which is not static
> ______f = { \
> ^
> include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
> #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> ^~~~~~~~~~
> include/linux/string.h:390:2: note: in expansion of macro 'if'
> if (p_size == (size_t)-1 && q_size == (size_t)-1)
> ^~
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'kmemdup' which is not static
> ______f = { \
> ^
> include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
> #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> ^~~~~~~~~~
> include/linux/string.h:380:2: note: in expansion of macro 'if'
> if (p_size < size)
> ^~
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'kmemdup' which is not static
> ______f = { \
> ^
> include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
> #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> ^~~~~~~~~~
> include/linux/string.h:378:2: note: in expansion of macro 'if'
> if (__builtin_constant_p(size) && p_size < size)
> ^~
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr_inv' which is not static
> ______f = { \
> ^
> include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
> #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> ^~~~~~~~~~
> include/linux/string.h:369:2: note: in expansion of macro 'if'
> if (p_size < size)
> ^~
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr_inv' which is not static
> ______f = { \
> ^
> include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
> #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> ^~~~~~~~~~
> include/linux/string.h:367:2: note: in expansion of macro 'if'
> if (__builtin_constant_p(size) && p_size < size)
> ^~
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr' which is not static
> ______f = { \
> ^
> include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
> #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> ^~~~~~~~~~
> include/linux/string.h:358:2: note: in expansion of macro 'if'
> if (p_size < size)
> ^~
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr' which is not static
> ______f = { \
> ^
> include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
> #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> ^~~~~~~~~~
> include/linux/string.h:356:2: note: in expansion of macro 'if'
> if (__builtin_constant_p(size) && p_size < size)
> ^~
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
> ______f = { \
> ^
> include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
> #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> ^~~~~~~~~~
> include/linux/string.h:348:2: note: in expansion of macro 'if'
> if (p_size < size || q_size < size)
> ^~
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
> ______f = { \
> ^
> include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
> #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> ^~~~~~~~~~
> include/linux/string.h:345:3: note: in expansion of macro 'if'
> if (q_size < size)
> ^~
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
> ______f = { \
> ^
> include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
> #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> ^~~~~~~~~~
>
> vim +5114 kernel/sched/core.c
>
> 5105
> 5106 void sched_show_task(struct task_struct *p)
> 5107 {
> 5108 unsigned long free = 0;
> 5109 int ppid;
> 5110
> 5111 if (!try_get_task_stack(p))
> 5112 return;
> 5113
>> 5114 printk(KERN_INFO "%-15.15s %c", p->comm, task_state_to_char(p);
> 5115
> 5116 if (p->state == TASK_RUNNING)
> 5117 printk(KERN_CONT " running task ");
> 5118 #ifdef CONFIG_DEBUG_STACK_USAGE
> 5119 free = stack_not_used(p);
> 5120 #endif
> 5121 ppid = 0;
> 5122 rcu_read_lock();
> 5123 if (pid_alive(p))
> 5124 ppid = task_pid_nr(rcu_dereference(p->real_parent));
> 5125 rcu_read_unlock();
> 5126 printk(KERN_CONT "%5lu %5d %6d 0x%08lx\n", free,
> 5127 task_pid_nr(p), ppid,
> 5128 (unsigned long)task_thread_info(p)->flags);
> 5129
> 5130 print_worker_info(KERN_INFO, p);
> 5131 show_stack(p, NULL);
> 5132 put_task_stack(p);
>> 5133 }
> 5134
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation
>

--
Thanks,
Xie XiuQi