* [PATCH 1/3] powerpc/vdso: Remove unused debug code
@ 2015-04-22 5:40 Michael Ellerman
2015-04-22 5:40 ` [PATCH 2/3] powerpc/vdso: Combine start/size variables Michael Ellerman
2015-04-22 5:40 ` [PATCH 3/3] powerpc/vdso: Disable building the 32-bit VDSO on little endian Michael Ellerman
0 siblings, 2 replies; 5+ messages in thread
From: Michael Ellerman @ 2015-04-22 5:40 UTC (permalink / raw)
To: linuxppc-dev; +Cc: scottwood, sam.mj, Anton Blanchard
It's in the git history if we ever need it back.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/kernel/vdso.c | 44 --------------------------------------------
1 file changed, 44 deletions(-)
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 305eb0d9b768..869fd0c53280 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -140,50 +140,6 @@ struct lib64_elfinfo
};
-#ifdef __DEBUG
-static void dump_one_vdso_page(struct page *pg, struct page *upg)
-{
- printk("kpg: %p (c:%d,f:%08lx)", __va(page_to_pfn(pg) << PAGE_SHIFT),
- page_count(pg),
- pg->flags);
- if (upg && !IS_ERR(upg) /* && pg != upg*/) {
- printk(" upg: %p (c:%d,f:%08lx)", __va(page_to_pfn(upg)
- << PAGE_SHIFT),
- page_count(upg),
- upg->flags);
- }
- printk("\n");
-}
-
-static void dump_vdso_pages(struct vm_area_struct * vma)
-{
- int i;
-
- if (!vma || is_32bit_task()) {
- printk("vDSO32 @ %016lx:\n", (unsigned long)vdso32_kbase);
- for (i=0; i<vdso32_pages; i++) {
- struct page *pg = virt_to_page(vdso32_kbase +
- i*PAGE_SIZE);
- struct page *upg = (vma && vma->vm_mm) ?
- follow_page(vma, vma->vm_start + i*PAGE_SIZE, 0)
- : NULL;
- dump_one_vdso_page(pg, upg);
- }
- }
- if (!vma || !is_32bit_task()) {
- printk("vDSO64 @ %016lx:\n", (unsigned long)vdso64_kbase);
- for (i=0; i<vdso64_pages; i++) {
- struct page *pg = virt_to_page(vdso64_kbase +
- i*PAGE_SIZE);
- struct page *upg = (vma && vma->vm_mm) ?
- follow_page(vma, vma->vm_start + i*PAGE_SIZE, 0)
- : NULL;
- dump_one_vdso_page(pg, upg);
- }
- }
-}
-#endif /* DEBUG */
-
/*
* This is called from binfmt_elf, we create the special vma for the
* vDSO and insert it into the mm struct tree
--
2.1.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] powerpc/vdso: Combine start/size variables
2015-04-22 5:40 [PATCH 1/3] powerpc/vdso: Remove unused debug code Michael Ellerman
@ 2015-04-22 5:40 ` Michael Ellerman
2015-04-22 5:40 ` [PATCH 3/3] powerpc/vdso: Disable building the 32-bit VDSO on little endian Michael Ellerman
1 sibling, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2015-04-22 5:40 UTC (permalink / raw)
To: linuxppc-dev; +Cc: scottwood, sam.mj, Anton Blanchard
In vdso_fixup_features() we have start64/start32 and size64/size32, but
they have the same types, ie. void * and unsigned long.
They're only used to save the return value from find_sectionXX() for the
subsequent call to do_feature_fixups(), so there's no overlap in their
usage either.
So we can just consolidate them into start/size and avoid the
duplication.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/kernel/vdso.c | 55 ++++++++++++++++++++++------------------------
1 file changed, 26 insertions(+), 29 deletions(-)
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 869fd0c53280..8331d0bef0fb 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -525,55 +525,52 @@ static __init int vdso_fixup_datapage(struct lib32_elfinfo *v32,
static __init int vdso_fixup_features(struct lib32_elfinfo *v32,
struct lib64_elfinfo *v64)
{
- void *start32;
- unsigned long size32;
+ unsigned long size;
+ void *start;
#ifdef CONFIG_PPC64
- void *start64;
- unsigned long size64;
-
- start64 = find_section64(v64->hdr, "__ftr_fixup", &size64);
- if (start64)
+ start = find_section64(v64->hdr, "__ftr_fixup", &size);
+ if (start)
do_feature_fixups(cur_cpu_spec->cpu_features,
- start64, start64 + size64);
+ start, start + size);
- start64 = find_section64(v64->hdr, "__mmu_ftr_fixup", &size64);
- if (start64)
+ start = find_section64(v64->hdr, "__mmu_ftr_fixup", &size);
+ if (start)
do_feature_fixups(cur_cpu_spec->mmu_features,
- start64, start64 + size64);
+ start, start + size);
- start64 = find_section64(v64->hdr, "__fw_ftr_fixup", &size64);
- if (start64)
+ start = find_section64(v64->hdr, "__fw_ftr_fixup", &size);
+ if (start)
do_feature_fixups(powerpc_firmware_features,
- start64, start64 + size64);
+ start, start + size);
- start64 = find_section64(v64->hdr, "__lwsync_fixup", &size64);
- if (start64)
+ start = find_section64(v64->hdr, "__lwsync_fixup", &size);
+ if (start)
do_lwsync_fixups(cur_cpu_spec->cpu_features,
- start64, start64 + size64);
+ start, start + size);
#endif /* CONFIG_PPC64 */
- start32 = find_section32(v32->hdr, "__ftr_fixup", &size32);
- if (start32)
+ start = find_section32(v32->hdr, "__ftr_fixup", &size);
+ if (start)
do_feature_fixups(cur_cpu_spec->cpu_features,
- start32, start32 + size32);
+ start, start + size);
- start32 = find_section32(v32->hdr, "__mmu_ftr_fixup", &size32);
- if (start32)
+ start = find_section32(v32->hdr, "__mmu_ftr_fixup", &size);
+ if (start)
do_feature_fixups(cur_cpu_spec->mmu_features,
- start32, start32 + size32);
+ start, start + size);
#ifdef CONFIG_PPC64
- start32 = find_section32(v32->hdr, "__fw_ftr_fixup", &size32);
- if (start32)
+ start = find_section32(v32->hdr, "__fw_ftr_fixup", &size);
+ if (start)
do_feature_fixups(powerpc_firmware_features,
- start32, start32 + size32);
+ start, start + size);
#endif /* CONFIG_PPC64 */
- start32 = find_section32(v32->hdr, "__lwsync_fixup", &size32);
- if (start32)
+ start = find_section32(v32->hdr, "__lwsync_fixup", &size);
+ if (start)
do_lwsync_fixups(cur_cpu_spec->cpu_features,
- start32, start32 + size32);
+ start, start + size);
return 0;
}
--
2.1.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] powerpc/vdso: Disable building the 32-bit VDSO on little endian
2015-04-22 5:40 [PATCH 1/3] powerpc/vdso: Remove unused debug code Michael Ellerman
2015-04-22 5:40 ` [PATCH 2/3] powerpc/vdso: Combine start/size variables Michael Ellerman
@ 2015-04-22 5:40 ` Michael Ellerman
2015-04-23 3:06 ` Stephen Rothwell
1 sibling, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2015-04-22 5:40 UTC (permalink / raw)
To: linuxppc-dev; +Cc: scottwood, sam.mj, Anton Blanchard
The only little endian configuration we support is ppc64le. As such if
we're building little endian we don't need a 32-bit VDSO, because there
is no 32-bit userspace.
This patch is a fairly ugly mess of #ifdefs, but is the minimal logic
required to disable the 32-bit VDSO. We can hopefully clean up the
result in future with some further refactoring.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/include/asm/vdso.h | 1 +
arch/powerpc/kernel/Makefile | 3 ++-
arch/powerpc/kernel/vdso.c | 40 ++++++++++++++++++++++++++++++----
arch/powerpc/platforms/Kconfig.cputype | 10 +++++++++
4 files changed, 49 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/include/asm/vdso.h b/arch/powerpc/include/asm/vdso.h
index c53f5f6d1761..f455adb471e7 100644
--- a/arch/powerpc/include/asm/vdso.h
+++ b/arch/powerpc/include/asm/vdso.h
@@ -19,6 +19,7 @@
/* Offsets relative to thread->vdso_base */
extern unsigned long vdso64_rt_sigtramp;
+
extern unsigned long vdso32_sigtramp;
extern unsigned long vdso32_rt_sigtramp;
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index c1ebbdaac28f..87c7d1473488 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -33,11 +33,12 @@ obj-y := cputable.o ptrace.o syscalls.o \
signal.o sysfs.o cacheinfo.o time.o \
prom.o traps.o setup-common.o \
udbg.o misc.o io.o dma.o \
- misc_$(CONFIG_WORD_SIZE).o vdso32/ \
+ misc_$(CONFIG_WORD_SIZE).o \
of_platform.o prom_parse.o
obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \
signal_64.o ptrace32.o \
paca.o nvram_64.o firmware.o
+obj-$(CONFIG_VDSO32) += vdso32/
obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_ppc970.o cpu_setup_pa6t.o
obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_power.o
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 8331d0bef0fb..c2bd45187315 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -49,12 +49,15 @@
/* The alignment of the vDSO */
#define VDSO_ALIGNMENT (1 << 16)
-extern char vdso32_start, vdso32_end;
-static void *vdso32_kbase = &vdso32_start;
static unsigned int vdso32_pages;
+static void *vdso32_kbase;
static struct page **vdso32_pagelist;
-unsigned long vdso32_sigtramp;
-unsigned long vdso32_rt_sigtramp;
+unsigned long vdso32_sigtramp = 0;
+unsigned long vdso32_rt_sigtramp = 0;
+
+#ifdef CONFIG_VDSO32
+extern char vdso32_start, vdso32_end;
+#endif
#ifdef CONFIG_PPC64
extern char vdso64_start, vdso64_end;
@@ -248,6 +251,7 @@ const char *arch_vma_name(struct vm_area_struct *vma)
+#ifdef CONFIG_VDSO32
static void * __init find_section32(Elf32_Ehdr *ehdr, const char *secname,
unsigned long *size)
{
@@ -335,6 +339,20 @@ static int __init vdso_do_func_patch32(struct lib32_elfinfo *v32,
return 0;
}
+#else /* !CONFIG_VDSO32 */
+static unsigned long __init find_function32(struct lib32_elfinfo *lib,
+ const char *symname)
+{
+ return 0;
+}
+
+static int __init vdso_do_func_patch32(struct lib32_elfinfo *v32,
+ struct lib64_elfinfo *v64,
+ const char *orig, const char *fix)
+{
+ return 0;
+}
+#endif /* CONFIG_VDSO32 */
#ifdef CONFIG_PPC64
@@ -445,6 +463,7 @@ static __init int vdso_do_find_sections(struct lib32_elfinfo *v32,
* Locate symbol tables & text section
*/
+#ifdef CONFIG_VDSO32
v32->dynsym = find_section32(v32->hdr, ".dynsym", &v32->dynsymsize);
v32->dynstr = find_section32(v32->hdr, ".dynstr", NULL);
if (v32->dynsym == NULL || v32->dynstr == NULL) {
@@ -457,6 +476,7 @@ static __init int vdso_do_find_sections(struct lib32_elfinfo *v32,
return -1;
}
v32->text = sect - vdso32_kbase;
+#endif
#ifdef CONFIG_PPC64
v64->dynsym = find_section64(v64->hdr, ".dynsym", &v64->dynsymsize);
@@ -493,7 +513,9 @@ static __init void vdso_setup_trampolines(struct lib32_elfinfo *v32,
static __init int vdso_fixup_datapage(struct lib32_elfinfo *v32,
struct lib64_elfinfo *v64)
{
+#ifdef CONFIG_VDSO32
Elf32_Sym *sym32;
+#endif
#ifdef CONFIG_PPC64
Elf64_Sym *sym64;
@@ -508,6 +530,7 @@ static __init int vdso_fixup_datapage(struct lib32_elfinfo *v32,
(sym64->st_value - VDSO64_LBASE);
#endif /* CONFIG_PPC64 */
+#ifdef CONFIG_VDSO32
sym32 = find_symbol32(v32, "__kernel_datapage_offset");
if (sym32 == NULL) {
printk(KERN_ERR "vDSO32: Can't find symbol "
@@ -517,6 +540,7 @@ static __init int vdso_fixup_datapage(struct lib32_elfinfo *v32,
*((int *)(vdso32_kbase + (sym32->st_value - VDSO32_LBASE))) =
(vdso32_pages << PAGE_SHIFT) -
(sym32->st_value - VDSO32_LBASE);
+#endif
return 0;
}
@@ -550,6 +574,7 @@ static __init int vdso_fixup_features(struct lib32_elfinfo *v32,
start, start + size);
#endif /* CONFIG_PPC64 */
+#ifdef CONFIG_VDSO32
start = find_section32(v32->hdr, "__ftr_fixup", &size);
if (start)
do_feature_fixups(cur_cpu_spec->cpu_features,
@@ -571,6 +596,7 @@ static __init int vdso_fixup_features(struct lib32_elfinfo *v32,
if (start)
do_lwsync_fixups(cur_cpu_spec->cpu_features,
start, start + size);
+#endif
return 0;
}
@@ -732,11 +758,15 @@ static int __init vdso_init(void)
#endif /* CONFIG_PPC64 */
+#ifdef CONFIG_VDSO32
+ vdso32_kbase = &vdso32_start;
+
/*
* Calculate the size of the 32 bits vDSO
*/
vdso32_pages = (&vdso32_end - &vdso32_start) >> PAGE_SHIFT;
DBG("vdso32_kbase: %p, 0x%x pages\n", vdso32_kbase, vdso32_pages);
+#endif
/*
@@ -757,6 +787,7 @@ static int __init vdso_init(void)
return 0;
}
+#ifdef CONFIG_VDSO32
/* Make sure pages are in the correct state */
vdso32_pagelist = kzalloc(sizeof(struct page *) * (vdso32_pages + 2),
GFP_KERNEL);
@@ -769,6 +800,7 @@ static int __init vdso_init(void)
}
vdso32_pagelist[i++] = virt_to_page(vdso_data);
vdso32_pagelist[i] = NULL;
+#endif
#ifdef CONFIG_PPC64
vdso64_pagelist = kzalloc(sizeof(struct page *) * (vdso64_pages + 2),
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index c8ae35f564fd..c140e94c7c72 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -405,6 +405,16 @@ config PPC_DOORBELL
endmenu
+config VDSO32
+ def_bool y
+ depends on PPC32 || CPU_BIG_ENDIAN
+ help
+ This symbol controls whether we build the 32-bit VDSO. We obviously
+ want to do that if we're building a 32-bit kernel. If we're building
+ a 64-bit kernel then we only want a 32-bit VDSO if we're building for
+ big endian. That is because the only little endian configuration we
+ support is ppc64le which is 64-bit only.
+
choice
prompt "Endianness selection"
default CPU_BIG_ENDIAN
--
2.1.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 3/3] powerpc/vdso: Disable building the 32-bit VDSO on little endian
2015-04-22 5:40 ` [PATCH 3/3] powerpc/vdso: Disable building the 32-bit VDSO on little endian Michael Ellerman
@ 2015-04-23 3:06 ` Stephen Rothwell
2015-04-23 4:37 ` Michael Ellerman
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Rothwell @ 2015-04-23 3:06 UTC (permalink / raw)
To: Michael Ellerman; +Cc: scottwood, linuxppc-dev, sam.mj, Anton Blanchard
[-- Attachment #1: Type: text/plain, Size: 1309 bytes --]
Hi Michael,
On Wed, 22 Apr 2015 15:40:36 +1000 Michael Ellerman <mpe@ellerman.id.au> wrote:
>
> diff --git a/arch/powerpc/include/asm/vdso.h b/arch/powerpc/include/asm/vdso.h
> index c53f5f6d1761..f455adb471e7 100644
> --- a/arch/powerpc/include/asm/vdso.h
> +++ b/arch/powerpc/include/asm/vdso.h
> @@ -19,6 +19,7 @@
>
> /* Offsets relative to thread->vdso_base */
> extern unsigned long vdso64_rt_sigtramp;
> +
> extern unsigned long vdso32_sigtramp;
> extern unsigned long vdso32_rt_sigtramp;
You could drop this hunk :-)
> diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
> index 8331d0bef0fb..c2bd45187315 100644
> --- a/arch/powerpc/kernel/vdso.c
> +++ b/arch/powerpc/kernel/vdso.c
> @@ -49,12 +49,15 @@
> /* The alignment of the vDSO */
> #define VDSO_ALIGNMENT (1 << 16)
>
> -extern char vdso32_start, vdso32_end;
> -static void *vdso32_kbase = &vdso32_start;
> static unsigned int vdso32_pages;
> +static void *vdso32_kbase;
> static struct page **vdso32_pagelist;
> -unsigned long vdso32_sigtramp;
> -unsigned long vdso32_rt_sigtramp;
> +unsigned long vdso32_sigtramp = 0;
> +unsigned long vdso32_rt_sigtramp = 0;
And they should be zero anyway, right?
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/3] powerpc/vdso: Disable building the 32-bit VDSO on little endian
2015-04-23 3:06 ` Stephen Rothwell
@ 2015-04-23 4:37 ` Michael Ellerman
0 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2015-04-23 4:37 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: scottwood, linuxppc-dev, sam.mj, Anton Blanchard
On Thu, 2015-04-23 at 13:06 +1000, Stephen Rothwell wrote:
> Hi Michael,
>
> On Wed, 22 Apr 2015 15:40:36 +1000 Michael Ellerman <mpe@ellerman.id.au> wrote:
> >
> > diff --git a/arch/powerpc/include/asm/vdso.h b/arch/powerpc/include/asm/vdso.h
> > index c53f5f6d1761..f455adb471e7 100644
> > --- a/arch/powerpc/include/asm/vdso.h
> > +++ b/arch/powerpc/include/asm/vdso.h
> > @@ -19,6 +19,7 @@
> >
> > /* Offsets relative to thread->vdso_base */
> > extern unsigned long vdso64_rt_sigtramp;
> > +
> > extern unsigned long vdso32_sigtramp;
> > extern unsigned long vdso32_rt_sigtramp;
>
> You could drop this hunk :-)
Darn it.
> > diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
> > index 8331d0bef0fb..c2bd45187315 100644
> > --- a/arch/powerpc/kernel/vdso.c
> > +++ b/arch/powerpc/kernel/vdso.c
> > @@ -49,12 +49,15 @@
> > /* The alignment of the vDSO */
> > #define VDSO_ALIGNMENT (1 << 16)
> >
> > -extern char vdso32_start, vdso32_end;
> > -static void *vdso32_kbase = &vdso32_start;
> > static unsigned int vdso32_pages;
> > +static void *vdso32_kbase;
> > static struct page **vdso32_pagelist;
> > -unsigned long vdso32_sigtramp;
> > -unsigned long vdso32_rt_sigtramp;
> > +unsigned long vdso32_sigtramp = 0;
> > +unsigned long vdso32_rt_sigtramp = 0;
>
> And they should be zero anyway, right?
Yeah I guess, I wanted to be sure :)
cheers
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-04-23 4:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-22 5:40 [PATCH 1/3] powerpc/vdso: Remove unused debug code Michael Ellerman
2015-04-22 5:40 ` [PATCH 2/3] powerpc/vdso: Combine start/size variables Michael Ellerman
2015-04-22 5:40 ` [PATCH 3/3] powerpc/vdso: Disable building the 32-bit VDSO on little endian Michael Ellerman
2015-04-23 3:06 ` Stephen Rothwell
2015-04-23 4:37 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).