linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [tip:sched/core 14/47] kernel/sched/fair.c:893:22: error: variable 'p' set but not used
@ 2021-10-12  3:57 kernel test robot
  2021-10-12 11:26 ` Peter Zijlstra
  0 siblings, 1 reply; 8+ messages in thread
From: kernel test robot @ 2021-10-12  3:57 UTC (permalink / raw)
  To: Yafang Shao; +Cc: llvm, kbuild-all, linux-kernel, x86

[-- Attachment #1: Type: text/plain, Size: 6055 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core
head:   b2d5b9cec60fecc72a13191c2c6c05acf60975a5
commit: 60f2415e19d3948641149ac6aca137a7be1d1952 [14/47] sched: Make schedstats helpers independent of fair sched class
config: hexagon-buildonly-randconfig-r002-20211012 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c3dcf39554dbea780d6cb7e12239451ba47a2668)
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/tip/tip.git/commit/?id=60f2415e19d3948641149ac6aca137a7be1d1952
        git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
        git fetch --no-tags tip sched/core
        git checkout 60f2415e19d3948641149ac6aca137a7be1d1952
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=hexagon 

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

All errors (new ones prefixed by >>):

   kernel/sched/fair.c:860:28: error: variable 'stats' set but not used [-Werror,-Wunused-but-set-variable]
                   struct sched_statistics *stats;
                                            ^
   kernel/sched/fair.c:892:27: error: variable 'stats' set but not used [-Werror,-Wunused-but-set-variable]
           struct sched_statistics *stats;
                                    ^
>> kernel/sched/fair.c:893:22: error: variable 'p' set but not used [-Werror,-Wunused-but-set-variable]
           struct task_struct *p = NULL;
                               ^
   kernel/sched/fair.c:910:22: error: variable 'p' set but not used [-Werror,-Wunused-but-set-variable]
           struct task_struct *p = NULL;
                               ^
   kernel/sched/fair.c:909:27: error: variable 'stats' set but not used [-Werror,-Wunused-but-set-variable]
           struct sched_statistics *stats;
                                    ^
>> kernel/sched/fair.c:936:22: error: variable 'tsk' set but not used [-Werror,-Wunused-but-set-variable]
           struct task_struct *tsk = NULL;
                               ^
   kernel/sched/fair.c:935:27: error: variable 'stats' set but not used [-Werror,-Wunused-but-set-variable]
           struct sched_statistics *stats;
                                    ^
   kernel/sched/fair.c:4451:28: error: variable 'stats' set but not used [-Werror,-Wunused-but-set-variable]
                   struct sched_statistics *stats;
                                            ^
   8 errors generated.


vim +/p +893 kernel/sched/fair.c

   840	
   841	/*
   842	 * Update the current task's runtime statistics.
   843	 */
   844	static void update_curr(struct cfs_rq *cfs_rq)
   845	{
   846		struct sched_entity *curr = cfs_rq->curr;
   847		u64 now = rq_clock_task(rq_of(cfs_rq));
   848		u64 delta_exec;
   849	
   850		if (unlikely(!curr))
   851			return;
   852	
   853		delta_exec = now - curr->exec_start;
   854		if (unlikely((s64)delta_exec <= 0))
   855			return;
   856	
   857		curr->exec_start = now;
   858	
   859		if (schedstat_enabled()) {
 > 860			struct sched_statistics *stats;
   861	
   862			stats = __schedstats_from_se(curr);
   863			__schedstat_set(stats->exec_max,
   864					max(delta_exec, stats->exec_max));
   865		}
   866	
   867		curr->sum_exec_runtime += delta_exec;
   868		schedstat_add(cfs_rq->exec_clock, delta_exec);
   869	
   870		curr->vruntime += calc_delta_fair(delta_exec, curr);
   871		update_min_vruntime(cfs_rq);
   872	
   873		if (entity_is_task(curr)) {
   874			struct task_struct *curtask = task_of(curr);
   875	
   876			trace_sched_stat_runtime(curtask, delta_exec, curr->vruntime);
   877			cgroup_account_cputime(curtask, delta_exec);
   878			account_group_exec_runtime(curtask, delta_exec);
   879		}
   880	
   881		account_cfs_rq_runtime(cfs_rq, delta_exec);
   882	}
   883	
   884	static void update_curr_fair(struct rq *rq)
   885	{
   886		update_curr(cfs_rq_of(&rq->curr->se));
   887	}
   888	
   889	static inline void
   890	update_stats_wait_start_fair(struct cfs_rq *cfs_rq, struct sched_entity *se)
   891	{
   892		struct sched_statistics *stats;
 > 893		struct task_struct *p = NULL;
   894	
   895		if (!schedstat_enabled())
   896			return;
   897	
   898		stats = __schedstats_from_se(se);
   899	
   900		if (entity_is_task(se))
   901			p = task_of(se);
   902	
   903		__update_stats_wait_start(rq_of(cfs_rq), p, stats);
   904	}
   905	
   906	static inline void
   907	update_stats_wait_end_fair(struct cfs_rq *cfs_rq, struct sched_entity *se)
   908	{
   909		struct sched_statistics *stats;
   910		struct task_struct *p = NULL;
   911	
   912		if (!schedstat_enabled())
   913			return;
   914	
   915		stats = __schedstats_from_se(se);
   916	
   917		/*
   918		 * When the sched_schedstat changes from 0 to 1, some sched se
   919		 * maybe already in the runqueue, the se->statistics.wait_start
   920		 * will be 0.So it will let the delta wrong. We need to avoid this
   921		 * scenario.
   922		 */
   923		if (unlikely(!schedstat_val(stats->wait_start)))
   924			return;
   925	
   926		if (entity_is_task(se))
   927			p = task_of(se);
   928	
   929		__update_stats_wait_end(rq_of(cfs_rq), p, stats);
   930	}
   931	
   932	static inline void
   933	update_stats_enqueue_sleeper_fair(struct cfs_rq *cfs_rq, struct sched_entity *se)
   934	{
   935		struct sched_statistics *stats;
 > 936		struct task_struct *tsk = NULL;
   937	
   938		if (!schedstat_enabled())
   939			return;
   940	
   941		stats = __schedstats_from_se(se);
   942	
   943		if (entity_is_task(se))
   944			tsk = task_of(se);
   945	
   946		__update_stats_enqueue_sleeper(rq_of(cfs_rq), tsk, stats);
   947	}
   948	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34266 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [tip:sched/core 14/47] kernel/sched/fair.c:893:22: error: variable 'p' set but not used
  2021-10-12  3:57 [tip:sched/core 14/47] kernel/sched/fair.c:893:22: error: variable 'p' set but not used kernel test robot
@ 2021-10-12 11:26 ` Peter Zijlstra
  2021-10-12 13:35   ` Peter Zijlstra
  2021-10-12 14:31   ` [kbuild-all] Re: [tip:sched/core 14/47] kernel/sched/fair.c:893:22: error: variable 'p' set but not used Chen, Rong A
  0 siblings, 2 replies; 8+ messages in thread
From: Peter Zijlstra @ 2021-10-12 11:26 UTC (permalink / raw)
  To: kernel test robot; +Cc: Yafang Shao, llvm, kbuild-all, linux-kernel, x86

On Tue, Oct 12, 2021 at 11:57:41AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core
> head:   b2d5b9cec60fecc72a13191c2c6c05acf60975a5
> commit: 60f2415e19d3948641149ac6aca137a7be1d1952 [14/47] sched: Make schedstats helpers independent of fair sched class
> config: hexagon-buildonly-randconfig-r002-20211012 (attached as .config)
> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c3dcf39554dbea780d6cb7e12239451ba47a2668)
> 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/tip/tip.git/commit/?id=60f2415e19d3948641149ac6aca137a7be1d1952
>         git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
>         git fetch --no-tags tip sched/core
>         git checkout 60f2415e19d3948641149ac6aca137a7be1d1952
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=hexagon 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):
> 
>    kernel/sched/fair.c:860:28: error: variable 'stats' set but not used [-Werror,-Wunused-but-set-variable]
>                    struct sched_statistics *stats;
>                                             ^
>    kernel/sched/fair.c:892:27: error: variable 'stats' set but not used [-Werror,-Wunused-but-set-variable]
>            struct sched_statistics *stats;
>                                     ^
> >> kernel/sched/fair.c:893:22: error: variable 'p' set but not used [-Werror,-Wunused-but-set-variable]
>            struct task_struct *p = NULL;
>                                ^
>    kernel/sched/fair.c:910:22: error: variable 'p' set but not used [-Werror,-Wunused-but-set-variable]
>            struct task_struct *p = NULL;
>                                ^
>    kernel/sched/fair.c:909:27: error: variable 'stats' set but not used [-Werror,-Wunused-but-set-variable]
>            struct sched_statistics *stats;
>                                     ^
> >> kernel/sched/fair.c:936:22: error: variable 'tsk' set but not used [-Werror,-Wunused-but-set-variable]
>            struct task_struct *tsk = NULL;
>                                ^
>    kernel/sched/fair.c:935:27: error: variable 'stats' set but not used [-Werror,-Wunused-but-set-variable]
>            struct sched_statistics *stats;
>                                     ^
>    kernel/sched/fair.c:4451:28: error: variable 'stats' set but not used [-Werror,-Wunused-but-set-variable]
>                    struct sched_statistics *stats;
>                                             ^
>    8 errors generated.

Again, I have absolutely no intention of fixing this. IMO this is the
compiler being a total pain in the arse.

Please stop reporting this.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [tip:sched/core 14/47] kernel/sched/fair.c:893:22: error: variable 'p' set but not used
  2021-10-12 11:26 ` Peter Zijlstra
@ 2021-10-12 13:35   ` Peter Zijlstra
  2021-10-13  6:18     ` Yafang Shao
                       ` (2 more replies)
  2021-10-12 14:31   ` [kbuild-all] Re: [tip:sched/core 14/47] kernel/sched/fair.c:893:22: error: variable 'p' set but not used Chen, Rong A
  1 sibling, 3 replies; 8+ messages in thread
From: Peter Zijlstra @ 2021-10-12 13:35 UTC (permalink / raw)
  To: kernel test robot; +Cc: Yafang Shao, llvm, kbuild-all, linux-kernel, x86

On Tue, Oct 12, 2021 at 01:26:54PM +0200, Peter Zijlstra wrote:

> Again, I have absolutely no intention of fixing this. IMO this is the
> compiler being a total pain in the arse.
> 
> Please stop reporting this.

How's this then?

diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile
index 978fcfca5871..b0d9121c5dce 100644
--- a/kernel/sched/Makefile
+++ b/kernel/sched/Makefile
@@ -3,6 +3,10 @@ ifdef CONFIG_FUNCTION_TRACER
 CFLAGS_REMOVE_clock.o = $(CC_FLAGS_FTRACE)
 endif
 
+# The compilers are complaining about unused variables inside an if(0) scope
+# block. This is daft, shut them up.
+ccflags-y += -Wno-unused-but-set-variable
+
 # These files are disabled because they produce non-interesting flaky coverage
 # that is not a function of syscall inputs. E.g. involuntary context switches.
 KCOV_INSTRUMENT := n

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [kbuild-all] Re: [tip:sched/core 14/47] kernel/sched/fair.c:893:22: error: variable 'p' set but not used
  2021-10-12 11:26 ` Peter Zijlstra
  2021-10-12 13:35   ` Peter Zijlstra
@ 2021-10-12 14:31   ` Chen, Rong A
  1 sibling, 0 replies; 8+ messages in thread
From: Chen, Rong A @ 2021-10-12 14:31 UTC (permalink / raw)
  To: Peter Zijlstra, kernel test robot
  Cc: Yafang Shao, llvm, kbuild-all, linux-kernel, x86



On 10/12/2021 7:26 PM, Peter Zijlstra wrote:
> On Tue, Oct 12, 2021 at 11:57:41AM +0800, kernel test robot wrote:
>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core
>> head:   b2d5b9cec60fecc72a13191c2c6c05acf60975a5
>> commit: 60f2415e19d3948641149ac6aca137a7be1d1952 [14/47] sched: Make schedstats helpers independent of fair sched class
>> config: hexagon-buildonly-randconfig-r002-20211012 (attached as .config)
>> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c3dcf39554dbea780d6cb7e12239451ba47a2668)
>> 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/tip/tip.git/commit/?id=60f2415e19d3948641149ac6aca137a7be1d1952
>>          git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
>>          git fetch --no-tags tip sched/core
>>          git checkout 60f2415e19d3948641149ac6aca137a7be1d1952
>>          # save the attached .config to linux build tree
>>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=hexagon
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <lkp@intel.com>
>>
>> All errors (new ones prefixed by >>):
>>
>>     kernel/sched/fair.c:860:28: error: variable 'stats' set but not used [-Werror,-Wunused-but-set-variable]
>>                     struct sched_statistics *stats;
>>                                              ^
>>     kernel/sched/fair.c:892:27: error: variable 'stats' set but not used [-Werror,-Wunused-but-set-variable]
>>             struct sched_statistics *stats;
>>                                      ^
>>>> kernel/sched/fair.c:893:22: error: variable 'p' set but not used [-Werror,-Wunused-but-set-variable]
>>             struct task_struct *p = NULL;
>>                                 ^
>>     kernel/sched/fair.c:910:22: error: variable 'p' set but not used [-Werror,-Wunused-but-set-variable]
>>             struct task_struct *p = NULL;
>>                                 ^
>>     kernel/sched/fair.c:909:27: error: variable 'stats' set but not used [-Werror,-Wunused-but-set-variable]
>>             struct sched_statistics *stats;
>>                                      ^
>>>> kernel/sched/fair.c:936:22: error: variable 'tsk' set but not used [-Werror,-Wunused-but-set-variable]
>>             struct task_struct *tsk = NULL;
>>                                 ^
>>     kernel/sched/fair.c:935:27: error: variable 'stats' set but not used [-Werror,-Wunused-but-set-variable]
>>             struct sched_statistics *stats;
>>                                      ^
>>     kernel/sched/fair.c:4451:28: error: variable 'stats' set but not used [-Werror,-Wunused-but-set-variable]
>>                     struct sched_statistics *stats;
>>                                              ^
>>     8 errors generated.
> 
> Again, I have absolutely no intention of fixing this. IMO this is the
> compiler being a total pain in the arse.
> 
> Please stop reporting this.

Hi Peterz,

Sorry for the noise, we'll ignore the unused-but-set-variable warning in
kernel/sched/ part. Is there any other issue should be ignored?

Best Regards,
Rong Chen

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [tip:sched/core 14/47] kernel/sched/fair.c:893:22: error: variable 'p' set but not used
  2021-10-12 13:35   ` Peter Zijlstra
@ 2021-10-13  6:18     ` Yafang Shao
  2021-10-14  4:23     ` Nathan Chancellor
  2021-10-15  9:45     ` [tip: sched/core] sched: Disable -Wunused-but-set-variable tip-bot2 for Peter Zijlstra
  2 siblings, 0 replies; 8+ messages in thread
From: Yafang Shao @ 2021-10-13  6:18 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: kernel test robot, llvm, kbuild-all, LKML, x86

On Tue, Oct 12, 2021 at 9:35 PM Peter Zijlstra <peterz@infradead.org> wrote:
>
> On Tue, Oct 12, 2021 at 01:26:54PM +0200, Peter Zijlstra wrote:
>
> > Again, I have absolutely no intention of fixing this. IMO this is the
> > compiler being a total pain in the arse.
> >
> > Please stop reporting this.
>
> How's this then?
>
> diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile
> index 978fcfca5871..b0d9121c5dce 100644
> --- a/kernel/sched/Makefile
> +++ b/kernel/sched/Makefile
> @@ -3,6 +3,10 @@ ifdef CONFIG_FUNCTION_TRACER
>  CFLAGS_REMOVE_clock.o = $(CC_FLAGS_FTRACE)
>  endif
>
> +# The compilers are complaining about unused variables inside an if(0) scope
> +# block. This is daft, shut them up.
> +ccflags-y += -Wno-unused-but-set-variable
> +
>  # These files are disabled because they produce non-interesting flaky coverage
>  # that is not a function of syscall inputs. E.g. involuntary context switches.
>  KCOV_INSTRUMENT := n

After this diff, the warnings disappear.

Tested-by: Yafang Shao <laoar.shao@gmail.com>

-- 
Thanks
Yafang

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [tip:sched/core 14/47] kernel/sched/fair.c:893:22: error: variable 'p' set but not used
  2021-10-12 13:35   ` Peter Zijlstra
  2021-10-13  6:18     ` Yafang Shao
@ 2021-10-14  4:23     ` Nathan Chancellor
  2021-10-14 15:08       ` Peter Zijlstra
  2021-10-15  9:45     ` [tip: sched/core] sched: Disable -Wunused-but-set-variable tip-bot2 for Peter Zijlstra
  2 siblings, 1 reply; 8+ messages in thread
From: Nathan Chancellor @ 2021-10-14  4:23 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: kernel test robot, Yafang Shao, llvm, kbuild-all, linux-kernel, x86

On Tue, Oct 12, 2021 at 03:35:42PM +0200, Peter Zijlstra wrote:
> On Tue, Oct 12, 2021 at 01:26:54PM +0200, Peter Zijlstra wrote:
> 
> > Again, I have absolutely no intention of fixing this. IMO this is the
> > compiler being a total pain in the arse.
> > 
> > Please stop reporting this.
> 
> How's this then?
> 
> diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile
> index 978fcfca5871..b0d9121c5dce 100644
> --- a/kernel/sched/Makefile
> +++ b/kernel/sched/Makefile
> @@ -3,6 +3,10 @@ ifdef CONFIG_FUNCTION_TRACER
>  CFLAGS_REMOVE_clock.o = $(CC_FLAGS_FTRACE)
>  endif
>  
> +# The compilers are complaining about unused variables inside an if(0) scope
> +# block. This is daft, shut them up.
> +ccflags-y += -Wno-unused-but-set-variable

Please consider making this

ccflags-y += $(call cc-disable-warning, unused-but-set-variable)

because -Wunused-but-set-variable was only added to clang in the 13
release but we support back to 10, meaning this will cause errors for
those older compilers.

With that:

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

Additionally, perhaps this could be restricted to just fair.c?

> +
>  # These files are disabled because they produce non-interesting flaky coverage
>  # that is not a function of syscall inputs. E.g. involuntary context switches.
>  KCOV_INSTRUMENT := n
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [tip:sched/core 14/47] kernel/sched/fair.c:893:22: error: variable 'p' set but not used
  2021-10-14  4:23     ` Nathan Chancellor
@ 2021-10-14 15:08       ` Peter Zijlstra
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Zijlstra @ 2021-10-14 15:08 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: kernel test robot, Yafang Shao, llvm, kbuild-all, linux-kernel, x86

On Wed, Oct 13, 2021 at 09:23:56PM -0700, Nathan Chancellor wrote:
> On Tue, Oct 12, 2021 at 03:35:42PM +0200, Peter Zijlstra wrote:
> > On Tue, Oct 12, 2021 at 01:26:54PM +0200, Peter Zijlstra wrote:
> > 
> > > Again, I have absolutely no intention of fixing this. IMO this is the
> > > compiler being a total pain in the arse.
> > > 
> > > Please stop reporting this.
> > 
> > How's this then?
> > 
> > diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile
> > index 978fcfca5871..b0d9121c5dce 100644
> > --- a/kernel/sched/Makefile
> > +++ b/kernel/sched/Makefile
> > @@ -3,6 +3,10 @@ ifdef CONFIG_FUNCTION_TRACER
> >  CFLAGS_REMOVE_clock.o = $(CC_FLAGS_FTRACE)
> >  endif
> >  
> > +# The compilers are complaining about unused variables inside an if(0) scope
> > +# block. This is daft, shut them up.
> > +ccflags-y += -Wno-unused-but-set-variable
> 
> Please consider making this
> 
> ccflags-y += $(call cc-disable-warning, unused-but-set-variable)

Ooh, shiny, will do.

> because -Wunused-but-set-variable was only added to clang in the 13
> release but we support back to 10, meaning this will cause errors for
> those older compilers.
> 
> With that:
> 
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> 
> Additionally, perhaps this could be restricted to just fair.c?

It triggers in a bunch of files, given the right config (defconfig -SCHEDSTATS +SCHED_DEBUG)

(and I have a pile of patches for most of the other warnings somewhere...)

---
# make O=defconfig-build/ kernel/sched/ -j8 -s W=1
../kernel/sched/deadline.c: In function ‘update_stats_wait_start_dl’:
../kernel/sched/deadline.c:1486:27: warning: variable ‘stats’ set but not used [-Wunused-but-set-variable]
1486 |  struct sched_statistics *stats;
|                           ^~~~~
../kernel/sched/deadline.c: In function ‘update_stats_wait_end_dl’:
../kernel/sched/deadline.c:1498:27: warning: variable ‘stats’ set but not used [-Wunused-but-set-variable]
1498 |  struct sched_statistics *stats;
|                           ^~~~~
../kernel/sched/deadline.c: In function ‘update_stats_enqueue_sleeper_dl’:
../kernel/sched/deadline.c:1510:27: warning: variable ‘stats’ set but not used [-Wunused-but-set-variable]
1510 |  struct sched_statistics *stats;
|                           ^~~~~
../kernel/sched/fair.c: In function ‘update_curr’:
../kernel/sched/fair.c:860:28: warning: variable ‘stats’ set but not used [-Wunused-but-set-variable]
860 |   struct sched_statistics *stats;
|                            ^~~~~
../kernel/sched/fair.c: In function ‘update_stats_wait_start_fair’:
../kernel/sched/fair.c:893:22: warning: variable ‘p’ set but not used [-Wunused-but-set-variable]
893 |  struct task_struct *p = NULL;
|                      ^
../kernel/sched/fair.c:892:27: warning: variable ‘stats’ set but not used [-Wunused-but-set-variable]
892 |  struct sched_statistics *stats;
|                           ^~~~~
../kernel/sched/fair.c: In function ‘update_stats_wait_end_fair’:
../kernel/sched/fair.c:910:22: warning: variable ‘p’ set but not used [-Wunused-but-set-variable]
910 |  struct task_struct *p = NULL;
|                      ^
../kernel/sched/fair.c:909:27: warning: variable ‘stats’ set but not used [-Wunused-but-set-variable]
909 |  struct sched_statistics *stats;
|                           ^~~~~
../kernel/sched/fair.c: In function ‘update_stats_enqueue_sleeper_fair’:
../kernel/sched/fair.c:936:22: warning: variable ‘tsk’ set but not used [-Wunused-but-set-variable]
936 |  struct task_struct *tsk = NULL;
|                      ^~~
../kernel/sched/fair.c:935:27: warning: variable ‘stats’ set but not used [-Wunused-but-set-variable]
935 |  struct sched_statistics *stats;
|                           ^~~~~
../kernel/sched/fair.c: In function ‘set_next_entity’:
../kernel/sched/fair.c:4450:28: warning: variable ‘stats’ set but not used [-Wunused-but-set-variable]
4450 |   struct sched_statistics *stats;
|                            ^~~~~
../kernel/sched/rt.c:669:6: warning: no previous prototype for ‘sched_rt_bandwidth_account’ [-Wmissing-prototypes]
669 | bool sched_rt_bandwidth_account(struct rt_rq *rt_rq)
|      ^~~~~~~~~~~~~~~~~~~~~~~~~~
../kernel/sched/rt.c: In function ‘update_stats_wait_start_rt’:
../kernel/sched/rt.c:1292:22: warning: variable ‘p’ set but not used [-Wunused-but-set-variable]
1292 |  struct task_struct *p = NULL;
|                      ^
../kernel/sched/rt.c: In function ‘update_stats_enqueue_sleeper_rt’:
../kernel/sched/rt.c:1311:22: warning: variable ‘p’ set but not used [-Wunused-but-set-variable]
1311 |  struct task_struct *p = NULL;
|                      ^
../kernel/sched/rt.c: In function ‘update_stats_wait_end_rt’:
../kernel/sched/rt.c:1341:22: warning: variable ‘p’ set but not used [-Wunused-but-set-variable]
1341 |  struct task_struct *p = NULL;
|                      ^
../kernel/sched/core.c:3420:6: warning: no previous prototype for ‘sched_set_stop_task’ [-Wmissing-prototypes]
3420 | void sched_set_stop_task(int cpu, struct task_struct *stop)
|      ^~~~~~~~~~~~~~~~~~~
../kernel/sched/debug.c: In function ‘print_cfs_group_stats’:
../kernel/sched/debug.c:466:28: warning: variable ‘stats’ set but not used [-Wunused-but-set-variable]
466 |   struct sched_statistics *stats;
|                            ^~~~~
../kernel/sched/fair.c:8673: warning: Function parameter or member 'sds' not described in 'update_sg_lb_stats'

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [tip: sched/core] sched: Disable -Wunused-but-set-variable
  2021-10-12 13:35   ` Peter Zijlstra
  2021-10-13  6:18     ` Yafang Shao
  2021-10-14  4:23     ` Nathan Chancellor
@ 2021-10-15  9:45     ` tip-bot2 for Peter Zijlstra
  2 siblings, 0 replies; 8+ messages in thread
From: tip-bot2 for Peter Zijlstra @ 2021-10-15  9:45 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Peter Zijlstra (Intel), Nathan Chancellor, x86, linux-kernel

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     37b47298ab864fb3f5488ddebfc35267ceab0553
Gitweb:        https://git.kernel.org/tip/37b47298ab864fb3f5488ddebfc35267ceab0553
Author:        Peter Zijlstra <peterz@infradead.org>
AuthorDate:    Tue, 12 Oct 2021 16:08:07 +02:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Fri, 15 Oct 2021 11:25:15 +02:00

sched: Disable -Wunused-but-set-variable

The compilers can't deal with obvious DCE vs that warning, resulting
in code like:

	if (0) {
		sched sched_statistics *stats;

		stats = __schedstats_from_se(se);

		...
	}

triggering the warning. Kill the warning to make the robots stop
reporting this.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lkml.kernel.org/r/YWWPLnaZGybHsTkv@hirez.programming.kicks-ass.net
---
 kernel/sched/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile
index 978fcfc..c7421f2 100644
--- a/kernel/sched/Makefile
+++ b/kernel/sched/Makefile
@@ -3,6 +3,10 @@ ifdef CONFIG_FUNCTION_TRACER
 CFLAGS_REMOVE_clock.o = $(CC_FLAGS_FTRACE)
 endif
 
+# The compilers are complaining about unused variables inside an if(0) scope
+# block. This is daft, shut them up.
+ccflags-y += $(call cc-disable-warning, unused-but-set-variable)
+
 # These files are disabled because they produce non-interesting flaky coverage
 # that is not a function of syscall inputs. E.g. involuntary context switches.
 KCOV_INSTRUMENT := n

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-10-15  9:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12  3:57 [tip:sched/core 14/47] kernel/sched/fair.c:893:22: error: variable 'p' set but not used kernel test robot
2021-10-12 11:26 ` Peter Zijlstra
2021-10-12 13:35   ` Peter Zijlstra
2021-10-13  6:18     ` Yafang Shao
2021-10-14  4:23     ` Nathan Chancellor
2021-10-14 15:08       ` Peter Zijlstra
2021-10-15  9:45     ` [tip: sched/core] sched: Disable -Wunused-but-set-variable tip-bot2 for Peter Zijlstra
2021-10-12 14:31   ` [kbuild-all] Re: [tip:sched/core 14/47] kernel/sched/fair.c:893:22: error: variable 'p' set but not used Chen, Rong A

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).