diff mbox

[1/3] powerpc: Move 64bit VDSO to improve context switch performance

Message ID m2ocoo1qfi.fsf@igel.home (mailing list archive)
State Superseded
Delegated to: Benjamin Herrenschmidt
Headers show

Commit Message

Andreas Schwab Oct. 3, 2009, 2:51 p.m. UTC
Andreas Schwab <schwab@linux-m68k.org> writes:

> Andreas Schwab <schwab@linux-m68k.org> writes:
>
>> Anton Blanchard <anton@samba.org> writes:
>>
>>> On 64bit applications the VDSO is the only thing in segment 0. Since the VDSO
>>> is position independent we can remove the hint and let get_unmapped_area pick
>>> an area.
>>
>> This breaks gdb.  The section table in the VDSO image when mapped into
>> the process no longer contains meaningful values, and gdb rejects it.
>
> The problem is that the load segment requires 64k alignment, but the
> page allocater of course only provides PAGE_SIZE alignment, causing the
> image to be unaligned in memory.

Here is a patch.  The disadvantage is that now gdb complains that the
vdso does not contain section headers, because they are no longer
covered by the load segment.

Andreas.
---
From 003c323c753d8717e58220c9560329882bcfa2c2 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@linux-m68k.org>
Date: Sat, 3 Oct 2009 16:46:45 +0200
Subject: [PATCH] powerpc: fix unaligned load segment in vdso64

Since the page allocator can only guarantee PAGE_SIZE alignment the load
segment in the vdso object cannot claim more than that alignment.  Use 4k
alignment which is the minimum possible page size.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
---
 arch/powerpc/kernel/vdso64/Makefile |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

Benjamin Herrenschmidt Oct. 3, 2009, 9:53 p.m. UTC | #1
On Sat, 2009-10-03 at 16:51 +0200, Andreas Schwab wrote:
> Andreas Schwab <schwab@linux-m68k.org> writes:
> 
> > Andreas Schwab <schwab@linux-m68k.org> writes:
> >
> >> Anton Blanchard <anton@samba.org> writes:
> >>
> >>> On 64bit applications the VDSO is the only thing in segment 0. Since the VDSO
> >>> is position independent we can remove the hint and let get_unmapped_area pick
> >>> an area.
> >>
> >> This breaks gdb.  The section table in the VDSO image when mapped into
> >> the process no longer contains meaningful values, and gdb rejects it.
> >
> > The problem is that the load segment requires 64k alignment, but the
> > page allocater of course only provides PAGE_SIZE alignment, causing the
> > image to be unaligned in memory.
> 
> Here is a patch.  The disadvantage is that now gdb complains that the
> vdso does not contain section headers, because they are no longer
> covered by the load segment.

Maybe a better fix is to force alignment in the kernel by requesting
size + 64k - 4k and aligning it.

Ben.

> Andreas.
> ---
> >From 003c323c753d8717e58220c9560329882bcfa2c2 Mon Sep 17 00:00:00 2001
> From: Andreas Schwab <schwab@linux-m68k.org>
> Date: Sat, 3 Oct 2009 16:46:45 +0200
> Subject: [PATCH] powerpc: fix unaligned load segment in vdso64
> 
> Since the page allocator can only guarantee PAGE_SIZE alignment the load
> segment in the vdso object cannot claim more than that alignment.  Use 4k
> alignment which is the minimum possible page size.
> 
> Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
> ---
>  arch/powerpc/kernel/vdso64/Makefile |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/vdso64/Makefile b/arch/powerpc/kernel/vdso64/Makefile
> index 79da65d..d4be303 100644
> --- a/arch/powerpc/kernel/vdso64/Makefile
> +++ b/arch/powerpc/kernel/vdso64/Makefile
> @@ -10,7 +10,9 @@ obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
>  GCOV_PROFILE := n
>  
>  EXTRA_CFLAGS := -shared -fno-common -fno-builtin
> +# Force maximum page size of 4k so that it works with any page size
>  EXTRA_CFLAGS += -nostdlib -Wl,-soname=linux-vdso64.so.1 \
> +		-Wl,-z,max-page-size=4096 \
>  		$(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
>  EXTRA_AFLAGS := -D__VDSO64__ -s
>  
> -- 
> 1.6.4.4
> 
>
diff mbox

Patch

diff --git a/arch/powerpc/kernel/vdso64/Makefile b/arch/powerpc/kernel/vdso64/Makefile
index 79da65d..d4be303 100644
--- a/arch/powerpc/kernel/vdso64/Makefile
+++ b/arch/powerpc/kernel/vdso64/Makefile
@@ -10,7 +10,9 @@  obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
 GCOV_PROFILE := n
 
 EXTRA_CFLAGS := -shared -fno-common -fno-builtin
+# Force maximum page size of 4k so that it works with any page size
 EXTRA_CFLAGS += -nostdlib -Wl,-soname=linux-vdso64.so.1 \
+		-Wl,-z,max-page-size=4096 \
 		$(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
 EXTRA_AFLAGS := -D__VDSO64__ -s