LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 3/6] Add new CACHELINE_ALIGNED_DATA linker script macro.
From: Tim Abbott @ 2009-04-30 19:54 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
	H. Peter Anvin, sparclinux, Sam Ravnborg, Waseem Daher,
	linux-s390, Jesper Nilsson, Yoshinori Sato, Helge Deller,
	Ingo Molnar, Geert Uytterhoeven, microblaze-uclinux, Russell King,
	user-mode-linux-devel, Heiko Carstens, Jeff Dike, dev-etrax,
	Mikael Starvik, Tim Abbott, Cyrill Gorcunov, Michal Simek,
	Richard Henderson, Chris Zankel, Bryan Wu, Tony Luck,
	linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
	Linux kernel mailing list, Ralf Baechle, Anders Kaseorg,
	Kyle McMartin, Paul Mundt, Thomas Gleixner, linux-alpha,
	Martin Schwidefsky, uclinux-dist-devel, Linus Torvalds,
	David S. Miller
In-Reply-To: <1241121253-32341-3-git-send-email-tabbott@mit.edu>

This patch is preparation for replacing most ".data.cacheline_aligned"
in the kernel with macros, so that the section name can later be
changed without having to touch a lot of the kernel.

The long-term goal here is to be able to change the kernel's magic
section names to those that are compatible with -ffunction-sections
-fdata-sections.  This requires renaming all magic sections with names
of the form ".data.foo".

Signed-off-by: Tim Abbott <tabbott@mit.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 include/asm-generic/vmlinux.lds.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index f5ebd2b..fa7801b 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -131,6 +131,10 @@
 	. = ALIGN(PAGE_SIZE);						\
 	__nosave_end = .;
 
+#define CACHELINE_ALIGNED_DATA(alignment)				\
+	. = ALIGN(alignment);						\
+	*(.data.cacheline_aligned)
+
 #define RO_DATA(align)							\
 	. = ALIGN((align));						\
 	.rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {		\
-- 
1.6.2.1

^ permalink raw reply related

* [PATCH v2 4/6] Add new INIT_TASK_DATA() linker script macro.
From: Tim Abbott @ 2009-04-30 19:54 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
	H. Peter Anvin, sparclinux, Sam Ravnborg, Waseem Daher,
	linux-s390, Jesper Nilsson, Yoshinori Sato, Helge Deller,
	Ingo Molnar, Geert Uytterhoeven, microblaze-uclinux, Russell King,
	user-mode-linux-devel, Heiko Carstens, Jeff Dike, dev-etrax,
	Mikael Starvik, Tim Abbott, Cyrill Gorcunov, Michal Simek,
	Richard Henderson, Chris Zankel, Bryan Wu, Tony Luck,
	linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
	Linux kernel mailing list, Ralf Baechle, Anders Kaseorg,
	Kyle McMartin, Paul Mundt, Thomas Gleixner, linux-alpha,
	Martin Schwidefsky, uclinux-dist-devel, Linus Torvalds,
	David S. Miller
In-Reply-To: <1241121253-32341-4-git-send-email-tabbott@mit.edu>

This patch is preparation for replacing most ".data.init_task" in the
kernel with macros, so that the section name can later be changed
without having to touch a lot of the kernel.

The long-term goal here is to be able to change the kernel's magic
section names to those that are compatible with -ffunction-sections
-fdata-sections.  This requires renaming all magic sections with names
of the form ".data.foo".

Signed-off-by: Tim Abbott <tabbott@mit.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 include/asm-generic/vmlinux.lds.h |    4 ++++
 include/linux/init_task.h         |    3 +++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index fa7801b..4b020e8 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -135,6 +135,10 @@
 	. = ALIGN(alignment);						\
 	*(.data.cacheline_aligned)
 
+#define INIT_TASK_DATA(alignment)					\
+	. = ALIGN(alignment);						\
+	*(.data.init_task)
+
 #define RO_DATA(align)							\
 	. = ALIGN((align));						\
 	.rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {		\
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index d87247d..e555baa 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -184,5 +184,8 @@ extern struct cred init_cred;
 	LIST_HEAD_INIT(cpu_timers[2]),					\
 }
 
+/* Attach to the init_task data structure for proper alignment */
+#define __init_task_data __attribute__((__section__(".data.init_task")))
+
 
 #endif
-- 
1.6.2.1

^ permalink raw reply related

* [PATCH 4/6] Add new INIT_TASK_DATA() linker script macro.
From: Tim Abbott @ 2009-04-30 19:32 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
	H. Peter Anvin, sparclinux, Sam Ravnborg, Waseem Daher,
	linux-arm-kernel, linux-s390, Jesper Nilsson, linux-am33-list,
	Yoshinori Sato, Helge Deller, Ingo Molnar, Geert Uytterhoeven,
	microblaze-uclinux, Russell King, user-mode-linux-devel,
	Heiko Carstens, Jeff Dike, dev-etrax, Mikael Starvik, Tony Luck,
	Tim Abbott, Cyrill Gorcunov, Michal Simek, Richard Henderson,
	Chris Zankel, Bryan Wu, linux-m32r, linux-parisc,
	Haavard Skinnemoen, Hirokazu Takata, Ralf Baechle, Anders Kaseorg,
	Kyle McMartin, Paul Mundt, Thomas Gleixner, linux-alpha,
	Martin Schwidefsky, uclinux-dist-devel, Linus Torvalds,
	David S. Miller
In-Reply-To: <1241119956-31453-4-git-send-email-tabbott@mit.edu>

This patch is preparation for replacing most ".data.init_task" in the
kernel with macros, so that the section name can later be changed
without having to touch a lot of the kernel.

The long-term goal here is to be able to change the kernel's magic
section names to those that are compatible with -ffunction-sections
-fdata-sections.  This requires renaming all magic sections with names
of the form ".data.foo".

Signed-off-by: Tim Abbott <tabbott@mit.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 include/asm-generic/vmlinux.lds.h |    4 ++++
 include/linux/init_task.h         |    3 +++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index fa7801b..4b020e8 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -135,6 +135,10 @@
 	. = ALIGN(alignment);						\
 	*(.data.cacheline_aligned)
 
+#define INIT_TASK_DATA(alignment)					\
+	. = ALIGN(alignment);						\
+	*(.data.init_task)
+
 #define RO_DATA(align)							\
 	. = ALIGN((align));						\
 	.rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {		\
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index d87247d..e555baa 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -184,5 +184,8 @@ extern struct cred init_cred;
 	LIST_HEAD_INIT(cpu_timers[2]),					\
 }
 
+/* Attach to the init_task data structure for proper alignment */
+#define __init_task_data __attribute__((__section__(".data.init_task")))
+
 
 #endif
-- 
1.6.2.1

^ permalink raw reply related

* [PATCH 1/6] Add new macros for page-aligned data and bss sections.
From: Tim Abbott @ 2009-04-30 19:32 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
	H. Peter Anvin, sparclinux, Sam Ravnborg, Waseem Daher,
	linux-arm-kernel, linux-s390, Jesper Nilsson, linux-am33-list,
	Yoshinori Sato, Helge Deller, Ingo Molnar, Geert Uytterhoeven,
	microblaze-uclinux, Russell King, user-mode-linux-devel,
	Heiko Carstens, Jeff Dike, dev-etrax, Mikael Starvik, Tony Luck,
	Tim Abbott, Cyrill Gorcunov, Michal Simek, Richard Henderson,
	Chris Zankel, Bryan Wu, linux-m32r, linux-parisc,
	Haavard Skinnemoen, Hirokazu Takata, Ralf Baechle, Anders Kaseorg,
	Kyle McMartin, Paul Mundt, Thomas Gleixner, linux-alpha,
	Martin Schwidefsky, uclinux-dist-devel, Linus Torvalds,
	David S. Miller
In-Reply-To: <1241119956-31453-1-git-send-email-tabbott@mit.edu>

This patch is preparation for replacing most uses of
".bss.page_aligned" and ".data.page_aligned" in the kernel with
macros, so that the section name can later be changed without having
to touch a lot of the kernel.

The long-term goal here is to be able to change the kernel's magic
section names to those that are compatible with -ffunction-sections
-fdata-sections.  This requires renaming all magic sections with names
of the form ".data.foo".

Signed-off-by: Tim Abbott <tabbott@mit.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
Acked-by: David Howells <dhowells@redhat.com>
---
 include/asm-generic/vmlinux.lds.h |    8 ++++++++
 include/linux/linkage.h           |    9 +++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 89853bc..3d88c87 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -116,6 +116,14 @@
 	FTRACE_EVENTS()							\
 	TRACE_SYSCALLS()
 
+#define PAGE_ALIGNED_DATA						\
+	. = ALIGN(PAGE_SIZE);						\
+	*(.data.page_aligned)
+
+#define PAGE_ALIGNED_BSS						\
+	. = ALIGN(PAGE_SIZE);						\
+	*(.bss.page_aligned)
+
 #define RO_DATA(align)							\
 	. = ALIGN((align));						\
 	.rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {		\
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index fee9e59..af051fc 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -22,6 +22,15 @@
 #define __page_aligned_bss	__section(.bss.page_aligned) __aligned(PAGE_SIZE)
 
 /*
+ * For assembly routines.
+ *
+ * Note when using these that you must specify the appropriate
+ * alignment directives yourself
+ */
+#define __PAGE_ALIGNED_DATA	.section ".data.page_aligned", "aw", @progbits
+#define __PAGE_ALIGNED_BSS	.section ".bss.page_aligned", "aw", @nobits
+
+/*
  * This is used by architectures to keep arguments on the stack
  * untouched by the compiler by keeping them live until the end.
  * The argument stack may be owned by the assembly-language
-- 
1.6.2.1

^ permalink raw reply related

* [PATCH 0/6] macros for section name cleanup
From: Tim Abbott @ 2009-04-30 19:32 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
	H. Peter Anvin, sparclinux, Waseem Daher, linux-arm-kernel,
	linux-s390, Jesper Nilsson, linux-am33-list, Yoshinori Sato,
	Helge Deller, Ingo Molnar, Geert Uytterhoeven, microblaze-uclinux,
	Russell King, user-mode-linux-devel, Heiko Carstens, Jeff Dike,
	dev-etrax, Mikael Starvik, Tony Luck, Tim Abbott, Cyrill Gorcunov,
	Michal Simek, Richard Henderson, Chris Zankel, Bryan Wu,
	linux-m32r, linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
	Ralf Baechle, Anders Kaseorg, Kyle McMartin, Paul Mundt,
	Thomas Gleixner, linux-alpha, Martin Schwidefsky,
	uclinux-dist-devel, Linus Torvalds, David S. Miller

Here are the architecture-independent macro definitions needed for
to clean up the kernel's section names.  The overall diffstat from
this section name cleanup project is:

 96 files changed, 261 insertions(+), 503 deletions(-)

The decrease results from removing a lot of redundancy in the linker
scripts.

The long-term goal here is to add support for building the kernel with
-ffunction-sections -fdata-sections.  This requires renaming all the
magic section names in the kernel of the form .text.foo, .data.foo,
.bss.foo, and .rodata.foo to not have collisions with sections
generated for code like:

static int nosave = 0; /* -fdata-sections places in .data.nosave */
static void head(); /* -ffunction-sections places in .text.head */

Sam Ravnborg proposed that rather than just renaming all the sections
outright, we should start by first getting more control over the
section names used in the kernel so that we can later rename sections
without touching too many files.  These patch series implement that
cleanup.  Later, there will be another patch series to actually rename
the sections.

I'm hoping we can get just these macro definitions into 2.6.30 so that
the arch maintainers don't have to grab the macro definitions for
their trees while reviewing the patches for 2.6.31.

Shortly, I'm going to send one patch series for each of the
architectures updating those architectures to use these new macros
(and otherwise cleaning up section names on those architectures).

	-Tim Abbott

Tim Abbott (6):
  Add new macros for page-aligned data and bss sections.
  Add new NOSAVE_DATA linker script macro.
  Add new CACHELINE_ALIGNED_DATA linker script macro.
  Add new INIT_TASK_DATA() linker script macro.
  Add new READ_MOSTLY_DATA(align) linker script macro.
  Add support for __read_mostly to linux/cache.h

 include/asm-generic/vmlinux.lds.h |   27 +++++++++++++++++++++++++++
 include/linux/cache.h             |    6 ++++++
 include/linux/init_task.h         |    3 +++
 include/linux/linkage.h           |    9 +++++++++
 4 files changed, 45 insertions(+), 0 deletions(-)

^ permalink raw reply

* [PATCH 3/6] Add new CACHELINE_ALIGNED_DATA linker script macro.
From: Tim Abbott @ 2009-04-30 19:32 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
	H. Peter Anvin, sparclinux, Sam Ravnborg, Waseem Daher,
	linux-arm-kernel, linux-s390, Jesper Nilsson, linux-am33-list,
	Yoshinori Sato, Helge Deller, Ingo Molnar, Geert Uytterhoeven,
	microblaze-uclinux, Russell King, user-mode-linux-devel,
	Heiko Carstens, Jeff Dike, dev-etrax, Mikael Starvik, Tony Luck,
	Tim Abbott, Cyrill Gorcunov, Michal Simek, Richard Henderson,
	Chris Zankel, Bryan Wu, linux-m32r, linux-parisc,
	Haavard Skinnemoen, Hirokazu Takata, Ralf Baechle, Anders Kaseorg,
	Kyle McMartin, Paul Mundt, Thomas Gleixner, linux-alpha,
	Martin Schwidefsky, uclinux-dist-devel, Linus Torvalds,
	David S. Miller
In-Reply-To: <1241119956-31453-3-git-send-email-tabbott@mit.edu>

This patch is preparation for replacing most ".data.cacheline_aligned"
in the kernel with macros, so that the section name can later be
changed without having to touch a lot of the kernel.

The long-term goal here is to be able to change the kernel's magic
section names to those that are compatible with -ffunction-sections
-fdata-sections.  This requires renaming all magic sections with names
of the form ".data.foo".

Signed-off-by: Tim Abbott <tabbott@mit.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 include/asm-generic/vmlinux.lds.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index f5ebd2b..fa7801b 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -131,6 +131,10 @@
 	. = ALIGN(PAGE_SIZE);						\
 	__nosave_end = .;
 
+#define CACHELINE_ALIGNED_DATA(alignment)				\
+	. = ALIGN(alignment);						\
+	*(.data.cacheline_aligned)
+
 #define RO_DATA(align)							\
 	. = ALIGN((align));						\
 	.rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {		\
-- 
1.6.2.1

^ permalink raw reply related

* [PATCH 5/6] Add new READ_MOSTLY_DATA(align) linker script macro.
From: Tim Abbott @ 2009-04-30 19:32 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
	H. Peter Anvin, sparclinux, Sam Ravnborg, Waseem Daher,
	linux-arm-kernel, linux-s390, Jesper Nilsson, linux-am33-list,
	Yoshinori Sato, Helge Deller, Ingo Molnar, Geert Uytterhoeven,
	microblaze-uclinux, Russell King, user-mode-linux-devel,
	Heiko Carstens, Jeff Dike, dev-etrax, Mikael Starvik, Tony Luck,
	Tim Abbott, Cyrill Gorcunov, Michal Simek, Richard Henderson,
	Chris Zankel, Bryan Wu, linux-m32r, linux-parisc,
	Haavard Skinnemoen, Hirokazu Takata, Ralf Baechle, Anders Kaseorg,
	Kyle McMartin, Paul Mundt, Thomas Gleixner, linux-alpha,
	Martin Schwidefsky, uclinux-dist-devel, Linus Torvalds,
	David S. Miller
In-Reply-To: <1241119956-31453-5-git-send-email-tabbott@mit.edu>

This patch is preparation for replacing most ".data.read_mostly" in
the kernel with macros, so that the section name can later be changed
without having to touch a lot of the kernel.

The long-term goal here is to be able to change the kernel's magic
section names to those that are compatible with -ffunction-sections
-fdata-sections.  This requires renaming all magic sections with names
of the form ".data.foo".

Signed-off-by: Tim Abbott <tabbott@mit.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 include/asm-generic/vmlinux.lds.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 4b020e8..a4b4f4a 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -139,6 +139,10 @@
 	. = ALIGN(alignment);						\
 	*(.data.init_task)
 
+#define READ_MOSTLY_DATA(alignment)					\
+	. = ALIGN(alignment);						\
+	*(.data.read_mostly)
+
 #define RO_DATA(align)							\
 	. = ALIGN((align));						\
 	.rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {		\
-- 
1.6.2.1

^ permalink raw reply related

* [PATCH 2/6] Add new NOSAVE_DATA linker script macro.
From: Tim Abbott @ 2009-04-30 19:32 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
	H. Peter Anvin, sparclinux, Sam Ravnborg, Waseem Daher,
	linux-arm-kernel, linux-s390, Jesper Nilsson, linux-am33-list,
	Yoshinori Sato, Helge Deller, Ingo Molnar, Geert Uytterhoeven,
	microblaze-uclinux, Russell King, user-mode-linux-devel,
	Heiko Carstens, Jeff Dike, dev-etrax, Mikael Starvik, Tony Luck,
	Tim Abbott, Cyrill Gorcunov, Michal Simek, Richard Henderson,
	Chris Zankel, Bryan Wu, linux-m32r, linux-parisc,
	Haavard Skinnemoen, Hirokazu Takata, Ralf Baechle, Anders Kaseorg,
	Kyle McMartin, Paul Mundt, Thomas Gleixner, linux-alpha,
	Martin Schwidefsky, uclinux-dist-devel, Linus Torvalds,
	David S. Miller
In-Reply-To: <1241119956-31453-2-git-send-email-tabbott@mit.edu>

This patch is preparation for replacing most ".data.nosave" in the
kernel with macros, so that the section name can later be changed
without having to touch a lot of the kernel.

The long-term goal here is to be able to change the kernel's magic
section names to those that are compatible with -ffunction-sections
-fdata-sections.  This requires renaming all magic sections with names
of the form ".data.foo".

Signed-off-by: Tim Abbott <tabbott@mit.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 include/asm-generic/vmlinux.lds.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 3d88c87..f5ebd2b 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -124,6 +124,13 @@
 	. = ALIGN(PAGE_SIZE);						\
 	*(.bss.page_aligned)
 
+#define NOSAVE_DATA							\
+	. = ALIGN(PAGE_SIZE);						\
+	__nosave_begin = .;						\
+	*(.data.nosave)							\
+	. = ALIGN(PAGE_SIZE);						\
+	__nosave_end = .;
+
 #define RO_DATA(align)							\
 	. = ALIGN((align));						\
 	.rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {		\
-- 
1.6.2.1

^ permalink raw reply related

* [PATCH 6/6] Add support for __read_mostly to linux/cache.h
From: Tim Abbott @ 2009-04-30 19:32 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
	H. Peter Anvin, sparclinux, Waseem Daher, linux-arm-kernel,
	linux-s390, Jesper Nilsson, linux-am33-list, Yoshinori Sato,
	Helge Deller, Ingo Molnar, Geert Uytterhoeven, microblaze-uclinux,
	Russell King, user-mode-linux-devel, Heiko Carstens, Jeff Dike,
	dev-etrax, Mikael Starvik, Tony Luck, Tim Abbott, Cyrill Gorcunov,
	Michal Simek, Richard Henderson, Chris Zankel, Bryan Wu,
	linux-m32r, linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
	Ralf Baechle, Anders Kaseorg, Kyle McMartin, Paul Mundt,
	Thomas Gleixner, linux-alpha, Martin Schwidefsky,
	uclinux-dist-devel, Linus Torvalds, David S. Miller
In-Reply-To: <1241119956-31453-6-git-send-email-tabbott@mit.edu>

Signed-off-by: Tim Abbott <tabbott@mit.edu>
---
 include/linux/cache.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/linux/cache.h b/include/linux/cache.h
index 97e2488..99d8a6f 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -13,7 +13,13 @@
 #endif
 
 #ifndef __read_mostly
+#ifdef CONFIG_HAVE_READ_MOSTLY_DATA
+#define __read_mostly __attribute__((__section__(".data.read_mostly")))
+#define __READ_MOSTLY .section ".data.read_mostly", "aw"
+#else
 #define __read_mostly
+#define __READ_MOSTLY
+#endif /* CONFIG_HAVE_READ_MOSTLY_DATA */
 #endif
 
 #ifndef ____cacheline_aligned
-- 
1.6.2.1

^ permalink raw reply related

* [PATCH v2] powerpc/pci: Move pseries code into pseries platform specific area
From: Kumar Gala @ 2009-04-30 19:26 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Paul Mackerras

There doesn't appear to be any specific reason that we need to setup the
pseries specific notifier in generic arch pci code.  Move it into pseries
land.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 arch/powerpc/include/asm/pci-bridge.h  |    1 +
 arch/powerpc/kernel/pci_dn.c           |   28 +---------------------------
 arch/powerpc/platforms/pseries/setup.c |   25 +++++++++++++++++++++++++
 3 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 84007af..90fcfc4 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -221,6 +221,7 @@ struct pci_dn {
 #define PCI_DN(dn)	((struct pci_dn *) (dn)->data)
 
 extern struct device_node *fetch_dev_dn(struct pci_dev *dev);
+extern void * update_dn_pci_info(struct device_node *dn, void *data);
 
 /* Get a device_node from a pci_dev.  This code must be fast except
  * in the case where the sysdata is incorrect and needs to be fixed
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index 1c67de5..d5e36e5 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -27,7 +27,6 @@
 #include <asm/io.h>
 #include <asm/prom.h>
 #include <asm/pci-bridge.h>
-#include <asm/pSeries_reconfig.h>
 #include <asm/ppc-pci.h>
 #include <asm/firmware.h>
 
@@ -35,7 +34,7 @@
  * Traverse_func that inits the PCI fields of the device node.
  * NOTE: this *must* be done before read/write config to the device.
  */
-static void * __devinit update_dn_pci_info(struct device_node *dn, void *data)
+void * __devinit update_dn_pci_info(struct device_node *dn, void *data)
 {
 	struct pci_controller *phb = data;
 	const int *type =
@@ -184,29 +183,6 @@ struct device_node *fetch_dev_dn(struct pci_dev *dev)
 }
 EXPORT_SYMBOL(fetch_dev_dn);
 
-static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node)
-{
-	struct device_node *np = node;
-	struct pci_dn *pci = NULL;
-	int err = NOTIFY_OK;
-
-	switch (action) {
-	case PSERIES_RECONFIG_ADD:
-		pci = np->parent->data;
-		if (pci)
-			update_dn_pci_info(np, pci->phb);
-		break;
-	default:
-		err = NOTIFY_DONE;
-		break;
-	}
-	return err;
-}
-
-static struct notifier_block pci_dn_reconfig_nb = {
-	.notifier_call = pci_dn_reconfig_notifier,
-};
-
 /** 
  * pci_devs_phb_init - Initialize phbs and pci devs under them.
  * 
@@ -223,6 +199,4 @@ void __init pci_devs_phb_init(void)
 	/* This must be done first so the device nodes have valid pci info! */
 	list_for_each_entry_safe(phb, tmp, &hose_list, list_node)
 		pci_devs_phb_init_dynamic(phb);
-
-	pSeries_reconfig_notifier_register(&pci_dn_reconfig_nb);
 }
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index ec34170..8d75ea2 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -63,6 +63,7 @@
 #include <asm/smp.h>
 #include <asm/firmware.h>
 #include <asm/eeh.h>
+#include <asm/pSeries_reconfig.h>
 
 #include "plpar_wrappers.h"
 #include "pseries.h"
@@ -254,6 +255,29 @@ static void __init pseries_discover_pic(void)
 	       " interrupt-controller\n");
 }
 
+static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node)
+{
+	struct device_node *np = node;
+	struct pci_dn *pci = NULL;
+	int err = NOTIFY_OK;
+
+	switch (action) {
+	case PSERIES_RECONFIG_ADD:
+		pci = np->parent->data;
+		if (pci)
+			update_dn_pci_info(np, pci->phb);
+		break;
+	default:
+		err = NOTIFY_DONE;
+		break;
+	}
+	return err;
+}
+
+static struct notifier_block pci_dn_reconfig_nb = {
+	.notifier_call = pci_dn_reconfig_notifier,
+};
+
 static void __init pSeries_setup_arch(void)
 {
 	/* Discover PIC type and setup ppc_md accordingly */
@@ -271,6 +295,7 @@ static void __init pSeries_setup_arch(void)
 	/* Find and initialize PCI host bridges */
 	init_pci_config_tokens();
 	find_and_init_phbs();
+	pSeries_reconfig_notifier_register(&pci_dn_reconfig_nb);
 	eeh_init();
 
 	pSeries_nvram_init();
-- 
1.6.0.6

^ permalink raw reply related

* Re: Need a patch tested on a windtunnel powermac
From: Josh Boyer @ 2009-04-30 19:17 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: Jean Delvare, linuxppc-dev
In-Reply-To: <20090430002448.GA5208@hansolo.jdub.homelinux.org>

On Wed, Apr 29, 2009 at 08:24:48PM -0400, Josh Boyer wrote:
>On Thu, Apr 30, 2009 at 09:30:59AM +1000, Paul Mackerras wrote:
>>Does anyone here still have a "windtunnel" powermac (PowerMac3,6)
>>machine running Linux?  We need someone to test Jean Delvare's patch
>>to the therm_windtunnel driver.  The patch is at:
>>
>>http://patchwork.ozlabs.org/patch/26095/
>>
>>I don't have a windtunnel machine myself - I have a PowerMac3,5 but
>>not a PowerMac3,6.
>
>I might have one.  I'll pull the G4 I have out of it's box and check tomorrow.

Amazingly enough, I do.  It's running some crusty-arse gentoo install from
2005, so I need to install something newer on it.  Hopefully that goes smoothly
today...

josh

^ permalink raw reply

* Re: why does ppc64 require boards to call pci_devs_phb_init()?
From: Kumar Gala @ 2009-04-30 18:04 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Linuxppc-dev Development
In-Reply-To: <33403DE1-6AC2-49E9-9539-C520E4944D77@kernel.crashing.org>


On Apr 30, 2009, at 10:37 AM, Kumar Gala wrote:

> looking at merging this in w/ppc32 and wondering why board code has  
> to call pci_devs_phb_init() and not do it via pcibios_init()
>
> - k

As I look at this a bit more, I'm thinking why don't we do:

pci_devs_phb_init_dynamic() in pcibios_alloc_controller

An add some code into pci_devs_phb_init_dynamic so we don't re-do  
update_dn_pci_info if dn->data is already set.

I am not sure what impact this has ppc64 systems that call  
pci_devs_phb_init()

- k

^ permalink raw reply

* Re: [PATCH] alim15x3: Remove historical hacks, re-enable init_hwif for PowerPC
From: Bartlomiej Zolnierkiewicz @ 2009-04-30 16:39 UTC (permalink / raw)
  To: avorontsov; +Cc: linuxppc-dev, Roderick Colenbrander, linux-ide
In-Reply-To: <20090427184742.GA6435@oksana.dev.rtsoft.ru>

On Monday 27 April 2009 20:47:42 Anton Vorontsov wrote:
> Some time ago we had to disable init_hwif callback for PowerPC builds.
> That was because of a historical IRQ overwrite in the driver, which
> was causing IDE malfunction on the MPC8610HPCD PowerPC boards.
> 
> It's unclear whether this overwrite is still useful, but it is proven
> to cause a bit of harm, and today some PowerPC targets (Xilinx ML510,
> as reported by Roderick Colenbrander) need the init_hwif, so we have
> to re-enable it and remove the overwrite.
> 
> Reported-by: Roderick Colenbrander <thunderbird2k@gmail.com>
> Suggested-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>

thanks, I applied it to ide-2.6.git/for-next

^ permalink raw reply

* Re: FSL Driver load issues with OF
From: Scott Wood @ 2009-04-30 16:20 UTC (permalink / raw)
  To: Benjamin Zores; +Cc: linuxppc-dev
In-Reply-To: <49F821B0.6030706@alcatel-lucent.fr>

On Wed, Apr 29, 2009 at 11:45:20AM +0200, Benjamin Zores wrote:
> Since the progressive migration of some PPC drivers to use of_platform bus
> (typically migrating OF parsing from fsl_soc.c to the device probe/init 
> functions),
> I'm experiencing driver load issues.
> 
> Actually, I'm not longer able to load of these drivers as the probe() 
> function is never called.

Make sure your board is calling of_platform_bus_probe(), and that the
devices you're trying to probe are under buses described by the id list.

-Scott

^ permalink raw reply

* why does ppc64 require boards to call pci_devs_phb_init()?
From: Kumar Gala @ 2009-04-30 15:37 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Linuxppc-dev Development

looking at merging this in w/ppc32 and wondering why board code has to  
call pci_devs_phb_init() and not do it via pcibios_init()

- k

^ permalink raw reply

* Re: [PATCH] powerpc/pci: Move pseries code into pseries platform specific area
From: Kumar Gala @ 2009-04-30 15:35 UTC (permalink / raw)
  To: michael; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <1241102965.7356.7.camel@concordia>


On Apr 30, 2009, at 9:49 AM, Michael Ellerman wrote:

> On Thu, 2009-04-30 at 09:14 -0500, Kumar Gala wrote:
>> There doesn't appear to be any specific reason that we need to  
>> setup the
>> pseries specific notifier in generic arch pci code.  Move it into  
>> pseries
>> land.
>
> Yeah I guess. Although if some other platform ever wants to do PCI
> hotplug it probably wants to call update_dn_pci_info() also.

when that happens we can worry about, also the code I moved is pretty  
pseries specific  (seeing as the event is called PSERIES_RECONFIG_ADD)

>> --- a/arch/powerpc/platforms/pseries/setup.c
>> +++ b/arch/powerpc/platforms/pseries/setup.c
>> @@ -254,6 +255,31 @@ static void __init pseries_discover_pic(void)
>>               " interrupt-controller\n");
>> }
>>
>> +extern void * update_dn_pci_info(struct device_node *dn, void  
>> *data);
>
> Ahem :)

Yeah, was being lazy.  I'll move it into asm/pci-bridge.h

- k

^ permalink raw reply

* Re: Porting the ibm_newemac driver to use phylib (and other PHY/MAC questions)
From: Kyle Moffett @ 2009-04-30 15:33 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev, Linux-Kernel@Vger. Kernel. Org, netdev
In-Reply-To: <fa686aa40904300811u41e94972offfd75520636bb02@mail.gmail.com>

On Thu, Apr 30, 2009 at 11:11 AM, Grant Likely
<grant.likely@secretlab.ca> wrote:
> Just a heads up Kyle; there are changes queued in the netdev tree
> which add OF helpers for MDIO bus drivers and MAC drivers. =C2=A0See here=
:
>
> http://git.kernel.org/?p=3Dlinux/kernel/git/davem/net-next-2.6.git;a=3Dco=
mmit;h=3D8bc487d150b939e69830c39322df4ee486efe381
>
> and here is an example of a driver change:
>
> http://git.kernel.org/?p=3Dlinux/kernel/git/davem/net-next-2.6.git;a=3Dco=
mmit;h=3D1dd2d06c0459a2f1bffc56765e3cc57427818867

Hmm, very interesting!  Thanks!  Although I'm not sure that those OF
helpers are entirely usable for the emac driver at the moment, as the
device trees for the existing boards simply don't have PHYs present in
them.  Most of the ibm_newemac board device-trees just have one of:
"phy-address =3D <4>", "phy-mask =3D <0xffff0000>", or nothing at all (for
autodetection).  I will probably need to leave in support for the old
PHY mask parsing to preserve backwards compatibility.

My main concern at the moment is cleaning up the driver's general PHY
handling.  I got started on this whole mess when I was trying to write
some hackish PHY drivers for a weird custom board I've got here.  I
couldn't figure out why the hell all my PHY register changes in the
phy_ops->init function kept getting cleared, until I noticed 2 things:
 The emac_reset_phy() function gets called occasionally and does not
call the ->init() function again afterwards.  The
genmii_setup_forced() function (in the EMAC driver) unconditionally
ORs the BCMR_RESET flag into the MII_BCMR register.  Both of those
meant that any early setup I did for my PHY was getting completely
cleared on a regular basis, with no decent way for me to patch it back
up again.

Cheers,
Kyle Moffett

^ permalink raw reply

* Re: Porting the ibm_newemac driver to use phylib (and other PHY/MAC questions)
From: Grant Likely @ 2009-04-30 15:11 UTC (permalink / raw)
  To: Kyle Moffett; +Cc: linuxppc-dev, Linux-Kernel@Vger. Kernel. Org, netdev
In-Reply-To: <f73f7ab80904300804j1f847b70ha0fe3cda07249110@mail.gmail.com>

On Thu, Apr 30, 2009 at 9:04 AM, Kyle Moffett <kyle@moffetthome.net> wrote:
> On Wed, Apr 22, 2009 at 4:21 AM, Benjamin Herrenschmidt
> <benh@kernel.crashing.org> wrote:
>> On Mon, 2009-04-20 at 20:10 -0400, Kyle Moffett wrote:
>>> > IIRC, Ben had some issues with how phylib and the EMAC would need to
>>> > interact. =A0Not sure if he has those written down somewhere or not.
>>> > (CC'd).
>>>
>>> Hmm, yeah, I'd be interested to see those. =A0There's enough similar
>>> between phylib and the EMAC and sungem drivers that I'm considering a
>>> series of somewhat-mechanical patches to make EMAC and sungem use the
>>> "struct phy_device" and "struct mii_bus" from phylib, possibly
>>> abstracting out some helper functions along the way.
>>
>> Yup, emac and sungem predate phylib.
>>
>> I had a quick look at what it would take to port at least emac over, the
>> main issue was that I want to be able to sleep (ie, take a mutex) in my
>> mdio read/write functions, and back then, phylib wouldn't let me do that
>> due to spinlock and timer/softirq usage.
>
> Ok, I've made some progress in the port, but right now I'm trying to
> puzzle out what the "gpcs" bits in the code are. =A0From the few
> publicly available docs and some mailing list posts, the gpcs address
> appears to be some kind of integrated virtual PHY used when 460GT-ish
> chips are communicating via an SGMII bus. =A0My current plan of action
> is to separate the "gpcs" out into a separate PHY device controlled by
> the emac code.
>
> I'm also curious about the intent of the "mdio_instance" pointer (IE:
> the "mdio-device" property). =A0Is that used when all the PHY devices
> are attached to the MDIO bus of only one of the (multiple) emac
> devices? =A0Or is that for when two emac chipsets are connected to the
> same MDIO bus wire? =A0(or both?) =A0What keeps the emac_instance pointed
> to by the "mdio_instance" from going away while the other emac chipset
> is using it?
>
> In either case, I plan to have the device actually holding the MDIO
> bus run the mdiobus_alloc() and mdiobus_register() functions, then the
> other emac instance will simply take a reference to that MDIO bus
> (which would also pin down the emac instance that owns it).

Just a heads up Kyle; there are changes queued in the netdev tree
which add OF helpers for MDIO bus drivers and MAC drivers.  See here:

http://git.kernel.org/?p=3Dlinux/kernel/git/davem/net-next-2.6.git;a=3Dcomm=
it;h=3D8bc487d150b939e69830c39322df4ee486efe381

and here is an example of a driver change:

http://git.kernel.org/?p=3Dlinux/kernel/git/davem/net-next-2.6.git;a=3Dcomm=
it;h=3D1dd2d06c0459a2f1bffc56765e3cc57427818867

Cheers,
g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply

* Re: Porting the ibm_newemac driver to use phylib (and other PHY/MAC questions)
From: Kyle Moffett @ 2009-04-30 15:04 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: netdev, Linux-Kernel@Vger. Kernel. Org, linuxppc-dev
In-Reply-To: <1240388476.17445.10.camel@pasglop>

On Wed, Apr 22, 2009 at 4:21 AM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Mon, 2009-04-20 at 20:10 -0400, Kyle Moffett wrote:
>> > IIRC, Ben had some issues with how phylib and the EMAC would need to
>> > interact. =C2=A0Not sure if he has those written down somewhere or not=
.
>> > (CC'd).
>>
>> Hmm, yeah, I'd be interested to see those. =C2=A0There's enough similar
>> between phylib and the EMAC and sungem drivers that I'm considering a
>> series of somewhat-mechanical patches to make EMAC and sungem use the
>> "struct phy_device" and "struct mii_bus" from phylib, possibly
>> abstracting out some helper functions along the way.
>
> Yup, emac and sungem predate phylib.
>
> I had a quick look at what it would take to port at least emac over, the
> main issue was that I want to be able to sleep (ie, take a mutex) in my
> mdio read/write functions, and back then, phylib wouldn't let me do that
> due to spinlock and timer/softirq usage.

Ok, I've made some progress in the port, but right now I'm trying to
puzzle out what the "gpcs" bits in the code are.  From the few
publicly available docs and some mailing list posts, the gpcs address
appears to be some kind of integrated virtual PHY used when 460GT-ish
chips are communicating via an SGMII bus.  My current plan of action
is to separate the "gpcs" out into a separate PHY device controlled by
the emac code.

I'm also curious about the intent of the "mdio_instance" pointer (IE:
the "mdio-device" property).  Is that used when all the PHY devices
are attached to the MDIO bus of only one of the (multiple) emac
devices?  Or is that for when two emac chipsets are connected to the
same MDIO bus wire?  (or both?)  What keeps the emac_instance pointed
to by the "mdio_instance" from going away while the other emac chipset
is using it?

In either case, I plan to have the device actually holding the MDIO
bus run the mdiobus_alloc() and mdiobus_register() functions, then the
other emac instance will simply take a reference to that MDIO bus
(which would also pin down the emac instance that owns it).

Cheers,
Kyle Moffett

^ permalink raw reply

* Re: [PATCH 0/9] powerpc/pci: clean up direct access to sysdata
From: Michael Ellerman @ 2009-04-30 14:50 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev
In-Reply-To: <EAC6B615-35F2-4CD9-A7E8-FAAD4B9D9DF3@kernel.crashing.org>

[-- Attachment #1: Type: text/plain, Size: 1349 bytes --]

On Thu, 2009-04-30 at 09:18 -0500, Kumar Gala wrote:
> On Apr 30, 2009, at 8:49 AM, Michael Ellerman wrote:
> 
> > On Thu, 2009-04-30 at 08:09 -0500, Kumar Gala wrote:
> >> We shouldn't be accessing sysdata directly.  In the future we might  
> >> have
> >> sysdata be a device_node on ppc32 to match ppc64.  Direct access  
> >> would make that
> >> a bit difficult.
> >>
> >> If someone can look at the iseries code I would appreciate that:
> >>
> >> arch/powerpc/platforms/iseries/pci.c:            
> >> iomm_table[current_iomm_table_entry] = dev->sysdata;
> >> arch/powerpc/platforms/iseries/pci.c:                    
> >> iseries_ds_addr(dev->sysdata) | (bar_num << 24);
> >> arch/powerpc/platforms/iseries/pci.c:   pdev->sysdata = node;
> >
> > It looks like it's basically doing the same logic as
> > pci_device_to_OF_node(), and fetch_dev_dn(), but there's probably some
> > reason why it's not using those.
> >
> > Given how much new iseries hardware there is, I think we'd probably
> > rather leave the code as is. It's a device node anyway, so it doesn't
> > block your plans RE ppc32.
> >
> > cheers
> 
> I was already thinking along those lines, but figured I see if anyone  
> is really "maintaining" iseries code :)

Not that much, it would be sfr if anyone, but I think he's a bit busy :)

cheers

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* Re: [PATCH] powerpc/pci: Move pseries code into pseries platform specific area
From: Michael Ellerman @ 2009-04-30 14:49 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <1241100846-14216-1-git-send-email-galak@kernel.crashing.org>

[-- Attachment #1: Type: text/plain, Size: 668 bytes --]

On Thu, 2009-04-30 at 09:14 -0500, Kumar Gala wrote:
> There doesn't appear to be any specific reason that we need to setup the
> pseries specific notifier in generic arch pci code.  Move it into pseries
> land.

Yeah I guess. Although if some other platform ever wants to do PCI
hotplug it probably wants to call update_dn_pci_info() also.

> --- a/arch/powerpc/platforms/pseries/setup.c
> +++ b/arch/powerpc/platforms/pseries/setup.c
> @@ -254,6 +255,31 @@ static void __init pseries_discover_pic(void)
>                " interrupt-controller\n");
>  }
>  
> +extern void * update_dn_pci_info(struct device_node *dn, void *data);

Ahem :)

cheers

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* Re: Next April 28: boot failure on PowerPC with SLQB
From: Anton Vorontsov @ 2009-04-30 14:10 UTC (permalink / raw)
  To: Nick Piggin
  Cc: Stephen Rothwell, Christoph Lameter, Pekka Enberg, linux-kernel,
	linuxppc-dev, linux-next
In-Reply-To: <20090430130542.GF6900@wotan.suse.de>

On Thu, Apr 30, 2009 at 03:05:42PM +0200, Nick Piggin wrote:
[...]
> ---
> SLQB: fix dumb early allocation cache
> 
> The dumb early allocation cache had a bug where it could allow allocation
> to go past the end of a page, which could cause crashes or random memory
> corruption. Fix this and simplify the logic.
> 
> Signed-off-by: Nick Piggin <npiggin@suse.de>
> ---
>  mm/slqb.c |   19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> Index: linux-2.6/mm/slqb.c
> ===================================================================
> --- linux-2.6.orig/mm/slqb.c
> +++ linux-2.6/mm/slqb.c
> @@ -2185,8 +2185,11 @@ static void *kmem_cache_dyn_array_alloc(
>  {
>  	size_t size = sizeof(void *) * ids;
>  
> +	BUG_ON(!size);
> +
>  	if (unlikely(!slab_is_available())) {
>  		static void *nextmem;
> +		static size_t nextleft;
>  		void *ret;
>  
>  		/*
> @@ -2194,16 +2197,16 @@ static void *kmem_cache_dyn_array_alloc(
>  		 * never get freed by definition so we can do it rather
>  		 * simply.
>  		 */
> -		if (!nextmem) {
> -			nextmem = alloc_pages_exact(size, GFP_KERNEL);
> -			if (!nextmem)
> -				return NULL;
> +		if (size > nextleft) {
> +                        nextmem = alloc_pages_exact(size, GFP_KERNEL);
> +                        if (!nextmem)
> +                                return NULL;

Cosmetic issue: spaces instead of tabs are used on these
three lines.

> +			nextleft = roundup(size, PAGE_SIZE);
>  		}
> +
>  		ret = nextmem;
> -		nextmem = (void *)((unsigned long)ret + size);
> -		if ((unsigned long)ret >> PAGE_SHIFT !=
> -				(unsigned long)nextmem >> PAGE_SHIFT)
> -			nextmem = NULL;
> +		nextleft -= size;
> +		nextmem += size;
>  		memset(ret, 0, size);
>  		return ret;
>  	} else {

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply

* Re: [PATCH 0/9] powerpc/pci: clean up direct access to sysdata
From: Kumar Gala @ 2009-04-30 14:18 UTC (permalink / raw)
  To: michael; +Cc: linuxppc-dev
In-Reply-To: <1241099366.7356.4.camel@concordia>


On Apr 30, 2009, at 8:49 AM, Michael Ellerman wrote:

> On Thu, 2009-04-30 at 08:09 -0500, Kumar Gala wrote:
>> We shouldn't be accessing sysdata directly.  In the future we might  
>> have
>> sysdata be a device_node on ppc32 to match ppc64.  Direct access  
>> would make that
>> a bit difficult.
>>
>> If someone can look at the iseries code I would appreciate that:
>>
>> arch/powerpc/platforms/iseries/pci.c:            
>> iomm_table[current_iomm_table_entry] = dev->sysdata;
>> arch/powerpc/platforms/iseries/pci.c:                    
>> iseries_ds_addr(dev->sysdata) | (bar_num << 24);
>> arch/powerpc/platforms/iseries/pci.c:   pdev->sysdata = node;
>
> It looks like it's basically doing the same logic as
> pci_device_to_OF_node(), and fetch_dev_dn(), but there's probably some
> reason why it's not using those.
>
> Given how much new iseries hardware there is, I think we'd probably
> rather leave the code as is. It's a device node anyway, so it doesn't
> block your plans RE ppc32.
>
> cheers

I was already thinking along those lines, but figured I see if anyone  
is really "maintaining" iseries code :)

- k

^ permalink raw reply

* [PATCH] powerpc/pci: Move pseries code into pseries platform specific area
From: Kumar Gala @ 2009-04-30 14:14 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Paul Mackerras

There doesn't appear to be any specific reason that we need to setup the
pseries specific notifier in generic arch pci code.  Move it into pseries
land.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 arch/powerpc/kernel/pci_dn.c           |   28 +---------------------------
 arch/powerpc/platforms/pseries/setup.c |   27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index 1c67de5..d5e36e5 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -27,7 +27,6 @@
 #include <asm/io.h>
 #include <asm/prom.h>
 #include <asm/pci-bridge.h>
-#include <asm/pSeries_reconfig.h>
 #include <asm/ppc-pci.h>
 #include <asm/firmware.h>
 
@@ -35,7 +34,7 @@
  * Traverse_func that inits the PCI fields of the device node.
  * NOTE: this *must* be done before read/write config to the device.
  */
-static void * __devinit update_dn_pci_info(struct device_node *dn, void *data)
+void * __devinit update_dn_pci_info(struct device_node *dn, void *data)
 {
 	struct pci_controller *phb = data;
 	const int *type =
@@ -184,29 +183,6 @@ struct device_node *fetch_dev_dn(struct pci_dev *dev)
 }
 EXPORT_SYMBOL(fetch_dev_dn);
 
-static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node)
-{
-	struct device_node *np = node;
-	struct pci_dn *pci = NULL;
-	int err = NOTIFY_OK;
-
-	switch (action) {
-	case PSERIES_RECONFIG_ADD:
-		pci = np->parent->data;
-		if (pci)
-			update_dn_pci_info(np, pci->phb);
-		break;
-	default:
-		err = NOTIFY_DONE;
-		break;
-	}
-	return err;
-}
-
-static struct notifier_block pci_dn_reconfig_nb = {
-	.notifier_call = pci_dn_reconfig_notifier,
-};
-
 /** 
  * pci_devs_phb_init - Initialize phbs and pci devs under them.
  * 
@@ -223,6 +199,4 @@ void __init pci_devs_phb_init(void)
 	/* This must be done first so the device nodes have valid pci info! */
 	list_for_each_entry_safe(phb, tmp, &hose_list, list_node)
 		pci_devs_phb_init_dynamic(phb);
-
-	pSeries_reconfig_notifier_register(&pci_dn_reconfig_nb);
 }
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index ec34170..096ea1b 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -63,6 +63,7 @@
 #include <asm/smp.h>
 #include <asm/firmware.h>
 #include <asm/eeh.h>
+#include <asm/pSeries_reconfig.h>
 
 #include "plpar_wrappers.h"
 #include "pseries.h"
@@ -254,6 +255,31 @@ static void __init pseries_discover_pic(void)
 	       " interrupt-controller\n");
 }
 
+extern void * update_dn_pci_info(struct device_node *dn, void *data);
+
+static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node)
+{
+	struct device_node *np = node;
+	struct pci_dn *pci = NULL;
+	int err = NOTIFY_OK;
+
+	switch (action) {
+	case PSERIES_RECONFIG_ADD:
+		pci = np->parent->data;
+		if (pci)
+			update_dn_pci_info(np, pci->phb);
+		break;
+	default:
+		err = NOTIFY_DONE;
+		break;
+	}
+	return err;
+}
+
+static struct notifier_block pci_dn_reconfig_nb = {
+	.notifier_call = pci_dn_reconfig_notifier,
+};
+
 static void __init pSeries_setup_arch(void)
 {
 	/* Discover PIC type and setup ppc_md accordingly */
@@ -271,6 +297,7 @@ static void __init pSeries_setup_arch(void)
 	/* Find and initialize PCI host bridges */
 	init_pci_config_tokens();
 	find_and_init_phbs();
+	pSeries_reconfig_notifier_register(&pci_dn_reconfig_nb);
 	eeh_init();
 
 	pSeries_nvram_init();
-- 
1.6.0.6

^ permalink raw reply related

* Re: Next April 28: boot failure on PowerPC with SLQB
From: Nick Piggin @ 2009-04-30 14:10 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Christoph Lameter, linux-kernel, linuxppc-dev, Pekka Enberg,
	linux-next
In-Reply-To: <20090501000033.ecce9ed8.sfr@canb.auug.org.au>

On Fri, May 01, 2009 at 12:00:33AM +1000, Stephen Rothwell wrote:
> Hi Nick,
> 
> On Thu, 30 Apr 2009 15:05:42 +0200 Nick Piggin <npiggin@suse.de> wrote:
> >
> > Hmm, this might do it. The following code now passes some stress testing
> > in a userspace harness wheras before it did not (and was obviously wrong).
> 
> Indeed that allows it to boot fine.  Thanks.
> 
> Tested-by: Stephen Rothwell <sfr@canb.auug.org.au>

Great, thanks for reporting and testing. This one is especially
important because it is basically scribbling on random memory
:( Pekka, please apply.

Thanks,
Nick

^ permalink raw reply


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