* x86_64 has 2 x arch_vma_name() - can we drop one?
@ 2007-07-25 18:31 Sam Ravnborg
2007-07-25 20:59 ` Sam Ravnborg
0 siblings, 1 reply; 4+ messages in thread
From: Sam Ravnborg @ 2007-07-25 18:31 UTC (permalink / raw)
To: Andi Kleen, LKML; +Cc: Nathan Lynch, Andy Whitcroft
In include/linux/mm.h arch_vma_name() is declared __weak.
This hide the fact that x86_64 has 2 implementations of
said function.
In arch/x86_64/mm/init.c:
const char *arch_vma_name(struct vm_area_struct *vma)
{
if (vma->vm_mm && vma->vm_start == (long)vma->vm_mm->context.vdso)
return "[vdso]";
if (vma == &gate_vma)
return "[vsyscall]";
return NULL;
}
And in arch/x86_64/ia32/syscall32.c:
const char *arch_vma_name(struct vm_area_struct *vma)
{
if (vma->vm_start == VSYSCALL32_BASE &&
vma->vm_mm && vma->vm_mm->task_size == IA32_PAGE_OFFSET)
return "[vdso]";
return NULL;
}
As no comment were preceeding the fucntions this seems not to be on
purpose.
If I am correct which one should die?
The reason why this popped up is that the __weak definition in mm.h
causes problems on at least powerpc (trigger a binutils bug).
A similar bug is present at ia64 - but I have not confirmed if the
same fix is needed.
Sam
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: x86_64 has 2 x arch_vma_name() - can we drop one?
2007-07-25 18:31 x86_64 has 2 x arch_vma_name() - can we drop one? Sam Ravnborg
@ 2007-07-25 20:59 ` Sam Ravnborg
2007-07-25 21:23 ` Roland McGrath
0 siblings, 1 reply; 4+ messages in thread
From: Sam Ravnborg @ 2007-07-25 20:59 UTC (permalink / raw)
To: Andi Kleen, LKML
Cc: Nathan Lynch, Andy Whitcroft, Andrew Morton, Roland McGrath
On Wed, Jul 25, 2007 at 08:31:32PM +0200, Sam Ravnborg wrote:
> In include/linux/mm.h arch_vma_name() is declared __weak.
> This hide the fact that x86_64 has 2 implementations of
> said function.
>
> In arch/x86_64/mm/init.c:
> const char *arch_vma_name(struct vm_area_struct *vma)
> {
> if (vma->vm_mm && vma->vm_start == (long)vma->vm_mm->context.vdso)
> return "[vdso]";
> if (vma == &gate_vma)
> return "[vsyscall]";
> return NULL;
> }
>
> And in arch/x86_64/ia32/syscall32.c:
> const char *arch_vma_name(struct vm_area_struct *vma)
> {
> if (vma->vm_start == VSYSCALL32_BASE &&
> vma->vm_mm && vma->vm_mm->task_size == IA32_PAGE_OFFSET)
> return "[vdso]";
> return NULL;
> }
>
> As no comment were preceeding the fucntions this seems not to be on
> purpose.
> If I am correct which one should die?
>
> The reason why this popped up is that the __weak definition in mm.h
> causes problems on at least powerpc (trigger a binutils bug).
> A similar bug is present at ia64 - but I have not confirmed if the
> same fix is needed.
I cooked up following patch - but I do not claim I understand this
code. It was done only by merging the functionality into one function.
I need this patch or a similar one to be added so the weak declaration
of arch_vma_name in mm.h can be made a normal prototype.
Sam
[PATCH] x86_64: merge two identical named funtion into one
The function arch_vma_name() is declared weak and thus it was
not noticed that x86_64 had two almost identical implementations.
It was introduced in syscall32.c by: c633090e3105e779c97d4978e5e3d7d66b291cfb
It was introduced in mm/init.c by: 2aae950b21e4bc789d1fc6668faf67e8748300b7
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roland McGrath <roland@redhat.com>
---
diff --git a/arch/x86_64/ia32/syscall32.c b/arch/x86_64/ia32/syscall32.c
index fc4419f..15013ba 100644
--- a/arch/x86_64/ia32/syscall32.c
+++ b/arch/x86_64/ia32/syscall32.c
@@ -49,14 +49,6 @@ int syscall32_setup_pages(struct linux_binprm *bprm, int exstack)
return ret;
}
-const char *arch_vma_name(struct vm_area_struct *vma)
-{
- if (vma->vm_start == VSYSCALL32_BASE &&
- vma->vm_mm && vma->vm_mm->task_size == IA32_PAGE_OFFSET)
- return "[vdso]";
- return NULL;
-}
-
static int __init init_syscall32(void)
{
char *syscall32_page = (void *)get_zeroed_page(GFP_KERNEL);
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
index 38f5d63..6f608d8 100644
--- a/arch/x86_64/mm/init.c
+++ b/arch/x86_64/mm/init.c
@@ -43,6 +43,7 @@
#include <asm/proto.h>
#include <asm/smp.h>
#include <asm/sections.h>
+#include <asm/vsyscall32.h>
#ifndef Dprintk
#define Dprintk(x...)
@@ -734,6 +735,9 @@ const char *arch_vma_name(struct vm_area_struct *vma)
{
if (vma->vm_mm && vma->vm_start == (long)vma->vm_mm->context.vdso)
return "[vdso]";
+ if (vma->vm_mm && vma->vm_start == VSYSCALL32_BASE &&
+ vma->vm_mm->task_size == IA32_PAGE_OFFSET)
+ return "[vdso]";
if (vma == &gate_vma)
return "[vsyscall]";
return NULL;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: x86_64 has 2 x arch_vma_name() - can we drop one?
2007-07-25 20:59 ` Sam Ravnborg
@ 2007-07-25 21:23 ` Roland McGrath
2007-07-25 21:34 ` Sam Ravnborg
0 siblings, 1 reply; 4+ messages in thread
From: Roland McGrath @ 2007-07-25 21:23 UTC (permalink / raw)
To: Sam Ravnborg
Cc: Andi Kleen, LKML, Nathan Lynch, Andy Whitcroft, Andrew Morton
Your version should work, but I would do it a little differently.
Thanks,
Roland
---
[PATCH] x86_64: fix arch_vma_name
The function arch_vma_name() is declared weak and thus it was
not noticed that x86_64 had two almost identical implementations.
It was introduced in syscall32.c by: c633090e3105e779c97d4978e5e3d7d66b291cfb
It was introduced in mm/init.c by: 2aae950b21e4bc789d1fc6668faf67e8748300b7
Signed-off-by: Roland McGrath <roland@redhat.com>
CC: Sam Ravnborg <sam@ravnborg.org>
---
arch/x86_64/ia32/ia32_binfmt.c | 5 +++--
arch/x86_64/ia32/syscall32.c | 8 --------
2 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/arch/x86_64/ia32/ia32_binfmt.c b/arch/x86_64/ia32/ia32_binfmt.c
index b70f3e7..90b37fc 100644
--- a/arch/x86_64/ia32/ia32_binfmt.c
+++ b/arch/x86_64/ia32/ia32_binfmt.c
@@ -41,8 +41,9 @@ int sysctl_vsyscall32 = 1;
#undef ARCH_DLINFO
#define ARCH_DLINFO do { \
if (sysctl_vsyscall32) { \
- NEW_AUX_ENT(AT_SYSINFO, (u32)(u64)VSYSCALL32_VSYSCALL); \
- NEW_AUX_ENT(AT_SYSINFO_EHDR, VSYSCALL32_BASE); \
+ current->mm->context.vdso = (void *)VSYSCALL32_BASE; \
+ NEW_AUX_ENT(AT_SYSINFO, (u32)(u64)VSYSCALL32_VSYSCALL); \
+ NEW_AUX_ENT(AT_SYSINFO_EHDR, VSYSCALL32_BASE); \
} \
} while(0)
diff --git a/arch/x86_64/ia32/syscall32.c b/arch/x86_64/ia32/syscall32.c
index fc4419f..6df8ec7 100644
--- a/arch/x86_64/ia32/syscall32.c
+++ b/arch/x86_64/ia32/syscall32.c
@@ -49,14 +49,6 @@ int syscall32_setup_pages(struct linux_binprm *bprm, int exstack)
return ret;
}
-const char *arch_vma_name(struct vm_area_struct *vma)
-{
- if (vma->vm_start == VSYSCALL32_BASE &&
- vma->vm_mm && vma->vm_mm->task_size == IA32_PAGE_OFFSET)
- return "[vdso]";
- return NULL;
-}
-
static int __init init_syscall32(void)
{
char *syscall32_page = (void *)get_zeroed_page(GFP_KERNEL);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: x86_64 has 2 x arch_vma_name() - can we drop one?
2007-07-25 21:23 ` Roland McGrath
@ 2007-07-25 21:34 ` Sam Ravnborg
0 siblings, 0 replies; 4+ messages in thread
From: Sam Ravnborg @ 2007-07-25 21:34 UTC (permalink / raw)
To: Roland McGrath
Cc: Andi Kleen, LKML, Nathan Lynch, Andy Whitcroft, Andrew Morton
On Wed, Jul 25, 2007 at 02:23:21PM -0700, Roland McGrath wrote:
> Your version should work, but I would do it a little differently.
Thanks, I hope to get this merged soon so we can fix Powerpc build.
Sam
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-07-25 21:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-25 18:31 x86_64 has 2 x arch_vma_name() - can we drop one? Sam Ravnborg
2007-07-25 20:59 ` Sam Ravnborg
2007-07-25 21:23 ` Roland McGrath
2007-07-25 21:34 ` Sam Ravnborg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®