Re: [PATCH] remove PAGE_SIZE from headers_install

2007-08-04 Thread Olaf Hering
On Sun, Jul 15, Mike Frysinger wrote:

> On 7/15/07, Olaf Hering <[EMAIL PROTECTED]> wrote:
> >On Sat, Jul 14, Mike Frysinger wrote:
> >> imo, asm/page.h should just go away for userspace.  the attached patch
> >> is what i've been using in Gentoo ... but somethings (like an arch or
> >> two in glibc) still assume asm/page.h is OK.  in general though,
> >> considering asm/page.h has become so unreliable lately (a large number
> >> of arches ifdef the whole thing out), most packages out there have
> >> updated already to use the userspace interface from unistd.h.
> >
> >You need that signed-off thing, and dont forget to send it to
> >[EMAIL PROTECTED]
> 
> i honestly didnt think people would consider it for inclusion as it
> was since i ripped out a lot more headers than just asm/page.h ;)

Did you clean it up and submit it already for 2.6.23?
Should someone else do it for you?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-08-04 Thread Olaf Hering
On Sun, Jul 15, Mike Frysinger wrote:

 On 7/15/07, Olaf Hering [EMAIL PROTECTED] wrote:
 On Sat, Jul 14, Mike Frysinger wrote:
  imo, asm/page.h should just go away for userspace.  the attached patch
  is what i've been using in Gentoo ... but somethings (like an arch or
  two in glibc) still assume asm/page.h is OK.  in general though,
  considering asm/page.h has become so unreliable lately (a large number
  of arches ifdef the whole thing out), most packages out there have
  updated already to use the userspace interface from unistd.h.
 
 You need that signed-off thing, and dont forget to send it to
 [EMAIL PROTECTED]
 
 i honestly didnt think people would consider it for inclusion as it
 was since i ripped out a lot more headers than just asm/page.h ;)

Did you clean it up and submit it already for 2.6.23?
Should someone else do it for you?
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-15 Thread David Woodhouse
On Sun, 2007-07-15 at 02:20 -0500, Mike Frysinger wrote:
> i honestly didnt think people would consider it for inclusion as it
> was since i ripped out a lot more headers than just asm/page.h ;)

So split it up into individual patches. It all looks good to me.

-- 
dwmw2

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-15 Thread David Woodhouse
On Sat, 2007-07-14 at 23:34 +0200, Olaf Hering wrote:
> > I would think it would be better to not define it at all.  Several
> > architectures already don't have PAGE_SIZE visible to userspace in 
> > any way.
> 
> i386 has it, so everyone uses it.

PowerPC lacks it, so nothing we ship in Fedora relies upon it.

Just kill it. Probably by leaving  empty for now; we can
remove it completely later.

-- 
dwmw2

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-15 Thread Olaf Hering
On Sat, Jul 14, Mike Frysinger wrote:

> On 7/14/07, Olaf Hering <[EMAIL PROTECTED]> wrote:
> >Declare PAGE_SIZE as getpagesize() for userspace.
> >PAGE_SIZE is used in resource.h and shm.h
> >
> >define PAGE_SIZE in asm-generic/page.h
> >guard get_order() with _ARCH_HAS_GET_ORDER for ia64 and xtensa
> >include asm-generic/page.h in asm/page.h
> >make asm/page.h nearly empty by moving the #ifdef guards up
> >remove unneeded page.h export from frv
> 
> imo, asm/page.h should just go away for userspace.  the attached patch
> is what i've been using in Gentoo ... but somethings (like an arch or
> two in glibc) still assume asm/page.h is OK.  in general though,
> considering asm/page.h has become so unreliable lately (a large number
> of arches ifdef the whole thing out), most packages out there have
> updated already to use the userspace interface from unistd.h.
> -mike

nothing appears to use linux/shm.h and linux/resource.h

strace-4.5.15 uses linux/a.out.h in #ifdef LINUXSPARC

glibc uses asm/elf.h in sys/procfs.h, also in alpha and powerpc.

kexec-tools use linux/elf.h

psmisc and ltrace use linux/user.h
glibc (for sh) and mono-debugger use asm/user.h

And alot of asm/page.h users.

Thats the upstream status today. What you do at home doesnt really
matter.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-15 Thread Mike Frysinger

On 7/15/07, Olaf Hering <[EMAIL PROTECTED]> wrote:

On Sat, Jul 14, Mike Frysinger wrote:
> imo, asm/page.h should just go away for userspace.  the attached patch
> is what i've been using in Gentoo ... but somethings (like an arch or
> two in glibc) still assume asm/page.h is OK.  in general though,
> considering asm/page.h has become so unreliable lately (a large number
> of arches ifdef the whole thing out), most packages out there have
> updated already to use the userspace interface from unistd.h.

You need that signed-off thing, and dont forget to send it to
[EMAIL PROTECTED]


i honestly didnt think people would consider it for inclusion as it
was since i ripped out a lot more headers than just asm/page.h ;)

Signed-off-by: Mike Frysinger <[EMAIL PROTECTED]>
-mike
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-15 Thread Olaf Hering
On Sat, Jul 14, Mike Frysinger wrote:

> imo, asm/page.h should just go away for userspace.  the attached patch
> is what i've been using in Gentoo ... but somethings (like an arch or
> two in glibc) still assume asm/page.h is OK.  in general though,
> considering asm/page.h has become so unreliable lately (a large number
> of arches ifdef the whole thing out), most packages out there have
> updated already to use the userspace interface from unistd.h.

You need that signed-off thing, and dont forget to send it to
[EMAIL PROTECTED]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-15 Thread Olaf Hering
On Sat, Jul 14, Mike Frysinger wrote:

 imo, asm/page.h should just go away for userspace.  the attached patch
 is what i've been using in Gentoo ... but somethings (like an arch or
 two in glibc) still assume asm/page.h is OK.  in general though,
 considering asm/page.h has become so unreliable lately (a large number
 of arches ifdef the whole thing out), most packages out there have
 updated already to use the userspace interface from unistd.h.

You need that signed-off thing, and dont forget to send it to
[EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-15 Thread Mike Frysinger

On 7/15/07, Olaf Hering [EMAIL PROTECTED] wrote:

On Sat, Jul 14, Mike Frysinger wrote:
 imo, asm/page.h should just go away for userspace.  the attached patch
 is what i've been using in Gentoo ... but somethings (like an arch or
 two in glibc) still assume asm/page.h is OK.  in general though,
 considering asm/page.h has become so unreliable lately (a large number
 of arches ifdef the whole thing out), most packages out there have
 updated already to use the userspace interface from unistd.h.

You need that signed-off thing, and dont forget to send it to
[EMAIL PROTECTED]


i honestly didnt think people would consider it for inclusion as it
was since i ripped out a lot more headers than just asm/page.h ;)

Signed-off-by: Mike Frysinger [EMAIL PROTECTED]
-mike
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-15 Thread Olaf Hering
On Sat, Jul 14, Mike Frysinger wrote:

 On 7/14/07, Olaf Hering [EMAIL PROTECTED] wrote:
 Declare PAGE_SIZE as getpagesize() for userspace.
 PAGE_SIZE is used in resource.h and shm.h
 
 define PAGE_SIZE in asm-generic/page.h
 guard get_order() with _ARCH_HAS_GET_ORDER for ia64 and xtensa
 include asm-generic/page.h in asm/page.h
 make asm/page.h nearly empty by moving the #ifdef guards up
 remove unneeded page.h export from frv
 
 imo, asm/page.h should just go away for userspace.  the attached patch
 is what i've been using in Gentoo ... but somethings (like an arch or
 two in glibc) still assume asm/page.h is OK.  in general though,
 considering asm/page.h has become so unreliable lately (a large number
 of arches ifdef the whole thing out), most packages out there have
 updated already to use the userspace interface from unistd.h.
 -mike

nothing appears to use linux/shm.h and linux/resource.h

strace-4.5.15 uses linux/a.out.h in #ifdef LINUXSPARC

glibc uses asm/elf.h in sys/procfs.h, also in alpha and powerpc.

kexec-tools use linux/elf.h

psmisc and ltrace use linux/user.h
glibc (for sh) and mono-debugger use asm/user.h

And alot of asm/page.h users.

Thats the upstream status today. What you do at home doesnt really
matter.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-15 Thread David Woodhouse
On Sat, 2007-07-14 at 23:34 +0200, Olaf Hering wrote:
  I would think it would be better to not define it at all.  Several
  architectures already don't have PAGE_SIZE visible to userspace in 
  any way.
 
 i386 has it, so everyone uses it.

PowerPC lacks it, so nothing we ship in Fedora relies upon it.

Just kill it. Probably by leaving asm/page.h empty for now; we can
remove it completely later.

-- 
dwmw2

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-15 Thread David Woodhouse
On Sun, 2007-07-15 at 02:20 -0500, Mike Frysinger wrote:
 i honestly didnt think people would consider it for inclusion as it
 was since i ripped out a lot more headers than just asm/page.h ;)

So split it up into individual patches. It all looks good to me.

-- 
dwmw2

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-14 Thread Albert Cahalan

On 7/14/07, David Miller <[EMAIL PROTECTED]> wrote:

From: "Albert Cahalan" <[EMAIL PROTECTED]>
Date: Sat, 14 Jul 2007 22:48:57 -0400

> A real constant-value PAGE_SIZE is useful and doable.

It's bogus to use it.  The kernel can get recompiled
to arbitrary page sizes on some architectures, so a constat
page size assumption cannot work.


Sure it can work. The ABI specifies limits on such things.
Probably the most appropriate size is the one specified
for alignment of ELF sections.

If I remember right, it's 64 K for the PowerPC ABI. This allows
for 64 K pages, even though many chips offer 4 K pages.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-14 Thread David Miller
From: "Albert Cahalan" <[EMAIL PROTECTED]>
Date: Sat, 14 Jul 2007 22:48:57 -0400

> A real constant-value PAGE_SIZE is useful and doable.

It's bogus to use it.  The kernel can get recompiled
to arbitrary page sizes on some architectures, so a constat
page size assumption cannot work.

> It's useful because a getpagesize() can't be used for numerous
> things, such as setting the size of an array.

Use dynamically allocated memory for the array then.

This isn't programming 101.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-14 Thread H. Peter Anvin
Albert Cahalan wrote:
> 
> A real constant-value PAGE_SIZE is useful and doable.
> 
> It's useful because a getpagesize() can't be used for numerous
> things, such as setting the size of an array.
> 
> It's doable, even on architectures that support multiple page
> sizes, because ABIs specify alignment requirements. There are
> two alignments of interest here:
> 
> a. the smallest that mmap() will ever naturally return on any
>   correct implementation of the architecture's ABI ("naturally"
>   meaning that MAP_FIXED was not used)
> 
> b. the smallest that mprotect() will tolerate on all
>   correct implementations of the architecture
> 
> Pick either to be the Linux definition of PAGE_SIZE.
> 

If you specify it to be one of these, people will mis-use it for the
other.  This is a bad idea.

-hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-14 Thread Albert Cahalan

Olaf Hering writes:

On Sat, Jul 14, H. Peter Anvin wrote:

Olaf Hering wrote:



Declare PAGE_SIZE as getpagesize() for userspace.
PAGE_SIZE is used in resource.h and shm.h


I would think it would be better to not define it at all.
Several architectures already don't have PAGE_SIZE visible
to userspace in any way.


i386 has it, so everyone uses it.


Since i386 was the first architecture and is still probably the
most common architecture (x86_64 being 30% AFAIK), i386 sets the
standard for the Linux API. Several architectures are broken and
thus suffering from incompatibility.

A real constant-value PAGE_SIZE is useful and doable.

It's useful because a getpagesize() can't be used for numerous
things, such as setting the size of an array.

It's doable, even on architectures that support multiple page
sizes, because ABIs specify alignment requirements. There are
two alignments of interest here:

a. the smallest that mmap() will ever naturally return on any
  correct implementation of the architecture's ABI ("naturally"
  meaning that MAP_FIXED was not used)

b. the smallest that mprotect() will tolerate on all
  correct implementations of the architecture

Pick either to be the Linux definition of PAGE_SIZE.

For example, if an architecture is specified to have a page size
of at least 4 K but no more than 64 K, then mprotect() will only
tolerate 64 K on all correct implementations of the architecture.
The ABI might allow mmap() to naturally return 4 K aligned data,
but might instead require 64 K alignment. Assuming 4 K, then the
mmap() value doesn't match the mprotect() value. Either one will
do as the value of PAGE_SIZE, as long as this is standardized in
the way that breaks the least code.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-14 Thread Mike Frysinger

On 7/14/07, Olaf Hering <[EMAIL PROTECTED]> wrote:

On Sat, Jul 14, H. Peter Anvin wrote:
> Olaf Hering wrote:
> > Declare PAGE_SIZE as getpagesize() for userspace.
> > PAGE_SIZE is used in resource.h and shm.h
>
> I would think it would be better to not define it at all.  Several
> architectures already don't have PAGE_SIZE visible to userspace in any way.

i386 has it, so everyone uses it.


not anymore ... it's broken too many other architectures so anything
that matters has switched off of it


asm/user.h uses it for NBPG, which appears in gdb configure scripts.
Maybe it doesnt trigger there because the sysconf SC_* macros match.


the sourceware tree (binutils/gdb/etc...) bend over backwards to get a
usable definition so not having NBPG available is fine ... there's one
thing left which needs fixing and i have a patch that i need to commit
for that


other places where asm/page.h is used:
util-linux configure scripts, strace, xorg-11, and alot more.
Have to check if they really need it.


those three packages you quote here i know have been fixed in the
latest versions
-mike
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-14 Thread Mikael Pettersson
On Sat, 14 Jul 2007 14:12:57 -0700, H. Peter Anvin wrote:
> Olaf Hering wrote:
> > Declare PAGE_SIZE as getpagesize() for userspace.
> > PAGE_SIZE is used in resource.h and shm.h
> 
> I would think it would be better to not define it at all.  Several
> architectures already don't have PAGE_SIZE visible to userspace in any way.

Furthermore, the kernel should /not/ export a would-be kernel
interface by defining it in terms of a non-kernel interface.
getpagesize() belongs to libc, and might not exist at all or
have that form.

Linux is not Solaris. There can be many different libcs in a system.

/Mikael
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-14 Thread Olaf Hering
On Sat, Jul 14, H. Peter Anvin wrote:

> Olaf Hering wrote:
> > Declare PAGE_SIZE as getpagesize() for userspace.
> > PAGE_SIZE is used in resource.h and shm.h
> 
> I would think it would be better to not define it at all.  Several
> architectures already don't have PAGE_SIZE visible to userspace in any way.

i386 has it, so everyone uses it.

asm/user.h uses it for NBPG, which appears in gdb configure scripts.
Maybe it doesnt trigger there because the sysconf SC_* macros match.

other places where asm/page.h is used:
util-linux configure scripts, strace, xorg-11, and alot more.
Have to check if they really need it.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-14 Thread H. Peter Anvin
Olaf Hering wrote:
> Declare PAGE_SIZE as getpagesize() for userspace.
> PAGE_SIZE is used in resource.h and shm.h

I would think it would be better to not define it at all.  Several
architectures already don't have PAGE_SIZE visible to userspace in any way.

-hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-14 Thread Mike Frysinger

On 7/14/07, Olaf Hering <[EMAIL PROTECTED]> wrote:

Declare PAGE_SIZE as getpagesize() for userspace.
PAGE_SIZE is used in resource.h and shm.h

define PAGE_SIZE in asm-generic/page.h
guard get_order() with _ARCH_HAS_GET_ORDER for ia64 and xtensa
include asm-generic/page.h in asm/page.h
make asm/page.h nearly empty by moving the #ifdef guards up
remove unneeded page.h export from frv


imo, asm/page.h should just go away for userspace.  the attached patch
is what i've been using in Gentoo ... but somethings (like an arch or
two in glibc) still assume asm/page.h is OK.  in general though,
considering asm/page.h has become so unreliable lately (a large number
of arches ifdef the whole thing out), most packages out there have
updated already to use the userspace interface from unistd.h.
-mike


10_all_remove-page-user-headers.patch
Description: Binary data


[PATCH] remove PAGE_SIZE from headers_install

2007-07-14 Thread Olaf Hering

Declare PAGE_SIZE as getpagesize() for userspace.
PAGE_SIZE is used in resource.h and shm.h

define PAGE_SIZE in asm-generic/page.h
guard get_order() with _ARCH_HAS_GET_ORDER for ia64 and xtensa
include asm-generic/page.h in asm/page.h
make asm/page.h nearly empty by moving the #ifdef guards up
remove unneeded page.h export from frv


Signed-off-by: Olaf Hering <[EMAIL PROTECTED]>

---
 include/asm-alpha/page.h |3 ++-
 include/asm-arm/page.h   |4 ++--
 include/asm-arm26/page.h |2 --
 include/asm-avr32/page.h |2 ++
 include/asm-blackfin/page.h  |6 +++---
 include/asm-cris/page.h  |3 ++-
 include/asm-frv/Kbuild   |1 -
 include/asm-frv/page.h   |3 ++-
 include/asm-generic/Kbuild   |1 +
 include/asm-generic/page.h   |6 ++
 include/asm-h8300/page.h |3 ++-
 include/asm-i386/page.h  |5 +++--
 include/asm-ia64/page.h  |6 +-
 include/asm-m32r/page.h  |6 --
 include/asm-m68k/page.h  |4 ++--
 include/asm-m68knommu/page.h |4 ++--
 include/asm-mips/page.h  |3 ++-
 include/asm-parisc/page.h|3 ++-
 include/asm-powerpc/page.h   |4 +++-
 include/asm-ppc/page.h   |2 +-
 include/asm-s390/page.h  |   10 +-
 include/asm-sh/page.h|8 +---
 include/asm-sh64/page.h  |7 ---
 include/asm-sparc/page.h |   13 +++--
 include/asm-sparc64/page.h   |3 ++-
 include/asm-v850/page.h  |   13 +++--
 include/asm-x86_64/page.h|5 +++--
 include/asm-xtensa/page.h|   15 +--
 28 files changed, 88 insertions(+), 57 deletions(-)

--- a/include/asm-alpha/page.h
+++ b/include/asm-alpha/page.h
@@ -94,7 +94,8 @@ typedef unsigned long pgprot_t;
 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
 #include 
+#endif /* __KERNEL__ */
+
 #include 
 
-#endif /* __KERNEL__ */
 #endif /* _ALPHA_PAGE_H */
--- a/include/asm-arm/page.h
+++ b/include/asm-arm/page.h
@@ -190,8 +190,8 @@ typedef unsigned long pgprot_t;
 #define ARCH_SLAB_MINALIGN 8
 #endif
 
-#include 
-
 #endif /* __KERNEL__ */
 
+#include 
+
 #endif
--- a/include/asm-arm26/page.h
+++ b/include/asm-arm26/page.h
@@ -68,7 +68,6 @@ typedef unsigned long pgprot_t;
 
 #endif /* STRICT_MM_TYPECHECKS */
 #endif /* !__ASSEMBLY__ */
-#endif /* __KERNEL__ */
 
 /* PAGE_SHIFT determines the page size.  This is configurable. */
 #if defined(CONFIG_PAGESIZE_16)
@@ -85,7 +84,6 @@ typedef unsigned long pgprot_t;
 /* to align the pointer to the (next) page boundary */
 #define PAGE_ALIGN(addr)   (((addr)+PAGE_SIZE-1)_MASK)
 
-#ifdef __KERNEL__
 #ifndef __ASSEMBLY__
 
 #include 
--- a/include/asm-avr32/page.h
+++ b/include/asm-avr32/page.h
@@ -109,4 +109,6 @@ static inline int get_order(unsigned lon
 
 #endif /* __KERNEL__ */
 
+#include 
+
 #endif /* __ASM_AVR32_PAGE_H */
--- a/include/asm-blackfin/page.h
+++ b/include/asm-blackfin/page.h
@@ -1,5 +1,6 @@
 #ifndef _BLACKFIN_PAGE_H
 #define _BLACKFIN_PAGE_H
+#ifdef __KERNEL__
 
 /* PAGE_SHIFT determines the page size */
 
@@ -11,7 +12,6 @@
 #endif
 #define PAGE_MASK  (~(PAGE_SIZE-1))
 
-#ifdef __KERNEL__
 
 #include 
 
@@ -85,9 +85,9 @@ extern unsigned long memory_end;
 #definevirt_addr_valid(kaddr)  (((void *)(kaddr) >= (void 
*)PAGE_OFFSET) && \
((void *)(kaddr) < (void *)memory_end))
 
-#include 
-
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL__ */
 
+#include 
+
 #endif /* _BLACKFIN_PAGE_H */
--- a/include/asm-cris/page.h
+++ b/include/asm-cris/page.h
@@ -74,9 +74,10 @@ typedef struct { unsigned long pgprot; }
 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
 #include 
-#include 
 
 #endif /* __KERNEL__ */
 
+#include 
+
 #endif /* _CRIS_PAGE_H */
 
--- a/include/asm-frv/Kbuild
+++ b/include/asm-frv/Kbuild
@@ -4,4 +4,3 @@ header-y += registers.h
 
 unifdef-y += termios.h
 unifdef-y += ptrace.h
-unifdef-y += page.h
--- a/include/asm-frv/page.h
+++ b/include/asm-frv/page.h
@@ -81,8 +81,9 @@ extern unsigned long max_pfn;
 #endif
 
 #include 
-#include 
 
 #endif /* __KERNEL__ */
 
+#include 
+
 #endif /* _ASM_PAGE_H */
--- a/include/asm-generic/Kbuild
+++ b/include/asm-generic/Kbuild
@@ -8,5 +8,6 @@ header-y += poll.h
 header-y += signal.h
 header-y += statfs.h
 
+unifdef-y += page.h
 unifdef-y += resource.h
 unifdef-y += siginfo.h
--- a/include/asm-generic/page.h
+++ b/include/asm-generic/page.h
@@ -6,6 +6,7 @@
 
 #include 
 
+#ifndef _ARCH_HAS_GET_ORDER
 /* Pure 2^n version of get_order */
 static __inline__ __attribute_const__ int get_order(unsigned long size)
 {
@@ -19,8 +20,13 @@ static __inline__ __attribute_const__ in
} while (size);
return order;
 }
+#endif
 
 #endif /* __ASSEMBLY__ */
+#else
+
+#define PAGE_SIZE (getpagesize())
+
 #endif /* __KERNEL__ */
 
 #endif /* _ASM_GENERIC_PAGE_H */
--- a/include/asm-h8300/page.h
+++ 

[PATCH] remove PAGE_SIZE from headers_install

2007-07-14 Thread Olaf Hering

Declare PAGE_SIZE as getpagesize() for userspace.
PAGE_SIZE is used in resource.h and shm.h

define PAGE_SIZE in asm-generic/page.h
guard get_order() with _ARCH_HAS_GET_ORDER for ia64 and xtensa
include asm-generic/page.h in asm/page.h
make asm/page.h nearly empty by moving the #ifdef guards up
remove unneeded page.h export from frv


Signed-off-by: Olaf Hering [EMAIL PROTECTED]

---
 include/asm-alpha/page.h |3 ++-
 include/asm-arm/page.h   |4 ++--
 include/asm-arm26/page.h |2 --
 include/asm-avr32/page.h |2 ++
 include/asm-blackfin/page.h  |6 +++---
 include/asm-cris/page.h  |3 ++-
 include/asm-frv/Kbuild   |1 -
 include/asm-frv/page.h   |3 ++-
 include/asm-generic/Kbuild   |1 +
 include/asm-generic/page.h   |6 ++
 include/asm-h8300/page.h |3 ++-
 include/asm-i386/page.h  |5 +++--
 include/asm-ia64/page.h  |6 +-
 include/asm-m32r/page.h  |6 --
 include/asm-m68k/page.h  |4 ++--
 include/asm-m68knommu/page.h |4 ++--
 include/asm-mips/page.h  |3 ++-
 include/asm-parisc/page.h|3 ++-
 include/asm-powerpc/page.h   |4 +++-
 include/asm-ppc/page.h   |2 +-
 include/asm-s390/page.h  |   10 +-
 include/asm-sh/page.h|8 +---
 include/asm-sh64/page.h  |7 ---
 include/asm-sparc/page.h |   13 +++--
 include/asm-sparc64/page.h   |3 ++-
 include/asm-v850/page.h  |   13 +++--
 include/asm-x86_64/page.h|5 +++--
 include/asm-xtensa/page.h|   15 +--
 28 files changed, 88 insertions(+), 57 deletions(-)

--- a/include/asm-alpha/page.h
+++ b/include/asm-alpha/page.h
@@ -94,7 +94,8 @@ typedef unsigned long pgprot_t;
 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
 #include asm-generic/memory_model.h
+#endif /* __KERNEL__ */
+
 #include asm-generic/page.h
 
-#endif /* __KERNEL__ */
 #endif /* _ALPHA_PAGE_H */
--- a/include/asm-arm/page.h
+++ b/include/asm-arm/page.h
@@ -190,8 +190,8 @@ typedef unsigned long pgprot_t;
 #define ARCH_SLAB_MINALIGN 8
 #endif
 
-#include asm-generic/page.h
-
 #endif /* __KERNEL__ */
 
+#include asm-generic/page.h
+
 #endif
--- a/include/asm-arm26/page.h
+++ b/include/asm-arm26/page.h
@@ -68,7 +68,6 @@ typedef unsigned long pgprot_t;
 
 #endif /* STRICT_MM_TYPECHECKS */
 #endif /* !__ASSEMBLY__ */
-#endif /* __KERNEL__ */
 
 /* PAGE_SHIFT determines the page size.  This is configurable. */
 #if defined(CONFIG_PAGESIZE_16)
@@ -85,7 +84,6 @@ typedef unsigned long pgprot_t;
 /* to align the pointer to the (next) page boundary */
 #define PAGE_ALIGN(addr)   (((addr)+PAGE_SIZE-1)PAGE_MASK)
 
-#ifdef __KERNEL__
 #ifndef __ASSEMBLY__
 
 #include asm/memory.h
--- a/include/asm-avr32/page.h
+++ b/include/asm-avr32/page.h
@@ -109,4 +109,6 @@ static inline int get_order(unsigned lon
 
 #endif /* __KERNEL__ */
 
+#include asm-generic/page.h
+
 #endif /* __ASM_AVR32_PAGE_H */
--- a/include/asm-blackfin/page.h
+++ b/include/asm-blackfin/page.h
@@ -1,5 +1,6 @@
 #ifndef _BLACKFIN_PAGE_H
 #define _BLACKFIN_PAGE_H
+#ifdef __KERNEL__
 
 /* PAGE_SHIFT determines the page size */
 
@@ -11,7 +12,6 @@
 #endif
 #define PAGE_MASK  (~(PAGE_SIZE-1))
 
-#ifdef __KERNEL__
 
 #include asm/setup.h
 
@@ -85,9 +85,9 @@ extern unsigned long memory_end;
 #definevirt_addr_valid(kaddr)  (((void *)(kaddr) = (void 
*)PAGE_OFFSET)  \
((void *)(kaddr)  (void *)memory_end))
 
-#include asm-generic/page.h
-
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL__ */
 
+#include asm-generic/page.h
+
 #endif /* _BLACKFIN_PAGE_H */
--- a/include/asm-cris/page.h
+++ b/include/asm-cris/page.h
@@ -74,9 +74,10 @@ typedef struct { unsigned long pgprot; }
 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
 #include asm-generic/memory_model.h
-#include asm-generic/page.h
 
 #endif /* __KERNEL__ */
 
+#include asm-generic/page.h
+
 #endif /* _CRIS_PAGE_H */
 
--- a/include/asm-frv/Kbuild
+++ b/include/asm-frv/Kbuild
@@ -4,4 +4,3 @@ header-y += registers.h
 
 unifdef-y += termios.h
 unifdef-y += ptrace.h
-unifdef-y += page.h
--- a/include/asm-frv/page.h
+++ b/include/asm-frv/page.h
@@ -81,8 +81,9 @@ extern unsigned long max_pfn;
 #endif
 
 #include asm-generic/memory_model.h
-#include asm-generic/page.h
 
 #endif /* __KERNEL__ */
 
+#include asm-generic/page.h
+
 #endif /* _ASM_PAGE_H */
--- a/include/asm-generic/Kbuild
+++ b/include/asm-generic/Kbuild
@@ -8,5 +8,6 @@ header-y += poll.h
 header-y += signal.h
 header-y += statfs.h
 
+unifdef-y += page.h
 unifdef-y += resource.h
 unifdef-y += siginfo.h
--- a/include/asm-generic/page.h
+++ b/include/asm-generic/page.h
@@ -6,6 +6,7 @@
 
 #include linux/compiler.h
 
+#ifndef _ARCH_HAS_GET_ORDER
 /* Pure 2^n version of get_order */
 static __inline__ __attribute_const__ int get_order(unsigned long size)
 {

Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-14 Thread Mike Frysinger

On 7/14/07, Olaf Hering [EMAIL PROTECTED] wrote:

Declare PAGE_SIZE as getpagesize() for userspace.
PAGE_SIZE is used in resource.h and shm.h

define PAGE_SIZE in asm-generic/page.h
guard get_order() with _ARCH_HAS_GET_ORDER for ia64 and xtensa
include asm-generic/page.h in asm/page.h
make asm/page.h nearly empty by moving the #ifdef guards up
remove unneeded page.h export from frv


imo, asm/page.h should just go away for userspace.  the attached patch
is what i've been using in Gentoo ... but somethings (like an arch or
two in glibc) still assume asm/page.h is OK.  in general though,
considering asm/page.h has become so unreliable lately (a large number
of arches ifdef the whole thing out), most packages out there have
updated already to use the userspace interface from unistd.h.
-mike


10_all_remove-page-user-headers.patch
Description: Binary data


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-14 Thread H. Peter Anvin
Olaf Hering wrote:
 Declare PAGE_SIZE as getpagesize() for userspace.
 PAGE_SIZE is used in resource.h and shm.h

I would think it would be better to not define it at all.  Several
architectures already don't have PAGE_SIZE visible to userspace in any way.

-hpa
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-14 Thread Olaf Hering
On Sat, Jul 14, H. Peter Anvin wrote:

 Olaf Hering wrote:
  Declare PAGE_SIZE as getpagesize() for userspace.
  PAGE_SIZE is used in resource.h and shm.h
 
 I would think it would be better to not define it at all.  Several
 architectures already don't have PAGE_SIZE visible to userspace in any way.

i386 has it, so everyone uses it.

asm/user.h uses it for NBPG, which appears in gdb configure scripts.
Maybe it doesnt trigger there because the sysconf SC_* macros match.

other places where asm/page.h is used:
util-linux configure scripts, strace, xorg-11, and alot more.
Have to check if they really need it.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-14 Thread Mikael Pettersson
On Sat, 14 Jul 2007 14:12:57 -0700, H. Peter Anvin wrote:
 Olaf Hering wrote:
  Declare PAGE_SIZE as getpagesize() for userspace.
  PAGE_SIZE is used in resource.h and shm.h
 
 I would think it would be better to not define it at all.  Several
 architectures already don't have PAGE_SIZE visible to userspace in any way.

Furthermore, the kernel should /not/ export a would-be kernel
interface by defining it in terms of a non-kernel interface.
getpagesize() belongs to libc, and might not exist at all or
have that form.

Linux is not Solaris. There can be many different libcs in a system.

/Mikael
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-14 Thread Mike Frysinger

On 7/14/07, Olaf Hering [EMAIL PROTECTED] wrote:

On Sat, Jul 14, H. Peter Anvin wrote:
 Olaf Hering wrote:
  Declare PAGE_SIZE as getpagesize() for userspace.
  PAGE_SIZE is used in resource.h and shm.h

 I would think it would be better to not define it at all.  Several
 architectures already don't have PAGE_SIZE visible to userspace in any way.

i386 has it, so everyone uses it.


not anymore ... it's broken too many other architectures so anything
that matters has switched off of it


asm/user.h uses it for NBPG, which appears in gdb configure scripts.
Maybe it doesnt trigger there because the sysconf SC_* macros match.


the sourceware tree (binutils/gdb/etc...) bend over backwards to get a
usable definition so not having NBPG available is fine ... there's one
thing left which needs fixing and i have a patch that i need to commit
for that


other places where asm/page.h is used:
util-linux configure scripts, strace, xorg-11, and alot more.
Have to check if they really need it.


those three packages you quote here i know have been fixed in the
latest versions
-mike
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-14 Thread Albert Cahalan

Olaf Hering writes:

On Sat, Jul 14, H. Peter Anvin wrote:

Olaf Hering wrote:



Declare PAGE_SIZE as getpagesize() for userspace.
PAGE_SIZE is used in resource.h and shm.h


I would think it would be better to not define it at all.
Several architectures already don't have PAGE_SIZE visible
to userspace in any way.


i386 has it, so everyone uses it.


Since i386 was the first architecture and is still probably the
most common architecture (x86_64 being 30% AFAIK), i386 sets the
standard for the Linux API. Several architectures are broken and
thus suffering from incompatibility.

A real constant-value PAGE_SIZE is useful and doable.

It's useful because a getpagesize() can't be used for numerous
things, such as setting the size of an array.

It's doable, even on architectures that support multiple page
sizes, because ABIs specify alignment requirements. There are
two alignments of interest here:

a. the smallest that mmap() will ever naturally return on any
  correct implementation of the architecture's ABI (naturally
  meaning that MAP_FIXED was not used)

b. the smallest that mprotect() will tolerate on all
  correct implementations of the architecture

Pick either to be the Linux definition of PAGE_SIZE.

For example, if an architecture is specified to have a page size
of at least 4 K but no more than 64 K, then mprotect() will only
tolerate 64 K on all correct implementations of the architecture.
The ABI might allow mmap() to naturally return 4 K aligned data,
but might instead require 64 K alignment. Assuming 4 K, then the
mmap() value doesn't match the mprotect() value. Either one will
do as the value of PAGE_SIZE, as long as this is standardized in
the way that breaks the least code.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-14 Thread H. Peter Anvin
Albert Cahalan wrote:
 
 A real constant-value PAGE_SIZE is useful and doable.
 
 It's useful because a getpagesize() can't be used for numerous
 things, such as setting the size of an array.
 
 It's doable, even on architectures that support multiple page
 sizes, because ABIs specify alignment requirements. There are
 two alignments of interest here:
 
 a. the smallest that mmap() will ever naturally return on any
   correct implementation of the architecture's ABI (naturally
   meaning that MAP_FIXED was not used)
 
 b. the smallest that mprotect() will tolerate on all
   correct implementations of the architecture
 
 Pick either to be the Linux definition of PAGE_SIZE.
 

If you specify it to be one of these, people will mis-use it for the
other.  This is a bad idea.

-hpa
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-14 Thread David Miller
From: Albert Cahalan [EMAIL PROTECTED]
Date: Sat, 14 Jul 2007 22:48:57 -0400

 A real constant-value PAGE_SIZE is useful and doable.

It's bogus to use it.  The kernel can get recompiled
to arbitrary page sizes on some architectures, so a constat
page size assumption cannot work.

 It's useful because a getpagesize() can't be used for numerous
 things, such as setting the size of an array.

Use dynamically allocated memory for the array then.

This isn't programming 101.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove PAGE_SIZE from headers_install

2007-07-14 Thread Albert Cahalan

On 7/14/07, David Miller [EMAIL PROTECTED] wrote:

From: Albert Cahalan [EMAIL PROTECTED]
Date: Sat, 14 Jul 2007 22:48:57 -0400

 A real constant-value PAGE_SIZE is useful and doable.

It's bogus to use it.  The kernel can get recompiled
to arbitrary page sizes on some architectures, so a constat
page size assumption cannot work.


Sure it can work. The ABI specifies limits on such things.
Probably the most appropriate size is the one specified
for alignment of ELF sections.

If I remember right, it's 64 K for the PowerPC ABI. This allows
for 64 K pages, even though many chips offer 4 K pages.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/