Skip to contentSkip to conversation

powerpc: move PAGE_SIZE outside #ifdef __KERNEL__

PATCH NAK Geoff Levand 6 participants 8 messages Apr 20, 2006 – Apr 21, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: move PAGE_SIZE outside #ifdef __KERNEL__

The procps package needs PAGE_SIZE, defined in asm-powerpc/page.h, but it is defined inside "#ifdef __KERNEL__".

This moves the PAGE_SIZE definition outside of "#ifdef __KERNEL__".

From: Hiroaki Fuse

---

include/asm-powerpc/page.h +1 -1
Index: powerpc.git/include/asm-powerpc/page.h
===================================================================
@@ -10,7 +10,6 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-#ifdef __KERNEL__
 #include <linux/config.h>
 #include <asm/asm-compat.h>
 
@@ -37,6 +36,7 @@
  */
 #define PAGE_MASK      (~((1 << PAGE_SHIFT) - 1))
 
+#ifdef __KERNEL__
 /*
  * KERNELBASE is the virtual address of the start of the kernel, it's often
  * the same as PAGE_OFFSET, but _might not be_.
#1 lore raw
Quoted 4 lines · Geoff Levand

The procps package needs PAGE_SIZE, defined in asm-powerpc/page.h, but it is defined inside "#ifdef __KERNEL__".

This moves the PAGE_SIZE definition outside of "#ifdef __KERNEL__".

Why do you want to do that? Userspace shouldn't be using PAGE_SIZE directly.

David

#2 lore raw
In reply to Geoff Levand
Quoted 7 lines · Geoff Levand

The procps package needs PAGE_SIZE, defined in asm-powerpc/page.h, but it is defined inside "#ifdef __KERNEL__".

This moves the PAGE_SIZE definition outside of "#ifdef __KERNEL__".

From: Hiroaki Fuse

Nack.

It's a little harder unfortunately. First of all, the patch moves more parts outside of __KERNEL__, like the #include <linux/config.h>, which does not get installed into /usr/include/linux/.

More importantly, the page size is no longer constant on powerpc across kernel builds. User space relying on a fixed size is broken.

Please look into the sysconf(3) and getpagesize(2) man pages for how to do it correctly.

Which version of procps are you referring to anyway? This bug seems to have been fixed back in 2001, but maybe it got reintroduced now.

	Arnd <><
#3 lore raw
Quoted 15 lines · Arnd Bergmann
Quoted 7 lines · Geoff Levand

The procps package needs PAGE_SIZE, defined in asm-powerpc/page.h, but it is defined inside "#ifdef __KERNEL__".

This moves the PAGE_SIZE definition outside of "#ifdef __KERNEL__".

From: Hiroaki Fuse

Nack.

It's a little harder unfortunately. First of all, the patch moves more parts outside of __KERNEL__, like the #include <linux/config.h>, which does not get installed into /usr/include/linux/.

Quoted 9 lines

More importantly, the page size is no longer constant on powerpc across kernel builds. User space relying on a fixed size is broken.

Please look into the sysconf(3) and getpagesize(2) man pages for how to do it correctly.

Which version of procps are you referring to anyway? This bug seems to have been fixed back in 2001, but maybe it got reintroduced now.

Sorry, procps-2.0.14. Seems the latest is at procps-3.2.6. I'll check it.

-Geoff

#4 lore raw
In reply to Geoff Levand
Quoted 4 lines · Geoff Levand

The procps package needs PAGE_SIZE, defined in asm-powerpc/page.h, but it is defined inside "#ifdef __KERNEL__".

This moves the PAGE_SIZE definition outside of "#ifdef __KERNEL__".

NAK. The procps package is bogus if it needs PAGE_SIZE since it can change based on a config option...

Ben.

#5 lore raw
In reply to Geoff Levand
Quoted 1 line · Geoff Levand

The procps package needs PAGE_SIZE, defined in asm-powerpc/page.h,

Ummm... why? If procps is assuming that the page size of the kernel it's running on is the same as the page size of the kernel it was compiled on, it's broken. It should be using sysconf(PAGE_SIZE) at runtime.

Paul.

#6 lore raw
Quoted 8 lines · Paul Mackerras
Quoted 1 line · Geoff Levand

The procps package needs PAGE_SIZE, defined in asm-powerpc/page.h,

Ummm... why? If procps is assuming that the page size of the kernel it's running on is the same as the page size of the kernel it was compiled on, it's broken. It should be using sysconf(PAGE_SIZE) at runtime.

As it turned out, the procps was out of date, and getting the latest solved the problem. Sorry for the trouble.

-Geoff

#7 lore raw
In reply to Geoff Levand
Quoted 4 lines · Geoff Levand

The procps package needs PAGE_SIZE, defined in asm-powerpc/page.h, but it is defined inside "#ifdef __KERNEL__".

This moves the PAGE_SIZE definition outside of "#ifdef __KERNEL__".

NACK.