Commit 143e1e28cb (sched: Rework sched_domain topology definition)
introduced a number of functions with a return value of 'const int'.
gcc doesn't know what to do with that and, if the kernel is compiled
with W=1, complains with the following warnings whenever sched.h
is included.
include/linux/sched.h:875:25: warning:
type qualifiers ignored on function return type
include/linux/sched.h:882:25: warning:
type qualifiers ignored on function return type
include/linux/sched.h:889:25: warning:
type qualifiers ignored on function return type
include/linux/sched.h:1002:21: warning:
type qualifiers ignored on function return type
Commits fb2aa855 (sched, ARM: Create a dedicated scheduler topology table)
and 607b45e9a (sched, powerpc: Create a dedicated topology table) introduce
the same warning in the arm and powerpc code.
Drop 'const' from the function declarations to fix the problem.
The fix for all three patches has to be applied together to avoid
compilation failures for the affected architectures.
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: Fix problem in all affected architectures with a single patch
to avoid compilation errors.
arch/arm/kernel/topology.c | 2 +-
arch/powerpc/kernel/smp.c | 2 +-
include/linux/sched.h | 8 ++++----
3 files changed, 6 insertions(+), 6 deletions(-)
@@ -747,7 +747,7 @@ int setup_profiling_timer(unsigned int multiplier)#ifdef CONFIG_SCHED_SMT/* cpumask of CPUs with asymetric SMT dependancy */-staticconstintpowerpc_smt_flags(void)+staticintpowerpc_smt_flags(void){intflags=SD_SHARE_CPUCAPACITY|SD_SHARE_PKG_RESOURCES;
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2014-06-25 01:25:28
On Tue, 2014-06-24 at 18:05 -0700, Guenter Roeck wrote:
.../...
Drop 'const' from the function declarations to fix the problem.
The fix for all three patches has to be applied together to avoid
compilation failures for the affected architectures.
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: Fix problem in all affected architectures with a single patch
to avoid compilation errors.
From: Vincent Guittot <vincent.guittot@linaro.org> Date: 2014-06-25 06:41:42
On 25 June 2014 03:05, Guenter Roeck [off-list ref] wrote:
Commit 143e1e28cb (sched: Rework sched_domain topology definition)
introduced a number of functions with a return value of 'const int'.
gcc doesn't know what to do with that and, if the kernel is compiled
with W=1, complains with the following warnings whenever sched.h
is included.
include/linux/sched.h:875:25: warning:
type qualifiers ignored on function return type
include/linux/sched.h:882:25: warning:
type qualifiers ignored on function return type
include/linux/sched.h:889:25: warning:
type qualifiers ignored on function return type
include/linux/sched.h:1002:21: warning:
type qualifiers ignored on function return type
Commits fb2aa855 (sched, ARM: Create a dedicated scheduler topology table)
and 607b45e9a (sched, powerpc: Create a dedicated topology table) introduce
the same warning in the arm and powerpc code.
Drop 'const' from the function declarations to fix the problem.
The fix for all three patches has to be applied together to avoid
compilation failures for the affected architectures.
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Acked-by Vincent Guittot [off-list ref]
quoted hunk
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: Fix problem in all affected architectures with a single patch
to avoid compilation errors.
arch/arm/kernel/topology.c | 2 +-
arch/powerpc/kernel/smp.c | 2 +-
include/linux/sched.h | 8 ++++----
3 files changed, 6 insertions(+), 6 deletions(-)
@@ -747,7 +747,7 @@ int setup_profiling_timer(unsigned int multiplier)#ifdef CONFIG_SCHED_SMT/* cpumask of CPUs with asymetric SMT dependancy */-staticconstintpowerpc_smt_flags(void)+staticintpowerpc_smt_flags(void){intflags=SD_SHARE_CPUCAPACITY|SD_SHARE_PKG_RESOURCES;
On Tue, Jun 24, 2014 at 06:05:29PM -0700, Guenter Roeck wrote:
quoted hunk
Commit 143e1e28cb (sched: Rework sched_domain topology definition)
introduced a number of functions with a return value of 'const int'.
gcc doesn't know what to do with that and, if the kernel is compiled
with W=1, complains with the following warnings whenever sched.h
is included.
include/linux/sched.h:875:25: warning:
type qualifiers ignored on function return type
include/linux/sched.h:882:25: warning:
type qualifiers ignored on function return type
include/linux/sched.h:889:25: warning:
type qualifiers ignored on function return type
include/linux/sched.h:1002:21: warning:
type qualifiers ignored on function return type
Commits fb2aa855 (sched, ARM: Create a dedicated scheduler topology table)
and 607b45e9a (sched, powerpc: Create a dedicated topology table) introduce
the same warning in the arm and powerpc code.
Drop 'const' from the function declarations to fix the problem.
The fix for all three patches has to be applied together to avoid
compilation failures for the affected architectures.
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: Fix problem in all affected architectures with a single patch
to avoid compilation errors.
arch/arm/kernel/topology.c | 2 +-
arch/powerpc/kernel/smp.c | 2 +-
include/linux/sched.h | 8 ++++----
3 files changed, 6 insertions(+), 6 deletions(-)
@@ -275,7 +275,7 @@ void store_cpu_topology(unsigned int cpuid)cpu_topology[cpuid].socket_id,mpidr);}-staticinlineconstintcpu_corepower_flags(void)+staticinlineintcpu_corepower_flags(void){returnSD_SHARE_PKG_RESOURCES|SD_SHARE_POWERDOMAIN;}
Maybe the author's intention was:
static inline int cpu_corepower_flags(void) __attribute__((const));
?
This specifies that the function has no side effects and the return value
only depends on the (here non-existing) function arguments.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
On Tue, Jun 24, 2014 at 06:05:29PM -0700, Guenter Roeck wrote:
quoted
Commit 143e1e28cb (sched: Rework sched_domain topology definition)
introduced a number of functions with a return value of 'const int'.
gcc doesn't know what to do with that and, if the kernel is compiled
with W=1, complains with the following warnings whenever sched.h
is included.
include/linux/sched.h:875:25: warning:
type qualifiers ignored on function return type
include/linux/sched.h:882:25: warning:
type qualifiers ignored on function return type
include/linux/sched.h:889:25: warning:
type qualifiers ignored on function return type
include/linux/sched.h:1002:21: warning:
type qualifiers ignored on function return type
Commits fb2aa855 (sched, ARM: Create a dedicated scheduler topology table)
and 607b45e9a (sched, powerpc: Create a dedicated topology table) introduce
the same warning in the arm and powerpc code.
Drop 'const' from the function declarations to fix the problem.
The fix for all three patches has to be applied together to avoid
compilation failures for the affected architectures.
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: Fix problem in all affected architectures with a single patch
to avoid compilation errors.
arch/arm/kernel/topology.c | 2 +-
arch/powerpc/kernel/smp.c | 2 +-
include/linux/sched.h | 8 ++++----
3 files changed, 6 insertions(+), 6 deletions(-)
@@ -275,7 +275,7 @@ void store_cpu_topology(unsigned int cpuid)cpu_topology[cpuid].socket_id,mpidr);}-staticinlineconstintcpu_corepower_flags(void)+staticinlineintcpu_corepower_flags(void){returnSD_SHARE_PKG_RESOURCES|SD_SHARE_POWERDOMAIN;}
Maybe the author's intention was:
static inline int cpu_corepower_flags(void) __attribute__((const));
?
This specifies that the function has no side effects and the return value
only depends on the (here non-existing) function arguments.
Possibly, but either I am missing something or this doesn't compile.
Guenter
Hello Guenter,
On Wed, Jun 25, 2014 at 07:27:47AM -0700, Guenter Roeck wrote:
quoted
Maybe the author's intention was:
static inline int cpu_corepower_flags(void) __attribute__((const));
?
This specifies that the function has no side effects and the return value
only depends on the (here non-existing) function arguments.
Possibly, but either I am missing something or this doesn't compile.
You need to do a separate declaration:
static inline int cpu_corepower_flags(void) __attribute__((const));
static inline int cpu_corepower_flags(void)
{
...
Does this help?
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Hello Guenter,
On Wed, Jun 25, 2014 at 07:27:47AM -0700, Guenter Roeck wrote:
quoted
quoted
Maybe the author's intention was:
static inline int cpu_corepower_flags(void) __attribute__((const));
?
This specifies that the function has no side effects and the return value
only depends on the (here non-existing) function arguments.
Possibly, but either I am missing something or this doesn't compile.
You need to do a separate declaration:
static inline int cpu_corepower_flags(void) __attribute__((const));
static inline int cpu_corepower_flags(void)
{
...
Actually turns out one can use __attribute_const__, and it is
static inline int __attribute_const__ cpu_corepower_flags(void)
which turns out to be widely used.
I'll change that and resubmit after testing.
Guenter
Hello,
On Wed, Jun 25, 2014 at 03:40:28PM +0000, David Laight wrote:
From: Guenter Roeck
quoted
Actually turns out one can use __attribute_const__, and it is
static inline int __attribute_const__ cpu_corepower_flags(void)
which turns out to be widely used.
I'll change that and resubmit after testing.
You don't need to tell the compiler that for an inline function.
I didn't check for the functions in question here, but in general your
statement is wrong.
For example:
static inline unsigned int __attribute_const__ read_cpuid_id(void)
{
return readl(BASEADDR_V7M_SCB + V7M_SCB_CPUID);
}
from arch/arm/include/asm/cputype.h. The V7M_SCB_CPUID register never
changes, but there is no way gcc can deduce that.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
From: David Laight <hidden> Date: 2014-06-25 16:05:28
From: Uwe Kleine-K=F6nig=20
Hello,
=20
On Wed, Jun 25, 2014 at 03:40:28PM +0000, David Laight wrote:
quoted
From: Guenter Roeck
quoted
Actually turns out one can use __attribute_const__, and it is
static inline int __attribute_const__ cpu_corepower_flags(void)
which turns out to be widely used.
I'll change that and resubmit after testing.
You don't need to tell the compiler that for an inline function.
I didn't check for the functions in question here, but in general your
statement is wrong.
=20
For example:
=20
static inline unsigned int __attribute_const__ read_cpuid_id(void)
{
return readl(BASEADDR_V7M_SCB + V7M_SCB_CPUID);
}
=20
from arch/arm/include/asm/cputype.h. The V7M_SCB_CPUID register never
changes, but there is no way gcc can deduce that.
Hmm... it all rather depends on the order of the optimisations and=20
inlining.
I've tried to use 'restrict' on the parameters to an inline function
in an attempt to get 'noalias' - but the reverse inference never
seems to be applied.
David
Hello,
On Wed, Jun 25, 2014 at 03:40:28PM +0000, David Laight wrote:
quoted
From: Guenter Roeck
quoted
Actually turns out one can use __attribute_const__, and it is
static inline int __attribute_const__ cpu_corepower_flags(void)
which turns out to be widely used.
I'll change that and resubmit after testing.
You don't need to tell the compiler that for an inline function.
I didn't check for the functions in question here, but in general your
statement is wrong.
For example:
static inline unsigned int __attribute_const__ read_cpuid_id(void)
{
return readl(BASEADDR_V7M_SCB + V7M_SCB_CPUID);
}
from arch/arm/include/asm/cputype.h. The V7M_SCB_CPUID register never
changes, but there is no way gcc can deduce that.
Sigh. As I mentioned earlier, it is much easier to introduce a problem
than to fix it.
Ok, I'll leave this alone. I already spent much more time on this than
I should or have, so it is really time to move on.
Guenter
The same is true of those three, but then they would have to be moved
into a .c file and replaced with prototypes ...
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
The same is true of those three, but then they would have to be moved
into a .c file and replaced with prototypes ...
Personally I wasn't sure why it had to be functions instead of defines,
but who knows. Anyway, seems others are not happy with my proposed fix
either, and everyone seems to suggest a different solution, so I guess
it won't go anywhere.
I "solved" my immediate problem of getting a polluted build log by
filtering the warnings out, so I don't really care too much anymore ;-).
Guenter