* [PATCH v2] sched: Fix compiler warnings
@ 2014-06-25 1:05 Guenter Roeck
2014-06-25 1:23 ` Benjamin Herrenschmidt
` (3 more replies)
0 siblings, 4 replies; 13+ messages in thread
From: Guenter Roeck @ 2014-06-25 1:05 UTC (permalink / raw)
To: Ingo Molnar
Cc: Russell King, Peter Zijlstra, linux-kernel, Ingo Molnar,
Paul Mackerras, Guenter Roeck, Vincent Guittot, linuxppc-dev,
Dietmar Eggemann, linux-arm-kernel
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(-)
diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
index 9d85318..e35d880 100644
--- a/arch/arm/kernel/topology.c
+++ b/arch/arm/kernel/topology.c
@@ -275,7 +275,7 @@ void store_cpu_topology(unsigned int cpuid)
cpu_topology[cpuid].socket_id, mpidr);
}
-static inline const int cpu_corepower_flags(void)
+static inline int cpu_corepower_flags(void)
{
return SD_SHARE_PKG_RESOURCES | SD_SHARE_POWERDOMAIN;
}
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 51a3ff7..1007fb8 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -747,7 +747,7 @@ int setup_profiling_timer(unsigned int multiplier)
#ifdef CONFIG_SCHED_SMT
/* cpumask of CPUs with asymetric SMT dependancy */
-static const int powerpc_smt_flags(void)
+static int powerpc_smt_flags(void)
{
int flags = SD_SHARE_CPUCAPACITY | SD_SHARE_PKG_RESOURCES;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 306f4f0..0376b05 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -872,21 +872,21 @@ enum cpu_idle_type {
#define SD_NUMA 0x4000 /* cross-node balancing */
#ifdef CONFIG_SCHED_SMT
-static inline const int cpu_smt_flags(void)
+static inline int cpu_smt_flags(void)
{
return SD_SHARE_CPUCAPACITY | SD_SHARE_PKG_RESOURCES;
}
#endif
#ifdef CONFIG_SCHED_MC
-static inline const int cpu_core_flags(void)
+static inline int cpu_core_flags(void)
{
return SD_SHARE_PKG_RESOURCES;
}
#endif
#ifdef CONFIG_NUMA
-static inline const int cpu_numa_flags(void)
+static inline int cpu_numa_flags(void)
{
return SD_NUMA;
}
@@ -999,7 +999,7 @@ void free_sched_domains(cpumask_var_t doms[], unsigned int ndoms);
bool cpus_share_cache(int this_cpu, int that_cpu);
typedef const struct cpumask *(*sched_domain_mask_f)(int cpu);
-typedef const int (*sched_domain_flags_f)(void);
+typedef int (*sched_domain_flags_f)(void);
#define SDTL_OVERLAP 0x01
--
1.9.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2] sched: Fix compiler warnings
2014-06-25 1:05 [PATCH v2] sched: Fix compiler warnings Guenter Roeck
@ 2014-06-25 1:23 ` Benjamin Herrenschmidt
2014-06-25 6:41 ` Vincent Guittot
` (2 subsequent siblings)
3 siblings, 0 replies; 13+ messages in thread
From: Benjamin Herrenschmidt @ 2014-06-25 1:23 UTC (permalink / raw)
To: Guenter Roeck
Cc: Russell King, Peter Zijlstra, linux-kernel, Ingo Molnar,
Ingo Molnar, Paul Mackerras, Vincent Guittot, linuxppc-dev,
Dietmar Eggemann, linux-arm-kernel
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.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] sched: Fix compiler warnings
2014-06-25 1:05 [PATCH v2] sched: Fix compiler warnings Guenter Roeck
2014-06-25 1:23 ` Benjamin Herrenschmidt
@ 2014-06-25 6:41 ` Vincent Guittot
2014-06-25 7:14 ` Uwe Kleine-König
2014-06-26 0:59 ` Stephen Rothwell
3 siblings, 0 replies; 13+ messages in thread
From: Vincent Guittot @ 2014-06-25 6:41 UTC (permalink / raw)
To: Guenter Roeck
Cc: Russell King, Peter Zijlstra, linux-kernel, Ingo Molnar,
Ingo Molnar, Paul Mackerras, linuxppc-dev, Dietmar Eggemann, LAK
On 25 June 2014 03:05, Guenter Roeck <linux@roeck-us.net> 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 <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(-)
>
> diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
> index 9d85318..e35d880 100644
> --- a/arch/arm/kernel/topology.c
> +++ b/arch/arm/kernel/topology.c
> @@ -275,7 +275,7 @@ void store_cpu_topology(unsigned int cpuid)
> cpu_topology[cpuid].socket_id, mpidr);
> }
>
> -static inline const int cpu_corepower_flags(void)
> +static inline int cpu_corepower_flags(void)
> {
> return SD_SHARE_PKG_RESOURCES | SD_SHARE_POWERDOMAIN;
> }
> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
> index 51a3ff7..1007fb8 100644
> --- a/arch/powerpc/kernel/smp.c
> +++ b/arch/powerpc/kernel/smp.c
> @@ -747,7 +747,7 @@ int setup_profiling_timer(unsigned int multiplier)
>
> #ifdef CONFIG_SCHED_SMT
> /* cpumask of CPUs with asymetric SMT dependancy */
> -static const int powerpc_smt_flags(void)
> +static int powerpc_smt_flags(void)
> {
> int flags = SD_SHARE_CPUCAPACITY | SD_SHARE_PKG_RESOURCES;
>
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 306f4f0..0376b05 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -872,21 +872,21 @@ enum cpu_idle_type {
> #define SD_NUMA 0x4000 /* cross-node balancing */
>
> #ifdef CONFIG_SCHED_SMT
> -static inline const int cpu_smt_flags(void)
> +static inline int cpu_smt_flags(void)
> {
> return SD_SHARE_CPUCAPACITY | SD_SHARE_PKG_RESOURCES;
> }
> #endif
>
> #ifdef CONFIG_SCHED_MC
> -static inline const int cpu_core_flags(void)
> +static inline int cpu_core_flags(void)
> {
> return SD_SHARE_PKG_RESOURCES;
> }
> #endif
>
> #ifdef CONFIG_NUMA
> -static inline const int cpu_numa_flags(void)
> +static inline int cpu_numa_flags(void)
> {
> return SD_NUMA;
> }
> @@ -999,7 +999,7 @@ void free_sched_domains(cpumask_var_t doms[], unsigned int ndoms);
> bool cpus_share_cache(int this_cpu, int that_cpu);
>
> typedef const struct cpumask *(*sched_domain_mask_f)(int cpu);
> -typedef const int (*sched_domain_flags_f)(void);
> +typedef int (*sched_domain_flags_f)(void);
>
> #define SDTL_OVERLAP 0x01
>
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] sched: Fix compiler warnings
2014-06-25 1:05 [PATCH v2] sched: Fix compiler warnings Guenter Roeck
2014-06-25 1:23 ` Benjamin Herrenschmidt
2014-06-25 6:41 ` Vincent Guittot
@ 2014-06-25 7:14 ` Uwe Kleine-König
2014-06-25 14:27 ` Guenter Roeck
2014-06-26 0:59 ` Stephen Rothwell
3 siblings, 1 reply; 13+ messages in thread
From: Uwe Kleine-König @ 2014-06-25 7:14 UTC (permalink / raw)
To: Guenter Roeck
Cc: Russell King, Peter Zijlstra, linux-kernel, Dietmar Eggemann,
Ingo Molnar, Paul Mackerras, Vincent Guittot, linuxppc-dev,
Ingo Molnar, linux-arm-kernel
On Tue, Jun 24, 2014 at 06:05:29PM -0700, Guenter Roeck 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>
> 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(-)
>
> diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
> index 9d85318..e35d880 100644
> --- a/arch/arm/kernel/topology.c
> +++ b/arch/arm/kernel/topology.c
> @@ -275,7 +275,7 @@ void store_cpu_topology(unsigned int cpuid)
> cpu_topology[cpuid].socket_id, mpidr);
> }
>
> -static inline const int cpu_corepower_flags(void)
> +static inline int cpu_corepower_flags(void)
> {
> return SD_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/ |
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] sched: Fix compiler warnings
2014-06-25 7:14 ` Uwe Kleine-König
@ 2014-06-25 14:27 ` Guenter Roeck
2014-06-25 14:49 ` Uwe Kleine-König
0 siblings, 1 reply; 13+ messages in thread
From: Guenter Roeck @ 2014-06-25 14:27 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Russell King, Peter Zijlstra, linux-kernel, Dietmar Eggemann,
Ingo Molnar, Paul Mackerras, Vincent Guittot, linuxppc-dev,
Ingo Molnar, linux-arm-kernel
On 06/25/2014 12:14 AM, Uwe Kleine-König wrote:
> On Tue, Jun 24, 2014 at 06:05:29PM -0700, Guenter Roeck 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>
>> 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(-)
>>
>> diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
>> index 9d85318..e35d880 100644
>> --- a/arch/arm/kernel/topology.c
>> +++ b/arch/arm/kernel/topology.c
>> @@ -275,7 +275,7 @@ void store_cpu_topology(unsigned int cpuid)
>> cpu_topology[cpuid].socket_id, mpidr);
>> }
>>
>> -static inline const int cpu_corepower_flags(void)
>> +static inline int cpu_corepower_flags(void)
>> {
>> return SD_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
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] sched: Fix compiler warnings
2014-06-25 14:27 ` Guenter Roeck
@ 2014-06-25 14:49 ` Uwe Kleine-König
2014-06-25 15:03 ` Guenter Roeck
0 siblings, 1 reply; 13+ messages in thread
From: Uwe Kleine-König @ 2014-06-25 14:49 UTC (permalink / raw)
To: Guenter Roeck
Cc: Russell King, Peter Zijlstra, linux-kernel, Dietmar Eggemann,
Ingo Molnar, Paul Mackerras, Vincent Guittot, linuxppc-dev,
Ingo Molnar, linux-arm-kernel
Hello Guenter,
On Wed, Jun 25, 2014 at 07:27:47AM -0700, Guenter Roeck wrote:
> >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/ |
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] sched: Fix compiler warnings
2014-06-25 14:49 ` Uwe Kleine-König
@ 2014-06-25 15:03 ` Guenter Roeck
2014-06-25 15:40 ` David Laight
0 siblings, 1 reply; 13+ messages in thread
From: Guenter Roeck @ 2014-06-25 15:03 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Russell King, Peter Zijlstra, linux-kernel, Dietmar Eggemann,
Ingo Molnar, Paul Mackerras, Vincent Guittot, linuxppc-dev,
Ingo Molnar, linux-arm-kernel
On 06/25/2014 07:49 AM, Uwe Kleine-König wrote:
> Hello Guenter,
>
> On Wed, Jun 25, 2014 at 07:27:47AM -0700, Guenter Roeck wrote:
>>> 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
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [PATCH v2] sched: Fix compiler warnings
2014-06-25 15:03 ` Guenter Roeck
@ 2014-06-25 15:40 ` David Laight
2014-06-25 15:52 ` Uwe Kleine-König
0 siblings, 1 reply; 13+ messages in thread
From: David Laight @ 2014-06-25 15:40 UTC (permalink / raw)
To: 'Guenter Roeck', Uwe Kleine-König
Cc: Russell King, Peter Zijlstra, linux-kernel@vger.kernel.org,
Ingo Molnar, Ingo Molnar, Paul Mackerras, Vincent Guittot,
linuxppc-dev@lists.ozlabs.org, Dietmar Eggemann,
linux-arm-kernel@lists.infradead.org
RnJvbTogR3VlbnRlciBSb2Vjaw0KPiBPbiAwNi8yNS8yMDE0IDA3OjQ5IEFNLCBVd2UgS2xlaW5l
LUtuaWcgd3JvdGU6DQo+ID4gSGVsbG8gR3VlbnRlciwNCj4gPg0KPiA+IE9uIFdlZCwgSnVuIDI1
LCAyMDE0IGF0IDA3OjI3OjQ3QU0gLTA3MDAsIEd1ZW50ZXIgUm9lY2sgd3JvdGU6DQo+ID4+PiBN
YXliZSB0aGUgYXV0aG9yJ3MgaW50ZW50aW9uIHdhczoNCj4gPj4+DQo+ID4+PiAJc3RhdGljIGlu
bGluZSBpbnQgY3B1X2NvcmVwb3dlcl9mbGFncyh2b2lkKSBfX2F0dHJpYnV0ZV9fKChjb25zdCkp
Ow0KPiA+Pj4NCj4gPj4+ID8NCj4gPj4+IFRoaXMgc3BlY2lmaWVzIHRoYXQgdGhlIGZ1bmN0aW9u
IGhhcyBubyBzaWRlIGVmZmVjdHMgYW5kIHRoZSByZXR1cm4gdmFsdWUNCj4gPj4+IG9ubHkgZGVw
ZW5kcyBvbiB0aGUgKGhlcmUgbm9uLWV4aXN0aW5nKSBmdW5jdGlvbiBhcmd1bWVudHMuDQo+ID4+
Pg0KPiA+Pg0KPiA+PiBQb3NzaWJseSwgYnV0IGVpdGhlciBJIGFtIG1pc3Npbmcgc29tZXRoaW5n
IG9yIHRoaXMgZG9lc24ndCBjb21waWxlLg0KPiA+IFlvdSBuZWVkIHRvIGRvIGEgc2VwYXJhdGUg
ZGVjbGFyYXRpb246DQo+ID4NCj4gPiAJc3RhdGljIGlubGluZSBpbnQgY3B1X2NvcmVwb3dlcl9m
bGFncyh2b2lkKSBfX2F0dHJpYnV0ZV9fKChjb25zdCkpOw0KPiA+IAlzdGF0aWMgaW5saW5lIGlu
dCBjcHVfY29yZXBvd2VyX2ZsYWdzKHZvaWQpDQo+ID4gCXsNCj4gPiAJCS4uLg0KPiANCj4gQWN0
dWFsbHkgdHVybnMgb3V0IG9uZSBjYW4gdXNlIF9fYXR0cmlidXRlX2NvbnN0X18sIGFuZCBpdCBp
cw0KPiANCj4gCXN0YXRpYyBpbmxpbmUgaW50IF9fYXR0cmlidXRlX2NvbnN0X18gY3B1X2NvcmVw
b3dlcl9mbGFncyh2b2lkKQ0KPiANCj4gd2hpY2ggdHVybnMgb3V0IHRvIGJlIHdpZGVseSB1c2Vk
Lg0KPiANCj4gSSdsbCBjaGFuZ2UgdGhhdCBhbmQgcmVzdWJtaXQgYWZ0ZXIgdGVzdGluZy4NCg0K
WW91IGRvbid0IG5lZWQgdG8gdGVsbCB0aGUgY29tcGlsZXIgdGhhdCBmb3IgYW4gaW5saW5lIGZ1
bmN0aW9uLg0KDQoJRGF2aWQNCg0K
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] sched: Fix compiler warnings
2014-06-25 15:40 ` David Laight
@ 2014-06-25 15:52 ` Uwe Kleine-König
2014-06-25 16:04 ` David Laight
2014-06-25 16:09 ` Guenter Roeck
0 siblings, 2 replies; 13+ messages in thread
From: Uwe Kleine-König @ 2014-06-25 15:52 UTC (permalink / raw)
To: David Laight
Cc: Russell King, Peter Zijlstra, linux-kernel@vger.kernel.org,
Ingo Molnar, Ingo Molnar, Paul Mackerras,
linux-arm-kernel@lists.infradead.org, Vincent Guittot,
linuxppc-dev@lists.ozlabs.org, Dietmar Eggemann,
'Guenter Roeck'
Hello,
On Wed, Jun 25, 2014 at 03:40:28PM +0000, David Laight wrote:
> From: Guenter Roeck
> > 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/ |
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [PATCH v2] sched: Fix compiler warnings
2014-06-25 15:52 ` Uwe Kleine-König
@ 2014-06-25 16:04 ` David Laight
2014-06-25 16:09 ` Guenter Roeck
1 sibling, 0 replies; 13+ messages in thread
From: David Laight @ 2014-06-25 16:04 UTC (permalink / raw)
To: 'Uwe Kleine-König'
Cc: Russell King, Peter Zijlstra, linux-kernel@vger.kernel.org,
Ingo Molnar, Ingo Molnar, Paul Mackerras,
linux-arm-kernel@lists.infradead.org, Vincent Guittot,
linuxppc-dev@lists.ozlabs.org, Dietmar Eggemann,
'Guenter Roeck'
From: Uwe Kleine-K=F6nig=20
> Hello,
>=20
> On Wed, Jun 25, 2014 at 03:40:28PM +0000, David Laight wrote:
> > From: Guenter Roeck
> > > 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
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] sched: Fix compiler warnings
2014-06-25 15:52 ` Uwe Kleine-König
2014-06-25 16:04 ` David Laight
@ 2014-06-25 16:09 ` Guenter Roeck
1 sibling, 0 replies; 13+ messages in thread
From: Guenter Roeck @ 2014-06-25 16:09 UTC (permalink / raw)
To: Uwe Kleine-König, David Laight
Cc: Russell King, Peter Zijlstra, linux-kernel@vger.kernel.org,
Ingo Molnar, Ingo Molnar, Paul Mackerras, Vincent Guittot,
linuxppc-dev@lists.ozlabs.org, Dietmar Eggemann,
linux-arm-kernel@lists.infradead.org
On 06/25/2014 08:52 AM, Uwe Kleine-König wrote:
> Hello,
>
> On Wed, Jun 25, 2014 at 03:40:28PM +0000, David Laight wrote:
>> From: Guenter Roeck
>>> 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
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] sched: Fix compiler warnings
2014-06-25 1:05 [PATCH v2] sched: Fix compiler warnings Guenter Roeck
` (2 preceding siblings ...)
2014-06-25 7:14 ` Uwe Kleine-König
@ 2014-06-26 0:59 ` Stephen Rothwell
2014-06-26 3:27 ` Guenter Roeck
3 siblings, 1 reply; 13+ messages in thread
From: Stephen Rothwell @ 2014-06-26 0:59 UTC (permalink / raw)
To: Guenter Roeck
Cc: Russell King, Peter Zijlstra, linux-kernel, Dietmar Eggemann,
Ingo Molnar, Paul Mackerras, Vincent Guittot, linuxppc-dev,
Ingo Molnar, linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 1707 bytes --]
Hi Guenter,
[I know I'm a bit late to this, but ...]
On Tue, 24 Jun 2014 18:05:29 -0700 Guenter Roeck <linux@roeck-us.net> wrote:
>
> diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
> index 9d85318..e35d880 100644
> --- a/arch/arm/kernel/topology.c
> +++ b/arch/arm/kernel/topology.c
> @@ -275,7 +275,7 @@ void store_cpu_topology(unsigned int cpuid)
> cpu_topology[cpuid].socket_id, mpidr);
> }
>
> -static inline const int cpu_corepower_flags(void)
> +static inline int cpu_corepower_flags(void)
> {
> return SD_SHARE_PKG_RESOURCES | SD_SHARE_POWERDOMAIN;
> }
The only reference to this function is to take its address, so "inline"
is useless, right?
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 306f4f0..0376b05 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -872,21 +872,21 @@ enum cpu_idle_type {
> #define SD_NUMA 0x4000 /* cross-node balancing */
>
> #ifdef CONFIG_SCHED_SMT
> -static inline const int cpu_smt_flags(void)
> +static inline int cpu_smt_flags(void)
> {
> return SD_SHARE_CPUCAPACITY | SD_SHARE_PKG_RESOURCES;
> }
> #endif
>
> #ifdef CONFIG_SCHED_MC
> -static inline const int cpu_core_flags(void)
> +static inline int cpu_core_flags(void)
> {
> return SD_SHARE_PKG_RESOURCES;
> }
> #endif
>
> #ifdef CONFIG_NUMA
> -static inline const int cpu_numa_flags(void)
> +static inline int cpu_numa_flags(void)
> {
> return SD_NUMA;
> }
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] sched: Fix compiler warnings
2014-06-26 0:59 ` Stephen Rothwell
@ 2014-06-26 3:27 ` Guenter Roeck
0 siblings, 0 replies; 13+ messages in thread
From: Guenter Roeck @ 2014-06-26 3:27 UTC (permalink / raw)
To: Stephen Rothwell
Cc: Russell King, Peter Zijlstra, linux-kernel, Dietmar Eggemann,
Ingo Molnar, Paul Mackerras, Vincent Guittot, linuxppc-dev,
Ingo Molnar, linux-arm-kernel
On 06/25/2014 05:59 PM, Stephen Rothwell wrote:
> Hi Guenter,
>
> [I know I'm a bit late to this, but ...]
>
> On Tue, 24 Jun 2014 18:05:29 -0700 Guenter Roeck <linux@roeck-us.net> wrote:
>>
>> diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
>> index 9d85318..e35d880 100644
>> --- a/arch/arm/kernel/topology.c
>> +++ b/arch/arm/kernel/topology.c
>> @@ -275,7 +275,7 @@ void store_cpu_topology(unsigned int cpuid)
>> cpu_topology[cpuid].socket_id, mpidr);
>> }
>>
>> -static inline const int cpu_corepower_flags(void)
>> +static inline int cpu_corepower_flags(void)
>> {
>> return SD_SHARE_PKG_RESOURCES | SD_SHARE_POWERDOMAIN;
>> }
>
> The only reference to this function is to take its address, so "inline"
> is useless, right?
>
>> diff --git a/include/linux/sched.h b/include/linux/sched.h
>> index 306f4f0..0376b05 100644
>> --- a/include/linux/sched.h
>> +++ b/include/linux/sched.h
>> @@ -872,21 +872,21 @@ enum cpu_idle_type {
>> #define SD_NUMA 0x4000 /* cross-node balancing */
>>
>> #ifdef CONFIG_SCHED_SMT
>> -static inline const int cpu_smt_flags(void)
>> +static inline int cpu_smt_flags(void)
>> {
>> return SD_SHARE_CPUCAPACITY | SD_SHARE_PKG_RESOURCES;
>> }
>> #endif
>>
>> #ifdef CONFIG_SCHED_MC
>> -static inline const int cpu_core_flags(void)
>> +static inline int cpu_core_flags(void)
>> {
>> return SD_SHARE_PKG_RESOURCES;
>> }
>> #endif
>>
>> #ifdef CONFIG_NUMA
>> -static inline const int cpu_numa_flags(void)
>> +static inline int cpu_numa_flags(void)
>> {
>> return SD_NUMA;
>> }
>
> 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
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2014-06-26 3:28 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-25 1:05 [PATCH v2] sched: Fix compiler warnings Guenter Roeck
2014-06-25 1:23 ` Benjamin Herrenschmidt
2014-06-25 6:41 ` Vincent Guittot
2014-06-25 7:14 ` Uwe Kleine-König
2014-06-25 14:27 ` Guenter Roeck
2014-06-25 14:49 ` Uwe Kleine-König
2014-06-25 15:03 ` Guenter Roeck
2014-06-25 15:40 ` David Laight
2014-06-25 15:52 ` Uwe Kleine-König
2014-06-25 16:04 ` David Laight
2014-06-25 16:09 ` Guenter Roeck
2014-06-26 0:59 ` Stephen Rothwell
2014-06-26 3:27 ` Guenter Roeck
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).