Skip to contentSkip to conversation

: Make LMB code sharable with sparc64.

GIT David Miller 4 participants 6 messages Feb 13, 2008

lore
Share & tools
lore
#0 lore raw

As I mentioned to a few ppc folks at LCA08 I plan to use the LMB code from powerpc as a basis for NUMA support on sparc64.

There are two changes.

1) Move arch/powerpc/mm/lmb.c to lib/lmb.c, put the main interface bits in include/linux/lmb.h, put arch-specific bits in asm/lmb.h and add Kconfig machinery to build this stuff on sparc64.

2) Fix a bug in lmb_alloc() wherein the size was not aligned so we could easily run out of reserve blocks because every aligned allocation would create a tiny hole, and secondly the lmb_reserve() call there did not have it's return value checked.

Powerpc folks, if there are no objections please pull, thanks!

The following changes since commit 96b5a46e2a72dc1829370c87053e0cd558d58bc0:
Linus Torvalds (1):
WMI: initialize wmi_blocks.list even if ACPI is disabled

are available in the git repository at:

master.kernel.org:/pub/scm/linux/kernel/git/davem/lmb-2.6.git master

David S. Miller (2):
[LIB]: Make PowerPC LMB code generic so sparc64 can use it too. [LMB]: Fix bug in __lmb_alloc_base().

 arch/powerpc/Kconfig                    |    3 +
 arch/powerpc/kernel/btext.c             |    2 +-
 arch/powerpc/kernel/crash.c             |    2 +-
 arch/powerpc/kernel/crash_dump.c        |    2 +-
 arch/powerpc/kernel/machine_kexec.c     |    2 +-
 arch/powerpc/kernel/prom.c              |    2 +-
 arch/powerpc/kernel/rtas.c              |    2 +-
 arch/powerpc/kernel/setup-common.c      |    2 +-
 arch/powerpc/kernel/setup_64.c          |    2 +-
 arch/powerpc/kernel/vdso.c              |    2 +-
 arch/powerpc/mm/Makefile                |    2 +-
 arch/powerpc/mm/hash_utils_64.c         |    2 +-
 arch/powerpc/mm/init_32.c               |    2 +-
 arch/powerpc/mm/init_64.c               |    2 +-
 arch/powerpc/mm/mem.c                   |    2 +-
 arch/powerpc/mm/numa.c                  |    2 +-
 arch/powerpc/mm/ppc_mmu_32.c            |    2 +-
 arch/powerpc/mm/stab.c                  |    2 +-
 arch/powerpc/platforms/cell/iommu.c     |    2 +-
 arch/powerpc/platforms/maple/setup.c    |    2 +-
 arch/powerpc/platforms/powermac/setup.c |    2 +-
 arch/powerpc/platforms/ps3/htab.c       |    2 +-
 arch/powerpc/platforms/ps3/mm.c         |    2 +-
 arch/powerpc/platforms/ps3/os-area.c    |    2 +-
 arch/powerpc/sysdev/dart_iommu.c        |    2 +-
 arch/sparc64/Kconfig                    |    3 +
 include/asm-powerpc/abs_addr.h          |    2 +-
 include/asm-powerpc/lmb.h               |   82 +++---------------------------
 include/asm-sparc64/lmb.h               |   10 ++++
 include/linux/lmb.h                     |   83 +++++++++++++++++++++++++++++++
 lib/Makefile                            |    2 +
 {arch/powerpc/mm => lib}/lmb.c          |   39 ++++++++-------
 32 files changed, 155 insertions(+), 117 deletions(-)
 create mode 100644 include/asm-sparc64/lmb.h
 create mode 100644 include/linux/lmb.h
 rename {arch/powerpc/mm => lib}/lmb.c (92%)
#1 lore raw
Quoted 20 lines · David Miller

As I mentioned to a few ppc folks at LCA08 I plan to use the LMB code from powerpc as a basis for NUMA support on sparc64.

There are two changes.

1) Move arch/powerpc/mm/lmb.c to lib/lmb.c, put the main interface bits in include/linux/lmb.h, put arch-specific bits in asm/lmb.h and add Kconfig machinery to build this stuff on sparc64.

2) Fix a bug in lmb_alloc() wherein the size was not aligned so we could easily run out of reserve blocks because every aligned allocation would create a tiny hole, and secondly the lmb_reserve() call there did not have it's return value checked.

Powerpc folks, if there are no objections please pull, thanks!

Quoted 7 lines

The following changes since commit 96b5a46e2a72dc1829370c87053e0cd558d58bc0:
Linus Torvalds (1):
WMI: initialize wmi_blocks.list even if ACPI is disabled

are available in the git repository at:

master.kernel.org:/pub/scm/linux/kernel/git/davem/lmb-2.6.git master

Review had been easier if the patch was inlined.
Took a quick look at the small Kconfig bits.

Quoted 1 line

From arch/sparc64/Kconfig:

+config LMB
+ def_bool y
+

Can we plase have this changed to use:

config SPARC64
+ select HAVE_LMB

And then in lib/Kconfig have
+config HAVE_LMB
+ bool

So we avoid creating a new variable each time we introdce LMB support. You would need to update powerpc Kconfig too of course.

This way of doing it is documented in:
Documenation/kbuild/kconfig.language.txt

Thanks,
Sam

#2 lore raw

From: Sam Ravnborg <[email protected]>
Date: Wed, 13 Feb 2008 09:57:35 +0100

Quoted 1 line

Review had been easier if the patch was inlined.

Sorry :)

Quoted 11 lines

Can we plase have this changed to use:

config SPARC64

(quoted diff) +1 -0
+	select HAVE_LMB

And then in lib/Kconfig have

(quoted diff) +2 -0
+config HAVE_LMB
+	bool

So we avoid creating a new variable each time we introdce LMB support. You would need to update powerpc Kconfig too of course.

Sure, I'll rework this in the next day or so to do things that way.

Thanks for the review.

#3 lore raw
In reply to David Miller
Quoted 11 lines · David Miller

As I mentioned to a few ppc folks at LCA08 I plan to use the LMB code from powerpc as a basis for NUMA support on sparc64.

There are two changes.

1) Move arch/powerpc/mm/lmb.c to lib/lmb.c, put the main interface bits in include/linux/lmb.h, put arch-specific bits in asm/lmb.h and add Kconfig machinery to build this stuff on sparc64.

Quoted 7 lines

2) Fix a bug in lmb_alloc() wherein the size was not aligned so we could easily run out of reserve blocks because every aligned allocation would create a tiny hole, and secondly the lmb_reserve() call there did not have it's return value checked.

Powerpc folks, if there are no objections please pull, thanks!

Looks like there are a few places (in arch/powerpc) that were getting asm/prom.h via asm/lmb.h, I'll send a patch in the morning.

cheers

arch/powerpc/mm/numa.c:124: error: implicit declaration of function 'of_find_node_by_type'

arch/powerpc/platforms/ps3/os-area.c:215: error: variable 'property_rtc_diff' has initializer but incomplete type

Signature · 8 lines
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
#4 lore raw
In reply to David Miller
Quoted 25 lines · David Miller

As I mentioned to a few ppc folks at LCA08 I plan to use the LMB code from powerpc as a basis for NUMA support on sparc64.

There are two changes.

1) Move arch/powerpc/mm/lmb.c to lib/lmb.c, put the main interface bits in include/linux/lmb.h, put arch-specific bits in asm/lmb.h and add Kconfig machinery to build this stuff on sparc64.

2) Fix a bug in lmb_alloc() wherein the size was not aligned so we could easily run out of reserve blocks because every aligned allocation would create a tiny hole, and secondly the lmb_reserve() call there did not have it's return value checked.

Powerpc folks, if there are no objections please pull, thanks!

The following changes since commit 96b5a46e2a72dc1829370c87053e0cd558d58bc0:
Linus Torvalds (1):
WMI: initialize wmi_blocks.list even if ACPI is disabled

Quoted 7 lines

are available in the git repository at:

master.kernel.org:/pub/scm/linux/kernel/git/davem/lmb-2.6.git master

David S. Miller (2):
[LIB]: Make PowerPC LMB code generic so sparc64 can use it too. [LMB]: Fix bug in __lmb_alloc_base().

Does sparc have the concept of a phys_addr_t? We are in the process of expanding the lmb support to deal with 36-bit physical addresses on 32-bit machines.

- k

#5 lore raw

From: Kumar Gala <[email protected]>
Date: Wed, 13 Feb 2008 07:12:26 -0600

Quoted 3 lines

Does sparc have the concept of a phys_addr_t? We are in the process of expanding the lmb support to deal with 36-bit physical addresses on 32-bit machines.

On sparc64, where I intend to use this, unsigned long's are 64-bit. If you use some phys_addr_t type instead to help ppc32 along, that would be perfectly fine with me.