All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: fix missing 'const' qualifiers
@ 2017-11-25  9:41 ` Yury Norov
  0 siblings, 0 replies; 12+ messages in thread
From: Yury Norov @ 2017-11-25  9:41 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel
  Cc: Yury Norov, Alex Matveev, Alexander Potapenko, Andi Kleen,
	Ard Biesheuvel, Catalin Marinas, Kees Cook, Mark Rutland,
	Maxim Kuvyrkov, Nick Desaulniers, Peter Zijlstra, Sami Tolvanen,
	Stephen Boyd, Will Deacon

It was discovered during LTO-enabled compilation with gcc/ld.bfd.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 arch/arm64/kernel/cpu_ops.c             | 7 ++++---
 drivers/clk/hisilicon/crg-hi3516cv300.c | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c
index d16978213c5b..36178002f0c3 100644
--- a/arch/arm64/kernel/cpu_ops.c
+++ b/arch/arm64/kernel/cpu_ops.c
@@ -31,13 +31,14 @@ extern const struct cpu_operations cpu_psci_ops;
 
 const struct cpu_operations *cpu_ops[NR_CPUS] __ro_after_init;
 
-static const struct cpu_operations *dt_supported_cpu_ops[] __initconst = {
+static const struct cpu_operations *const dt_supported_cpu_ops[] __initconst = {
 	&smp_spin_table_ops,
 	&cpu_psci_ops,
 	NULL,
 };
 
-static const struct cpu_operations *acpi_supported_cpu_ops[] __initconst = {
+static const struct cpu_operations
+	*const acpi_supported_cpu_ops[] __initconst = {
 #ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL
 	&acpi_parking_protocol_ops,
 #endif
@@ -47,7 +48,7 @@ static const struct cpu_operations *acpi_supported_cpu_ops[] __initconst = {
 
 static const struct cpu_operations * __init cpu_get_ops(const char *name)
 {
-	const struct cpu_operations **ops;
+	const struct cpu_operations *const *ops;
 
 	ops = acpi_disabled ? dt_supported_cpu_ops : acpi_supported_cpu_ops;
 
diff --git a/drivers/clk/hisilicon/crg-hi3516cv300.c b/drivers/clk/hisilicon/crg-hi3516cv300.c
index 2007123832bb..53450b651e4c 100644
--- a/drivers/clk/hisilicon/crg-hi3516cv300.c
+++ b/drivers/clk/hisilicon/crg-hi3516cv300.c
@@ -204,7 +204,7 @@ static const struct hisi_crg_funcs hi3516cv300_crg_funcs = {
 /* hi3516CV300 sysctrl CRG */
 #define HI3516CV300_SYSCTRL_NR_CLKS 16
 
-static const char *wdt_mux_p[] __initconst = { "3m", "apb" };
+static const char *const wdt_mux_p[] __initconst = { "3m", "apb" };
 static u32 wdt_mux_table[] = {0, 1};
 
 static const struct hisi_mux_clock hi3516cv300_sysctrl_mux_clks[] = {
-- 
2.11.0

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

* [PATCH] arm64: fix missing 'const' qualifiers
@ 2017-11-25  9:41 ` Yury Norov
  0 siblings, 0 replies; 12+ messages in thread
From: Yury Norov @ 2017-11-25  9:41 UTC (permalink / raw)
  To: linux-arm-kernel

It was discovered during LTO-enabled compilation with gcc/ld.bfd.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 arch/arm64/kernel/cpu_ops.c             | 7 ++++---
 drivers/clk/hisilicon/crg-hi3516cv300.c | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c
index d16978213c5b..36178002f0c3 100644
--- a/arch/arm64/kernel/cpu_ops.c
+++ b/arch/arm64/kernel/cpu_ops.c
@@ -31,13 +31,14 @@ extern const struct cpu_operations cpu_psci_ops;
 
 const struct cpu_operations *cpu_ops[NR_CPUS] __ro_after_init;
 
-static const struct cpu_operations *dt_supported_cpu_ops[] __initconst = {
+static const struct cpu_operations *const dt_supported_cpu_ops[] __initconst = {
 	&smp_spin_table_ops,
 	&cpu_psci_ops,
 	NULL,
 };
 
-static const struct cpu_operations *acpi_supported_cpu_ops[] __initconst = {
+static const struct cpu_operations
+	*const acpi_supported_cpu_ops[] __initconst = {
 #ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL
 	&acpi_parking_protocol_ops,
 #endif
@@ -47,7 +48,7 @@ static const struct cpu_operations *acpi_supported_cpu_ops[] __initconst = {
 
 static const struct cpu_operations * __init cpu_get_ops(const char *name)
 {
-	const struct cpu_operations **ops;
+	const struct cpu_operations *const *ops;
 
 	ops = acpi_disabled ? dt_supported_cpu_ops : acpi_supported_cpu_ops;
 
diff --git a/drivers/clk/hisilicon/crg-hi3516cv300.c b/drivers/clk/hisilicon/crg-hi3516cv300.c
index 2007123832bb..53450b651e4c 100644
--- a/drivers/clk/hisilicon/crg-hi3516cv300.c
+++ b/drivers/clk/hisilicon/crg-hi3516cv300.c
@@ -204,7 +204,7 @@ static const struct hisi_crg_funcs hi3516cv300_crg_funcs = {
 /* hi3516CV300 sysctrl CRG */
 #define HI3516CV300_SYSCTRL_NR_CLKS 16
 
-static const char *wdt_mux_p[] __initconst = { "3m", "apb" };
+static const char *const wdt_mux_p[] __initconst = { "3m", "apb" };
 static u32 wdt_mux_table[] = {0, 1};
 
 static const struct hisi_mux_clock hi3516cv300_sysctrl_mux_clks[] = {
-- 
2.11.0

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

* Re: [PATCH] arm64: fix missing 'const' qualifiers
  2017-11-25  9:41 ` Yury Norov
@ 2017-11-27 17:15   ` Nick Desaulniers
  -1 siblings, 0 replies; 12+ messages in thread
From: Nick Desaulniers @ 2017-11-27 17:15 UTC (permalink / raw)
  To: Yury Norov
  Cc: linux-arm-kernel, LKML, Alex Matveev, Alexander Potapenko,
	Andi Kleen, Ard Biesheuvel, Catalin Marinas, Kees Cook,
	Mark Rutland, Maxim Kuvyrkov, Peter Zijlstra, Sami Tolvanen,
	Stephen Boyd, Will Deacon

Checked call sites, looks like no one tries to modify these pointers.
I too prefer to make things as const as possible, though I recently
had a coworker refer to the propagation of const in a code base as a
"Gordian knot," which I thought was eloquent.

checkpatch mentions that there's one line that's over 80 chars, and
that there's M$ DOS style line endings (but that may just be my client
gmail, or yours (exchange?)).  If you fix up that long line, then:

Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

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

* [PATCH] arm64: fix missing 'const' qualifiers
@ 2017-11-27 17:15   ` Nick Desaulniers
  0 siblings, 0 replies; 12+ messages in thread
From: Nick Desaulniers @ 2017-11-27 17:15 UTC (permalink / raw)
  To: linux-arm-kernel

Checked call sites, looks like no one tries to modify these pointers.
I too prefer to make things as const as possible, though I recently
had a coworker refer to the propagation of const in a code base as a
"Gordian knot," which I thought was eloquent.

checkpatch mentions that there's one line that's over 80 chars, and
that there's M$ DOS style line endings (but that may just be my client
gmail, or yours (exchange?)).  If you fix up that long line, then:

Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

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

* Re: [PATCH] arm64: fix missing 'const' qualifiers
  2017-11-27 17:15   ` Nick Desaulniers
@ 2017-11-27 17:59     ` Yury Norov
  -1 siblings, 0 replies; 12+ messages in thread
From: Yury Norov @ 2017-11-27 17:59 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: linux-arm-kernel, LKML, Alex Matveev, Alexander Potapenko,
	Andi Kleen, Ard Biesheuvel, Catalin Marinas, Kees Cook,
	Mark Rutland, Maxim Kuvyrkov, Peter Zijlstra, Sami Tolvanen,
	Stephen Boyd, Will Deacon, Joe Perches, Andy Whitcroft

On Mon, Nov 27, 2017 at 09:15:50AM -0800, Nick Desaulniers wrote:
> Checked call sites, looks like no one tries to modify these pointers.
> I too prefer to make things as const as possible, though I recently
> had a coworker refer to the propagation of const in a code base as a
> "Gordian knot," which I thought was eloquent.
>
> checkpatch mentions that there's one line that's over 80 chars, and
> that there's M$ DOS style line endings (but that may just be my client
> gmail, or yours (exchange?)).  If you fix up that long line, then:

I happily use mutt, but my company's mail server is MS Outlook, so I 
have to send everything with msmtp. It usually works. In fact, this
is the first complain for 2 years. 

My checkpatch:
yury:linux$ scripts/checkpatch.pl const.patch 
total: 0 errors, 0 warnings, 32 lines checked

const.patch has no obvious style problems and is ready for submission.

I guess, because 1 line is exactly 80 chars length, and because MS format
adds another symbol as line delimiter, we end up with 81 chars in line,
which makes checkpatch worrying.

CC Joe Perches and Andy Whitcroft for it.

> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

Thanks

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

* [PATCH] arm64: fix missing 'const' qualifiers
@ 2017-11-27 17:59     ` Yury Norov
  0 siblings, 0 replies; 12+ messages in thread
From: Yury Norov @ 2017-11-27 17:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Nov 27, 2017 at 09:15:50AM -0800, Nick Desaulniers wrote:
> Checked call sites, looks like no one tries to modify these pointers.
> I too prefer to make things as const as possible, though I recently
> had a coworker refer to the propagation of const in a code base as a
> "Gordian knot," which I thought was eloquent.
>
> checkpatch mentions that there's one line that's over 80 chars, and
> that there's M$ DOS style line endings (but that may just be my client
> gmail, or yours (exchange?)).  If you fix up that long line, then:

I happily use mutt, but my company's mail server is MS Outlook, so I 
have to send everything with msmtp. It usually works. In fact, this
is the first complain for 2 years. 

My checkpatch:
yury:linux$ scripts/checkpatch.pl const.patch 
total: 0 errors, 0 warnings, 32 lines checked

const.patch has no obvious style problems and is ready for submission.

I guess, because 1 line is exactly 80 chars length, and because MS format
adds another symbol as line delimiter, we end up with 81 chars in line,
which makes checkpatch worrying.

CC Joe Perches and Andy Whitcroft for it.

> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

Thanks

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

* Re: [PATCH] arm64: fix missing 'const' qualifiers
  2017-11-25  9:41 ` Yury Norov
@ 2017-11-28 18:33   ` Will Deacon
  -1 siblings, 0 replies; 12+ messages in thread
From: Will Deacon @ 2017-11-28 18:33 UTC (permalink / raw)
  To: Yury Norov
  Cc: linux-arm-kernel, linux-kernel, Alex Matveev,
	Alexander Potapenko, Andi Kleen, Ard Biesheuvel, Catalin Marinas,
	Kees Cook, Mark Rutland, Maxim Kuvyrkov, Nick Desaulniers,
	Peter Zijlstra, Sami Tolvanen, Stephen Boyd

On Sat, Nov 25, 2017 at 12:41:27PM +0300, Yury Norov wrote:
> It was discovered during LTO-enabled compilation with gcc/ld.bfd.

What was discovered? Could you provide a bit more information in the
changelog, please? I'm happy to take this as a fix if it's actually fixing
something.

Will

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

* [PATCH] arm64: fix missing 'const' qualifiers
@ 2017-11-28 18:33   ` Will Deacon
  0 siblings, 0 replies; 12+ messages in thread
From: Will Deacon @ 2017-11-28 18:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Nov 25, 2017 at 12:41:27PM +0300, Yury Norov wrote:
> It was discovered during LTO-enabled compilation with gcc/ld.bfd.

What was discovered? Could you provide a bit more information in the
changelog, please? I'm happy to take this as a fix if it's actually fixing
something.

Will

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

* Re: [PATCH] arm64: fix missing 'const' qualifiers
  2017-11-28 18:33   ` Will Deacon
@ 2017-11-29  9:32     ` Yury Norov
  -1 siblings, 0 replies; 12+ messages in thread
From: Yury Norov @ 2017-11-29  9:32 UTC (permalink / raw)
  To: Will Deacon
  Cc: linux-arm-kernel, linux-kernel, Alex Matveev,
	Alexander Potapenko, Andi Kleen, Ard Biesheuvel, Catalin Marinas,
	Kees Cook, Mark Rutland, Maxim Kuvyrkov, Nick Desaulniers,
	Peter Zijlstra, Sami Tolvanen, Stephen Boyd

On Tue, Nov 28, 2017 at 06:33:55PM +0000, Will Deacon wrote:
> On Sat, Nov 25, 2017 at 12:41:27PM +0300, Yury Norov wrote:
> > It was discovered during LTO-enabled compilation with gcc/ld.bfd.
> 
> What was discovered? Could you provide a bit more information in the
> changelog, please? I'm happy to take this as a fix if it's actually fixing
> something.

Yes it does. There's inconsistency in variable declaration and
section type. GCC doesn't throw error for usual build, but if LTO
enabled, build becomes broken, like this:

mm/percpu.c:2168:20: error: pcpu_fc_names causes a section type conflict
with dt_supported_cpu_ops
const char * const pcpu_fc_names[PCPU_FC_NR] __initconst = {
        ^
arch/arm64/kernel/cpu_ops.c:34:37: note: ‘dt_supported_cpu_ops’ was declared here
static const struct cpu_operations *dt_supported_cpu_ops[] __initconst = {

And so on. Let me know if you need full error log, then I'll resend the
patch with it.

You can also try it yourself, the very dirty and unfinished branch is
here:
https://github.com/norov/linux/tree/lto

Yury

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

* [PATCH] arm64: fix missing 'const' qualifiers
@ 2017-11-29  9:32     ` Yury Norov
  0 siblings, 0 replies; 12+ messages in thread
From: Yury Norov @ 2017-11-29  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Nov 28, 2017 at 06:33:55PM +0000, Will Deacon wrote:
> On Sat, Nov 25, 2017 at 12:41:27PM +0300, Yury Norov wrote:
> > It was discovered during LTO-enabled compilation with gcc/ld.bfd.
> 
> What was discovered? Could you provide a bit more information in the
> changelog, please? I'm happy to take this as a fix if it's actually fixing
> something.

Yes it does. There's inconsistency in variable declaration and
section type. GCC doesn't throw error for usual build, but if LTO
enabled, build becomes broken, like this:

mm/percpu.c:2168:20: error: pcpu_fc_names causes a section type conflict
with dt_supported_cpu_ops
const char * const pcpu_fc_names[PCPU_FC_NR] __initconst = {
        ^
arch/arm64/kernel/cpu_ops.c:34:37: note: ?dt_supported_cpu_ops? was declared here
static const struct cpu_operations *dt_supported_cpu_ops[] __initconst = {

And so on. Let me know if you need full error log, then I'll resend the
patch with it.

You can also try it yourself, the very dirty and unfinished branch is
here:
https://github.com/norov/linux/tree/lto

Yury

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

* Re: [PATCH] arm64: fix missing 'const' qualifiers
  2017-11-29  9:32     ` Yury Norov
@ 2017-11-29 11:47       ` Will Deacon
  -1 siblings, 0 replies; 12+ messages in thread
From: Will Deacon @ 2017-11-29 11:47 UTC (permalink / raw)
  To: Yury Norov
  Cc: linux-arm-kernel, linux-kernel, Alex Matveev,
	Alexander Potapenko, Andi Kleen, Ard Biesheuvel, Catalin Marinas,
	Kees Cook, Mark Rutland, Maxim Kuvyrkov, Nick Desaulniers,
	Peter Zijlstra, Sami Tolvanen, Stephen Boyd

On Wed, Nov 29, 2017 at 12:32:25PM +0300, Yury Norov wrote:
> On Tue, Nov 28, 2017 at 06:33:55PM +0000, Will Deacon wrote:
> > On Sat, Nov 25, 2017 at 12:41:27PM +0300, Yury Norov wrote:
> > > It was discovered during LTO-enabled compilation with gcc/ld.bfd.
> > 
> > What was discovered? Could you provide a bit more information in the
> > changelog, please? I'm happy to take this as a fix if it's actually fixing
> > something.
> 
> Yes it does. There's inconsistency in variable declaration and
> section type. GCC doesn't throw error for usual build, but if LTO
> enabled, build becomes broken, like this:
> 
> mm/percpu.c:2168:20: error: pcpu_fc_names causes a section type conflict
> with dt_supported_cpu_ops
> const char * const pcpu_fc_names[PCPU_FC_NR] __initconst = {
>         ^
> arch/arm64/kernel/cpu_ops.c:34:37: note: ‘dt_supported_cpu_ops’ was declared here
> static const struct cpu_operations *dt_supported_cpu_ops[] __initconst = {
> 
> And so on. Let me know if you need full error log, then I'll resend the
> patch with it.

I think it would be helpful to include one of the errors in the commit
message.

Please send a v2 with that.

Will

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

* [PATCH] arm64: fix missing 'const' qualifiers
@ 2017-11-29 11:47       ` Will Deacon
  0 siblings, 0 replies; 12+ messages in thread
From: Will Deacon @ 2017-11-29 11:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Nov 29, 2017 at 12:32:25PM +0300, Yury Norov wrote:
> On Tue, Nov 28, 2017 at 06:33:55PM +0000, Will Deacon wrote:
> > On Sat, Nov 25, 2017 at 12:41:27PM +0300, Yury Norov wrote:
> > > It was discovered during LTO-enabled compilation with gcc/ld.bfd.
> > 
> > What was discovered? Could you provide a bit more information in the
> > changelog, please? I'm happy to take this as a fix if it's actually fixing
> > something.
> 
> Yes it does. There's inconsistency in variable declaration and
> section type. GCC doesn't throw error for usual build, but if LTO
> enabled, build becomes broken, like this:
> 
> mm/percpu.c:2168:20: error: pcpu_fc_names causes a section type conflict
> with dt_supported_cpu_ops
> const char * const pcpu_fc_names[PCPU_FC_NR] __initconst = {
>         ^
> arch/arm64/kernel/cpu_ops.c:34:37: note: ?dt_supported_cpu_ops? was declared here
> static const struct cpu_operations *dt_supported_cpu_ops[] __initconst = {
> 
> And so on. Let me know if you need full error log, then I'll resend the
> patch with it.

I think it would be helpful to include one of the errors in the commit
message.

Please send a v2 with that.

Will

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

end of thread, other threads:[~2017-11-29 11:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-25  9:41 [PATCH] arm64: fix missing 'const' qualifiers Yury Norov
2017-11-25  9:41 ` Yury Norov
2017-11-27 17:15 ` Nick Desaulniers
2017-11-27 17:15   ` Nick Desaulniers
2017-11-27 17:59   ` Yury Norov
2017-11-27 17:59     ` Yury Norov
2017-11-28 18:33 ` Will Deacon
2017-11-28 18:33   ` Will Deacon
2017-11-29  9:32   ` Yury Norov
2017-11-29  9:32     ` Yury Norov
2017-11-29 11:47     ` Will Deacon
2017-11-29 11:47       ` Will Deacon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.