mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] core: fix typo in percpu read_mostly section
@ 2014-06-23 18:16 Filipe Brandenburger
  2014-07-01 19:11 ` Filipe Brandenburger
  0 siblings, 1 reply; 3+ messages in thread
From: Filipe Brandenburger @ 2014-06-23 18:16 UTC (permalink / raw)
  To: Shaohua Li, Eric Dumazet, H. Peter Anvin, Andi Kleen
  Cc: Zhengyu He, linux-kernel, Filipe Brandenburger

From: Zhengyu He <hzy@google.com>

This fixes a typo that named the read_mostly section of percpu as
readmostly. It works fine with SMP because the linker script specifies
.data..percpu..readmostly. However, UP kernel builds don't have percpu
sections defined and the non-percpu version of the section is called
data..read_mostly, so .data..readmostly will float around and may break
things unexpectedly.

Looking at the original change that introduced data..percpu..readmostly
(commit c957ef2c59e952803766ddc22e89981ab534606f), it looks like this
was the original intention.

Tested: Built UP kernel and confirmed the sections got merged.

- Before the patch:
$ objdump -h vmlinux.o  | grep '\.data\.\.read.*mostly'
38 .data..read_mostly 00004418  0000000000000000  0000000000000000  00431ac0  2**6
50 .data..readmostly 00000014  0000000000000000  0000000000000000  00444000  2**3

- After the patch:
$ objdump -h vmlinux.o  | grep '\.data\.\.read.*mostly'
38 .data..read_mostly 00004438  0000000000000000  0000000000000000  00431ac0  2**6

Signed-off-by: Zhengyu He <hzy@google.com>
Signed-off-by: Filipe Brandenburger <filbranden@google.com>
---
 include/asm-generic/vmlinux.lds.h | 2 +-
 include/linux/percpu-defs.h       | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 471ba48c7ae4..c1c0b0cf39b4 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -693,7 +693,7 @@
 	. = ALIGN(PAGE_SIZE);						\
 	*(.data..percpu..page_aligned)					\
 	. = ALIGN(cacheline);						\
-	*(.data..percpu..readmostly)					\
+	*(.data..percpu..read_mostly)					\
 	. = ALIGN(cacheline);						\
 	*(.data..percpu)						\
 	*(.data..percpu..shared_aligned)				\
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index a5fc7d01aad6..dec01d6c3f80 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -146,10 +146,10 @@
  * Declaration/definition used for per-CPU variables that must be read mostly.
  */
 #define DECLARE_PER_CPU_READ_MOSTLY(type, name)			\
-	DECLARE_PER_CPU_SECTION(type, name, "..readmostly")
+	DECLARE_PER_CPU_SECTION(type, name, "..read_mostly")
 
 #define DEFINE_PER_CPU_READ_MOSTLY(type, name)				\
-	DEFINE_PER_CPU_SECTION(type, name, "..readmostly")
+	DEFINE_PER_CPU_SECTION(type, name, "..read_mostly")
 
 /*
  * Intermodule exports for per-CPU variables.  sparse forgets about
-- 
2.0.0.526.g5318336


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

* [PATCH] core: fix typo in percpu read_mostly section
  2014-06-23 18:16 [PATCH] core: fix typo in percpu read_mostly section Filipe Brandenburger
@ 2014-07-01 19:11 ` Filipe Brandenburger
  2014-07-01 20:46   ` Tejun Heo
  0 siblings, 1 reply; 3+ messages in thread
From: Filipe Brandenburger @ 2014-07-01 19:11 UTC (permalink / raw)
  To: Tejun Heo, Christoph Lameter
  Cc: Eric Dumazet, H. Peter Anvin, Andi Kleen, Zhengyu He,
	Greg Thelen, linux-arch, linux-kernel, Filipe Brandenburger

From: Zhengyu He <hzy@google.com>

This fixes a typo that named the read_mostly section of percpu as
readmostly. It works fine with SMP because the linker script specifies
.data..percpu..readmostly. However, UP kernel builds don't have percpu
sections defined and the non-percpu version of the section is called
data..read_mostly, so .data..readmostly will float around and may break
things unexpectedly.

Looking at the original change that introduced data..percpu..readmostly
(commit c957ef2c59e952803766ddc22e89981ab534606f), it looks like this
was the original intention.

Tested: Built UP kernel and confirmed the sections got merged.

- Before the patch:
$ objdump -h vmlinux.o  | grep '\.data\.\.read.*mostly'
38 .data..read_mostly 00004418  0000000000000000  0000000000000000  00431ac0  2**6
50 .data..readmostly 00000014  0000000000000000  0000000000000000  00444000  2**3

- After the patch:
$ objdump -h vmlinux.o  | grep '\.data\.\.read.*mostly'
38 .data..read_mostly 00004438  0000000000000000  0000000000000000  00431ac0  2**6

Signed-off-by: Zhengyu He <hzy@google.com>
Signed-off-by: Filipe Brandenburger <filbranden@google.com>
---
 include/asm-generic/vmlinux.lds.h | 2 +-
 include/linux/percpu-defs.h       | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 471ba48c7ae4..c1c0b0cf39b4 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -693,7 +693,7 @@
 	. = ALIGN(PAGE_SIZE);						\
 	*(.data..percpu..page_aligned)					\
 	. = ALIGN(cacheline);						\
-	*(.data..percpu..readmostly)					\
+	*(.data..percpu..read_mostly)					\
 	. = ALIGN(cacheline);						\
 	*(.data..percpu)						\
 	*(.data..percpu..shared_aligned)				\
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index a5fc7d01aad6..dec01d6c3f80 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -146,10 +146,10 @@
  * Declaration/definition used for per-CPU variables that must be read mostly.
  */
 #define DECLARE_PER_CPU_READ_MOSTLY(type, name)			\
-	DECLARE_PER_CPU_SECTION(type, name, "..readmostly")
+	DECLARE_PER_CPU_SECTION(type, name, "..read_mostly")
 
 #define DEFINE_PER_CPU_READ_MOSTLY(type, name)				\
-	DEFINE_PER_CPU_SECTION(type, name, "..readmostly")
+	DEFINE_PER_CPU_SECTION(type, name, "..read_mostly")
 
 /*
  * Intermodule exports for per-CPU variables.  sparse forgets about
-- 
2.0.0.526.g5318336


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

* Re: [PATCH] core: fix typo in percpu read_mostly section
  2014-07-01 19:11 ` Filipe Brandenburger
@ 2014-07-01 20:46   ` Tejun Heo
  0 siblings, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2014-07-01 20:46 UTC (permalink / raw)
  To: Filipe Brandenburger
  Cc: Christoph Lameter, Eric Dumazet, H. Peter Anvin, Andi Kleen,
	Zhengyu He, Greg Thelen, linux-arch, linux-kernel

On Tue, Jul 01, 2014 at 12:11:47PM -0700, Filipe Brandenburger wrote:
> From: Zhengyu He <hzy@google.com>
> 
> This fixes a typo that named the read_mostly section of percpu as
> readmostly. It works fine with SMP because the linker script specifies
> .data..percpu..readmostly. However, UP kernel builds don't have percpu
> sections defined and the non-percpu version of the section is called
> data..read_mostly, so .data..readmostly will float around and may break
> things unexpectedly.
> 
> Looking at the original change that introduced data..percpu..readmostly
> (commit c957ef2c59e952803766ddc22e89981ab534606f), it looks like this
> was the original intention.
> 
> Tested: Built UP kernel and confirmed the sections got merged.
> 
> - Before the patch:
> $ objdump -h vmlinux.o  | grep '\.data\.\.read.*mostly'
> 38 .data..read_mostly 00004418  0000000000000000  0000000000000000  00431ac0  2**6
> 50 .data..readmostly 00000014  0000000000000000  0000000000000000  00444000  2**3
> 
> - After the patch:
> $ objdump -h vmlinux.o  | grep '\.data\.\.read.*mostly'
> 38 .data..read_mostly 00004438  0000000000000000  0000000000000000  00431ac0  2**6
> 
> Signed-off-by: Zhengyu He <hzy@google.com>
> Signed-off-by: Filipe Brandenburger <filbranden@google.com>

Applied to percpu/for-3.16-fixes.

Thanks.

-- 
tejun

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

end of thread, other threads:[~2014-07-01 20:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-23 18:16 [PATCH] core: fix typo in percpu read_mostly section Filipe Brandenburger
2014-07-01 19:11 ` Filipe Brandenburger
2014-07-01 20:46   ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®