linux-next: build warning after merge of the tip tree
Subsystems (2)
Hi all,
After merging the tip tree, today's linux-next build (powerpc_ppc64 defconfig) produced this warning:
kernel/sched/debug.c: In function 'print_cfs_group_stats':kernel/sched/debug.c:460:41: warning: unused variable 'stats' [-Wunused-variable]
460 | struct sched_statistics *stats = __schedstats_from_se(se);
| ^~~~~
Caused by commit
cb3e971c435d ("sched: Make struct sched_statistics independent of fair sched class")
# CONFIG_SCHEDSTATS is not set
Signature · 2 lines
Cheers, Stephen Rothwell
Quoted 11 lines · Stephen Rothwell
Hi all,
After merging the tip tree, today's linux-next build (
powerpc_ppc64defconfig) produced this warning:
kernel/sched/debug.c: In function 'print_cfs_group_stats':kernel/sched/debug.c:460:41: warning: unused variable 'stats' [-Wunused-variable]
460 | structsched_statistics*stats =__schedstats_from_se(se);
| ^~~~~
Quoted 6 lines
Caused by commit
cb3e971c435d("sched: Make structsched_statisticsindependent of fair sched class")#
CONFIG_SCHEDSTATSis not set
Hi Stephen,
Thanks for the report.
We have discussed this issue before[1].
This warning happens when CONFIG_SCHEDSTATS is not set and schedstat_enabled() is 0, so the whole scope should be not compiled. It seems that we don't need to fix this warning.
[1]. https://lore.kernel.org/lkml/[email protected]/
Signature · 2 lines
Thanks Yafang
Hi Yafang,
Quoted 20 lines · On Mon, 20 Sep 2021 14:55:29 +0800 Yafang Shao <[email protected]> wrote:
Quoted 11 lines · Stephen Rothwell
Hi all,
After merging the tip tree, today's linux-next build (
powerpc_ppc64defconfig) produced this warning:
kernel/sched/debug.c: In function 'print_cfs_group_stats':kernel/sched/debug.c:460:41: warning: unused variable 'stats' [-Wunused-variable]
460 | structsched_statistics*stats =__schedstats_from_se(se);
| ^~~~~Quoted 6 lines
Caused by commit
cb3e971c435d("sched: Make structsched_statisticsindependent of fair sched class")#
CONFIG_SCHEDSTATSis not set
Quoted 8 lines
Thanks for the report.
We have discussed this issue before[1].
This warning happens whenCONFIG_SCHEDSTATSis not set andschedstat_enabled()is 0, so the whole scope should be not compiled. It seems that we don't need to fix this warning.
Clearly it will be compiled if CONFIG_SCHEDSTATS is not set as that is exactly what this build has ... even sections of code guarded by "if (0)" are compiled, they may just not produce any output in the binary.
Also, I do not have W=1 for this build.
If you turned schedstat_val() into a static inline function, then this warning would go away. That also means that argument types and return values will be better checked.
So, please fix this.
Signature · 2 lines
Cheers, Stephen Rothwell
Hi all,
Quoted 33 lines · On Mon, 20 Sep 2021 18:30:16 +1000 Stephen Rothwell <[email protected]>…
Quoted 18 lines · On Mon, 20 Sep 2021 14:55:29 +0800 Yafang Shao <[email protected]> wrote:
Quoted 9 lines · Stephen Rothwell
After merging the tip tree, today's linux-next build (
powerpc_ppc64defconfig) produced this warning:
kernel/sched/debug.c: In function 'print_cfs_group_stats':kernel/sched/debug.c:460:41: warning: unused variable 'stats' [-Wunused-variable]
460 | structsched_statistics*stats =__schedstats_from_se(se);
| ^~~~~Quoted 6 lines
Caused by commit
cb3e971c435d("sched: Make structsched_statisticsindependent of fair sched class")#
CONFIG_SCHEDSTATSis not setQuoted 8 lines
Thanks for the report.
We have discussed this issue before[1].
This warning happens whenCONFIG_SCHEDSTATSis not set andschedstat_enabled()is 0, so the whole scope should be not compiled. It seems that we don't need to fix this warning.Clearly it will be compiled if
CONFIG_SCHEDSTATSis not set as that is exactly what this build has ... even sections of code guarded by "if (0)" are compiled, they may just not produce any output in the binary.
Quoted 5 lines
Also, I do not have W=1 for this build.
If you turned
schedstat_val()into a static inline function, then this warning would go away. That also means that argument types and return values will be better checked.
I take it back, that won't work :-(
Quoted 1 line
So, please fix this.
Still it needs to be fixed to keep unnecessary warnings out of our builds.
Signature · 2 lines
Cheers, Stephen Rothwell
Peter Zijlstra
maintainerQuoted 10 lines · Stephen Rothwell
Hi all,
After merging the tip tree, today's linux-next build (
powerpc_ppc64defconfig) produced this warning:
kernel/sched/debug.c: In function 'print_cfs_group_stats':kernel/sched/debug.c:460:41: warning: unused variable 'stats' [-Wunused-variable]
460 | structsched_statistics*stats =__schedstats_from_se(se);
| ^~~~~
So I've not seen that one *yet*, I've dont a bunch of SCHEDSTAT=n builds. I do think GCC is being quite stupid for giving it, seeing how the whole thing is within if (0). The GCC people seem to disagree when I brought it up.
Anyway, what I did in other parts was the below; that seems to 'upgrade' the warnings from -Wunused-variable to -Wunused-but-set-variable, and that latter *is* in W=1, and I'm arguing it should be promoted to W=2 or thereabout.
Given that whole if(0) {} thing, I don't feel motivated to change things overly much and quite strongly feel this is the compiler being daft.
---
kernel/sched/debug.c +2 -1
@@ -457,7 +457,8 @@ static void print_cfs_group_stats(struct seq_file *m, int cpu, struct task_groupPN (se->sum_exec_runtime);if (schedstat_enabled ()) { -struct sched_statistics *stats =__schedstats_from_se (se); +struct sched_statistics *stats; + stats =__schedstats_from_se (se);PN_SCHEDSTAT (wait_start);PN_SCHEDSTAT (sleep_start);
Hi Peter,
Quoted 31 lines · On Mon, 20 Sep 2021 13:18:53 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 8 lines · Stephen Rothwell
After merging the tip tree, today's linux-next build (
powerpc_ppc64defconfig) produced this warning:
kernel/sched/debug.c: In function 'print_cfs_group_stats':kernel/sched/debug.c:460:41: warning: unused variable 'stats' [-Wunused-variable]
460 | structsched_statistics*stats =__schedstats_from_se(se);
| ^~~~~So I've not seen that one *yet*, I've dont a bunch of SCHEDSTAT=n builds. I do think GCC is being quite stupid for giving it, seeing how the whole thing is within if (0). The GCC people seem to disagree when I brought it up.
Anyway, what I did in other parts was the below; that seems to 'upgrade' the warnings from -Wunused-variable to -Wunused-but-set-variable, and that latter *is* in W=1, and I'm arguing it should be promoted to W=2 or thereabout.
Given that whole if(0) {} thing, I don't feel motivated to change things overly much and quite strongly feel this is the compiler being daft.
---
kernel/sched/debug.c +0
-0
kernel/sched/debug.c static void print_cfs_group_stats(struct seq_file *m, int cpu, struct task_group · line 464
Quoted 9 lines
kernel/sched/debug.c +2
-1@@ -457,7 +457,8 @@ static void print_cfs_group_stats(struct seq_file *m, int cpu, struct task_groupPN (se->sum_exec_runtime);if (schedstat_enabled ()) { -struct sched_statistics *stats =__schedstats_from_se (se); +struct sched_statistics *stats; + stats =__schedstats_from_se (se);PN_SCHEDSTAT (wait_start);PN_SCHEDSTAT (sleep_start);
Any progress on this? I am still getting the warning.
Signature · 2 lines
Cheers, Stephen Rothwell
Peter Zijlstra
maintainerQuoted 41 lines · Stephen Rothwell
Hi Peter,
Quoted 38 lines · On Mon, 20 Sep 2021 13:18:53 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 8 lines · Stephen Rothwell
After merging the tip tree, today's linux-next build (
powerpc_ppc64defconfig) produced this warning:
kernel/sched/debug.c: In function 'print_cfs_group_stats':kernel/sched/debug.c:460:41: warning: unused variable 'stats' [-Wunused-variable]
460 | structsched_statistics*stats =__schedstats_from_se(se);
| ^~~~~So I've not seen that one *yet*, I've dont a bunch of SCHEDSTAT=n builds. I do think GCC is being quite stupid for giving it, seeing how the whole thing is within if (0). The GCC people seem to disagree when I brought it up.
Anyway, what I did in other parts was the below; that seems to 'upgrade' the warnings from -Wunused-variable to -Wunused-but-set-variable, and that latter *is* in W=1, and I'm arguing it should be promoted to W=2 or thereabout.
Given that whole if(0) {} thing, I don't feel motivated to change things overly much and quite strongly feel this is the compiler being daft.
---
kernel/sched/debug.c +2
-1@@ -457,7 +457,8 @@ static void print_cfs_group_stats(struct seq_file *m, int cpu, struct task_groupPN (se->sum_exec_runtime);if (schedstat_enabled ()) { -struct sched_statistics *stats =__schedstats_from_se (se); +struct sched_statistics *stats; + stats =__schedstats_from_se (se);
Quoted 4 lines
kernel/sched/debug.c static void print_cfs_group_stats(struct seq_file *m, int cpu, struct task_group · line 464
Quoted 2 lines
kernel/sched/debug.c +0
-0PN_SCHEDSTAT (wait_start);PN_SCHEDSTAT (sleep_start);Any progress on this? I am still getting the warning.
Urgh, sorry, fell through cracks. Will commit fixup in a few.