Skip to contentSkip to conversation

powerpc/mm: refactor vDSO mapping code

PATCH In review Dmitry Safonov 3 participants 14 messages Oct 27, 2016 – Nov 8, 2016

Subsystems (21)
lore
Share & tools
lore
#0 lore raw

v3 cover powerpc/mm: refactor vDSO mapping code

Changes since v1, v2:
- use vdso64_pages only under CONFIG_PPC64 (32-bit build fix)
- remove arch_vma_name helper as not needed anymore, simplify vdso_base pointer initializing in map_vdso()

Cleanup patches for vDSO on powerpc.
Originally, I wanted to add vDSO remapping on arm/aarch64 and I decided to cleanup that part on powerpc.
I've add a hook for vm_ops for vDSO just like I did for x86, which makes cross-arch arch_mremap hook no more needed. Other changes - reduce exhaustive code duplication by separating the common vdso code.

No visible to userspace changes expected.
Tested on qemu with buildroot rootfs.

Dmitry Safonov (8):
powerpc/vdso: unify return paths in setup_additional_pages powerpc/vdso: remove unused params in vdso_do_func_patch{32,64} powerpc/vdso: separate common code in vdso_common powerpc/vdso: introduce init_vdso{32,64}_pagelist powerpc/vdso: split map_vdso from arch_setup_additional_pages powerpc/vdso: switch from legacy_special_mapping_vmops
mm: kill arch_mremap
powerpc/vdso: remove arch_vma_name

 arch/alpha/include/asm/Kbuild            |   1 -
 arch/arc/include/asm/Kbuild              |   1 -
 arch/arm/include/asm/Kbuild              |   1 -
 arch/arm64/include/asm/Kbuild            |   1 -
 arch/avr32/include/asm/Kbuild            |   1 -
 arch/blackfin/include/asm/Kbuild         |   1 -
 arch/c6x/include/asm/Kbuild              |   1 -
 arch/cris/include/asm/Kbuild             |   1 -
 arch/frv/include/asm/Kbuild              |   1 -
 arch/h8300/include/asm/Kbuild            |   1 -
 arch/hexagon/include/asm/Kbuild          |   1 -
 arch/ia64/include/asm/Kbuild             |   1 -
 arch/m32r/include/asm/Kbuild             |   1 -
 arch/m68k/include/asm/Kbuild             |   1 -
 arch/metag/include/asm/Kbuild            |   1 -
 arch/microblaze/include/asm/Kbuild       |   1 -
 arch/mips/include/asm/Kbuild             |   1 -
 arch/mn10300/include/asm/Kbuild          |   1 -
 arch/nios2/include/asm/Kbuild            |   1 -
 arch/openrisc/include/asm/Kbuild         |   1 -
 arch/parisc/include/asm/Kbuild           |   1 -
 arch/powerpc/include/asm/mm-arch-hooks.h |  28 --
 arch/powerpc/kernel/vdso.c               | 502 +++++--------------------------
 arch/powerpc/kernel/vdso_common.c        | 248 +++++++++++++++
 arch/s390/include/asm/Kbuild             |   1 -
 arch/score/include/asm/Kbuild            |   1 -
 arch/sh/include/asm/Kbuild               |   1 -
 arch/sparc/include/asm/Kbuild            |   1 -
 arch/tile/include/asm/Kbuild             |   1 -
 arch/um/include/asm/Kbuild               |   1 -
 arch/unicore32/include/asm/Kbuild        |   1 -
 arch/x86/include/asm/Kbuild              |   1 -
 arch/xtensa/include/asm/Kbuild           |   1 -
 include/asm-generic/mm-arch-hooks.h      |  16 -
 include/linux/mm-arch-hooks.h            |  25 --
 mm/mremap.c                              |   4 -
 36 files changed, 324 insertions(+), 529 deletions(-)
 delete mode 100644 arch/powerpc/include/asm/mm-arch-hooks.h
 create mode 100644 arch/powerpc/kernel/vdso_common.c
 delete mode 100644 include/asm-generic/mm-arch-hooks.h
 delete mode 100644 include/linux/mm-arch-hooks.h
Signature · 7 lines
2.10.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw

PATCH v3 1/8 powerpc/vdso: unify return paths in setup_additional_pages

Impact: cleanup

Rename rc' variable which doesn't seems to mean anything into kernel-known ret'. Combine two function returns into one as it's also easier to read.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Oleg Nesterov <[email protected]>
---
 arch/powerpc/kernel/vdso.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)
arch/powerpc/kernel/vdso.c +7 -12
index 4111d30badfa..4ffb82a2d9e9 100644
@@ -154,7 +154,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 	struct page **vdso_pagelist;
 	unsigned long vdso_pages;
 	unsigned long vdso_base;
-	int rc;
+	int ret = 0;
 
 	if (!vdso_ready)
 		return 0;
@@ -203,8 +203,8 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 				      ((VDSO_ALIGNMENT - 1) & PAGE_MASK),
 				      0, 0);
 	if (IS_ERR_VALUE(vdso_base)) {
-		rc = vdso_base;
-		goto fail_mmapsem;
+		ret = vdso_base;
+		goto out_up_mmap_sem;
 	}
 
 	/* Add required alignment. */
@@ -227,21 +227,16 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 	 * It's fine to use that for setting breakpoints in the vDSO code
 	 * pages though.
 	 */
-	rc = install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT,
+	ret = install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT,
 				     VM_READ|VM_EXEC|
 				     VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
 				     vdso_pagelist);
-	if (rc) {
+	if (ret)
 		current->mm->context.vdso_base = 0;
-		goto fail_mmapsem;
-	}
-
-	up_write(&mm->mmap_sem);
-	return 0;
 
- fail_mmapsem:
+out_up_mmap_sem:
 	up_write(&mm->mmap_sem);
-	return rc;
+	return ret;
 }
 
 const char *arch_vma_name(struct vm_area_struct *vma)
Signature · 7 lines
2.10.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#2 lore raw

Re: [PATCHv3 1/8] powerpc/vdso: unify return paths in setup_additional_pages

Hi Dmitry,

Thanks for the patches.

Quoted 1 line · Dmitry Safonov

Impact: cleanup

I'm not a fan of these "Impact" lines, especially when they're not correct, ie. this is not a cleanup, a cleanup doesn't change logic.

Quoted 2 lines

Rename rc' variable which doesn't seems to mean anything into kernel-known ret'.

'rc' means "Return Code", it's fairly common. I see at least ~8500 "int rc" declarations in the kernel.

Please don't rename variables and change logic in one patch.

Quoted 20 lines

Combine two function returns into one as it's also easier to read.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Oleg Nesterov <[email protected]>
---
 arch/powerpc/kernel/vdso.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)
arch/powerpc/kernel/vdso.c +0 -0
index 4111d30badfa..4ffb82a2d9e9 100644

arch/powerpc/kernel/vdso.c int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) · line 157

Quoted 5 lines
arch/powerpc/kernel/vdso.c +1 -1
@@ -154,7 +154,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 	struct page **vdso_pagelist;
 	unsigned long vdso_pages;
 	unsigned long vdso_base;
-	int rc;
+	int ret = 0;

Please don't initialise return codes in the declaration, it prevents the compiler from warning you if you forget to initialise it in a particular path.

AFAICS you never even use the default value either.

Quoted 27 lines
arch/powerpc/kernel/vdso.c +4 -6
 	if (!vdso_ready)
 		return 0;
@@ -203,8 +203,8 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 				      ((VDSO_ALIGNMENT - 1) & PAGE_MASK),
 				      0, 0);
 	if (IS_ERR_VALUE(vdso_base)) {
-		rc = vdso_base;
-		goto fail_mmapsem;
+		ret = vdso_base;
+		goto out_up_mmap_sem;
 	}
 
 	/* Add required alignment. */
@@ -227,21 +227,16 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 	 * It's fine to use that for setting breakpoints in the vDSO code
 	 * pages though.
 	 */
-	rc = install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT,
+	ret = install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT,
 				     VM_READ|VM_EXEC|
 				     VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
 				     vdso_pagelist);
-	if (rc) {
+	if (ret)
 		current->mm->context.vdso_base = 0;
-		goto fail_mmapsem;
-	}

arch/powerpc/kernel/vdso.c int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) · line 240

Quoted 10 lines
arch/powerpc/kernel/vdso.c +2 -5
-
-	up_write(&mm->mmap_sem);
-	return 0;
 
- fail_mmapsem:
+out_up_mmap_sem:
 	up_write(&mm->mmap_sem);
-	return rc;
+	return ret;
 }

If you strip out the variable renames then I think that change would be OK.

cheers

#3 lore raw

Re: [PATCHv3 1/8] powerpc/vdso: unify return paths in setup_additional_pages

Quoted 10 lines · Michael Ellerman

Hi Dmitry,

Thanks for the patches.

Quoted 1 line · Dmitry Safonov

Impact: cleanup

I'm not a fan of these "Impact" lines, especially when they're not correct, ie. this is not a cleanup, a cleanup doesn't change logic.

Quoted 7 lines
Quoted 2 lines

Rename rc' variable which doesn't seems to mean anything into kernel-known ret'.

'rc' means "Return Code", it's fairly common. I see at least ~8500 "int rc" declarations in the kernel.

Please don't rename variables and change logic in one patch.

Ok, right - just didn't saw rc' that freq as ret'. Will leave the name.

Quoted 30 lines
Quoted 20 lines

Combine two function returns into one as it's also easier to read.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Oleg Nesterov <[email protected]>
---
 arch/powerpc/kernel/vdso.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)
arch/powerpc/kernel/vdso.c +0 -0
index 4111d30badfa..4ffb82a2d9e9 100644

arch/powerpc/kernel/vdso.c int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) · line 157

Quoted 5 lines
arch/powerpc/kernel/vdso.c +1 -1
@@ -154,7 +154,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 	struct page **vdso_pagelist;
 	unsigned long vdso_pages;
 	unsigned long vdso_base;
-	int rc;
+	int ret = 0;

Please don't initialise return codes in the declaration, it prevents the compiler from warning you if you forget to initialise it in a particular path.

Quoted 1 line

AFAICS you never even use the default value either.

Oh, right - I split this patch from converting install_special_mapping() to special vma version _install_special_mapping(), 6/8 patch in series. Will move initialization to that patch.

Quoted 44 lines
Quoted 27 lines
arch/powerpc/kernel/vdso.c +4 -6
 	if (!vdso_ready)
 		return 0;
@@ -203,8 +203,8 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 				      ((VDSO_ALIGNMENT - 1) & PAGE_MASK),
 				      0, 0);
 	if (IS_ERR_VALUE(vdso_base)) {
-		rc = vdso_base;
-		goto fail_mmapsem;
+		ret = vdso_base;
+		goto out_up_mmap_sem;
 	}
 
 	/* Add required alignment. */
@@ -227,21 +227,16 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 	 * It's fine to use that for setting breakpoints in the vDSO code
 	 * pages though.
 	 */
-	rc = install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT,
+	ret = install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT,
 				     VM_READ|VM_EXEC|
 				     VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
 				     vdso_pagelist);
-	if (rc) {
+	if (ret)
 		current->mm->context.vdso_base = 0;
-		goto fail_mmapsem;
-	}

arch/powerpc/kernel/vdso.c int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) · line 240

Quoted 10 lines
arch/powerpc/kernel/vdso.c +2 -5
-
-	up_write(&mm->mmap_sem);
-	return 0;
 
- fail_mmapsem:
+out_up_mmap_sem:
 	up_write(&mm->mmap_sem);
-	return rc;
+	return ret;
 }

If you strip out the variable renames then I think that change would be OK.

cheers

Signature · 7 lines
             Dmitry

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#4 lore raw

PATCH v3 2/8 powerpc/vdso: remove unused params in vdso_do_func_patch{32,64}

In reply to Dmitry Safonov

Impact: cleanup

vdso_do_func_patch{32,64} only use {v32,v64} parameter accordingly. Remove not needed parameters.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Oleg Nesterov <[email protected]>
---
 arch/powerpc/kernel/vdso.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
arch/powerpc/kernel/vdso.c +3 -8
index 4ffb82a2d9e9..278b9aa25a1c 100644
@@ -309,7 +309,6 @@ static unsigned long __init find_function32(struct lib32_elfinfo *lib,
 }
 
 static int __init vdso_do_func_patch32(struct lib32_elfinfo *v32,
-				       struct lib64_elfinfo *v64,
 				       const char *orig, const char *fix)
 {
 	Elf32_Sym *sym32_gen, *sym32_fix;
@@ -344,7 +343,6 @@ static unsigned long __init find_function32(struct lib32_elfinfo *lib,
 }
 
 static int __init vdso_do_func_patch32(struct lib32_elfinfo *v32,
-				       struct lib64_elfinfo *v64,
 				       const char *orig, const char *fix)
 {
 	return 0;
@@ -419,8 +417,7 @@ static unsigned long __init find_function64(struct lib64_elfinfo *lib,
 #endif
 }
 
-static int __init vdso_do_func_patch64(struct lib32_elfinfo *v32,
-				       struct lib64_elfinfo *v64,
+static int __init vdso_do_func_patch64(struct lib64_elfinfo *v64,
 				       const char *orig, const char *fix)
 {
 	Elf64_Sym *sym64_gen, *sym64_fix;
@@ -619,11 +616,9 @@ static __init int vdso_fixup_alt_funcs(struct lib32_elfinfo *v32,
 		 * It would be easy to do, but doesn't seem to be necessary,
 		 * patching the OPD symbol is enough.
 		 */
-		vdso_do_func_patch32(v32, v64, patch->gen_name,
-				     patch->fix_name);
+		vdso_do_func_patch32(v32, patch->gen_name, patch->fix_name);
 #ifdef CONFIG_PPC64
-		vdso_do_func_patch64(v32, v64, patch->gen_name,
-				     patch->fix_name);
+		vdso_do_func_patch64(v64, patch->gen_name, patch->fix_name);
 #endif /* CONFIG_PPC64 */
 	}
 
Signature · 7 lines
2.10.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#5 lore raw

PATCH v3 3/8 powerpc/vdso: separate common code in vdso_common

In reply to Dmitry Safonov

Impact: cleanup

There are common functions for handeling 32-bit and 64-bit vDSO ELF
files: find_section{32,64}, find_symbol{32,64}, find_function{32,64}, vdso_do_func_patch{32,64}, vdso_do_find_sections{32,64}, vdso_fixup_datapag{32,64}, vdso_fixup_features{32,64}, vdso_setup{32,64} which all do the same work with the only difference is using structures for 32 or 64 bit ELF. Let's combine them into common code, reducing copy'n'paste code.

Small changes:
I also switched usage of printk(KERNEL_<LEVEL>,...) on pr_<level>(...) and used pr_fmt() macro for "vDSO{32,64}: " prefix.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Oleg Nesterov <[email protected]>
---
 arch/powerpc/kernel/vdso.c        | 352 ++------------------------------------
 arch/powerpc/kernel/vdso_common.c | 221 ++++++++++++++++++++++++
 2 files changed, 234 insertions(+), 339 deletions(-)
 create mode 100644 arch/powerpc/kernel/vdso_common.c
arch/powerpc/kernel/vdso.c +13 -339
index 278b9aa25a1c..8010a0d82049 100644
@@ -51,13 +51,13 @@
 #define VDSO_ALIGNMENT	(1 << 16)
 
 static unsigned int vdso32_pages;
-static void *vdso32_kbase;
 static struct page **vdso32_pagelist;
 unsigned long vdso32_sigtramp;
 unsigned long vdso32_rt_sigtramp;
 
 #ifdef CONFIG_VDSO32
 extern char vdso32_start, vdso32_end;
+static void *vdso32_kbase;
 #endif
 
 #ifdef CONFIG_PPC64
@@ -246,250 +246,16 @@ const char *arch_vma_name(struct vm_area_struct *vma)
 	return NULL;
 }
 
-
-
 #ifdef CONFIG_VDSO32
-static void * __init find_section32(Elf32_Ehdr *ehdr, const char *secname,
-				  unsigned long *size)
-{
-	Elf32_Shdr *sechdrs;
-	unsigned int i;
-	char *secnames;
-
-	/* Grab section headers and strings so we can tell who is who */
-	sechdrs = (void *)ehdr + ehdr->e_shoff;
-	secnames = (void *)ehdr + sechdrs[ehdr->e_shstrndx].sh_offset;
-
-	/* Find the section they want */
-	for (i = 1; i < ehdr->e_shnum; i++) {
-		if (strcmp(secnames+sechdrs[i].sh_name, secname) == 0) {
-			if (size)
-				*size = sechdrs[i].sh_size;
-			return (void *)ehdr + sechdrs[i].sh_offset;
-		}
-	}
-	*size = 0;
-	return NULL;
-}
-
-static Elf32_Sym * __init find_symbol32(struct lib32_elfinfo *lib,
-					const char *symname)
-{
-	unsigned int i;
-	char name[MAX_SYMNAME], *c;
-
-	for (i = 0; i < (lib->dynsymsize / sizeof(Elf32_Sym)); i++) {
-		if (lib->dynsym[i].st_name == 0)
-			continue;
-		strlcpy(name, lib->dynstr + lib->dynsym[i].st_name,
-			MAX_SYMNAME);
-		c = strchr(name, '@');
-		if (c)
-			*c = 0;
-		if (strcmp(symname, name) == 0)
-			return &lib->dynsym[i];
-	}
-	return NULL;
-}
-
-/* Note that we assume the section is .text and the symbol is relative to
- * the library base
- */
-static unsigned long __init find_function32(struct lib32_elfinfo *lib,
-					    const char *symname)
-{
-	Elf32_Sym *sym = find_symbol32(lib, symname);
-
-	if (sym == NULL) {
-		printk(KERN_WARNING "vDSO32: function %s not found !\n",
-		       symname);
-		return 0;
-	}
-	return sym->st_value - VDSO32_LBASE;
-}
-
-static int __init vdso_do_func_patch32(struct lib32_elfinfo *v32,
-				       const char *orig, const char *fix)
-{
-	Elf32_Sym *sym32_gen, *sym32_fix;
-
-	sym32_gen = find_symbol32(v32, orig);
-	if (sym32_gen == NULL) {
-		printk(KERN_ERR "vDSO32: Can't find symbol %s !\n", orig);
-		return -1;
-	}
-	if (fix == NULL) {
-		sym32_gen->st_name = 0;
-		return 0;
-	}
-	sym32_fix = find_symbol32(v32, fix);
-	if (sym32_fix == NULL) {
-		printk(KERN_ERR "vDSO32: Can't find symbol %s !\n", fix);
-		return -1;
-	}
-	sym32_gen->st_value = sym32_fix->st_value;
-	sym32_gen->st_size = sym32_fix->st_size;
-	sym32_gen->st_info = sym32_fix->st_info;
-	sym32_gen->st_other = sym32_fix->st_other;
-	sym32_gen->st_shndx = sym32_fix->st_shndx;
-
-	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,
-				       const char *orig, const char *fix)
-{
-	return 0;
-}
+#include "vdso_common.c"
 #endif /* CONFIG_VDSO32 */
 
-
 #ifdef CONFIG_PPC64
-
-static void * __init find_section64(Elf64_Ehdr *ehdr, const char *secname,
-				  unsigned long *size)
-{
-	Elf64_Shdr *sechdrs;
-	unsigned int i;
-	char *secnames;
-
-	/* Grab section headers and strings so we can tell who is who */
-	sechdrs = (void *)ehdr + ehdr->e_shoff;
-	secnames = (void *)ehdr + sechdrs[ehdr->e_shstrndx].sh_offset;
-
-	/* Find the section they want */
-	for (i = 1; i < ehdr->e_shnum; i++) {
-		if (strcmp(secnames+sechdrs[i].sh_name, secname) == 0) {
-			if (size)
-				*size = sechdrs[i].sh_size;
-			return (void *)ehdr + sechdrs[i].sh_offset;
-		}
-	}
-	if (size)
-		*size = 0;
-	return NULL;
-}
-
-static Elf64_Sym * __init find_symbol64(struct lib64_elfinfo *lib,
-					const char *symname)
-{
-	unsigned int i;
-	char name[MAX_SYMNAME], *c;
-
-	for (i = 0; i < (lib->dynsymsize / sizeof(Elf64_Sym)); i++) {
-		if (lib->dynsym[i].st_name == 0)
-			continue;
-		strlcpy(name, lib->dynstr + lib->dynsym[i].st_name,
-			MAX_SYMNAME);
-		c = strchr(name, '@');
-		if (c)
-			*c = 0;
-		if (strcmp(symname, name) == 0)
-			return &lib->dynsym[i];
-	}
-	return NULL;
-}
-
-/* Note that we assume the section is .text and the symbol is relative to
- * the library base
- */
-static unsigned long __init find_function64(struct lib64_elfinfo *lib,
-					    const char *symname)
-{
-	Elf64_Sym *sym = find_symbol64(lib, symname);
-
-	if (sym == NULL) {
-		printk(KERN_WARNING "vDSO64: function %s not found !\n",
-		       symname);
-		return 0;
-	}
-#ifdef VDS64_HAS_DESCRIPTORS
-	return *((u64 *)(vdso64_kbase + sym->st_value - VDSO64_LBASE)) -
-		VDSO64_LBASE;
-#else
-	return sym->st_value - VDSO64_LBASE;
-#endif
-}
-
-static int __init vdso_do_func_patch64(struct lib64_elfinfo *v64,
-				       const char *orig, const char *fix)
-{
-	Elf64_Sym *sym64_gen, *sym64_fix;
-
-	sym64_gen = find_symbol64(v64, orig);
-	if (sym64_gen == NULL) {
-		printk(KERN_ERR "vDSO64: Can't find symbol %s !\n", orig);
-		return -1;
-	}
-	if (fix == NULL) {
-		sym64_gen->st_name = 0;
-		return 0;
-	}
-	sym64_fix = find_symbol64(v64, fix);
-	if (sym64_fix == NULL) {
-		printk(KERN_ERR "vDSO64: Can't find symbol %s !\n", fix);
-		return -1;
-	}
-	sym64_gen->st_value = sym64_fix->st_value;
-	sym64_gen->st_size = sym64_fix->st_size;
-	sym64_gen->st_info = sym64_fix->st_info;
-	sym64_gen->st_other = sym64_fix->st_other;
-	sym64_gen->st_shndx = sym64_fix->st_shndx;
-
-	return 0;
-}
-
+#define BITS 64
+#include "vdso_common.c"
 #endif /* CONFIG_PPC64 */
 
 
-static __init int vdso_do_find_sections(struct lib32_elfinfo *v32,
-					struct lib64_elfinfo *v64)
-{
-	void *sect;
-
-	/*
-	 * 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) {
-		printk(KERN_ERR "vDSO32: required symbol section not found\n");
-		return -1;
-	}
-	sect = find_section32(v32->hdr, ".text", NULL);
-	if (sect == NULL) {
-		printk(KERN_ERR "vDSO32: the .text section was not found\n");
-		return -1;
-	}
-	v32->text = sect - vdso32_kbase;
-#endif
-
-#ifdef CONFIG_PPC64
-	v64->dynsym = find_section64(v64->hdr, ".dynsym", &v64->dynsymsize);
-	v64->dynstr = find_section64(v64->hdr, ".dynstr", NULL);
-	if (v64->dynsym == NULL || v64->dynstr == NULL) {
-		printk(KERN_ERR "vDSO64: required symbol section not found\n");
-		return -1;
-	}
-	sect = find_section64(v64->hdr, ".text", NULL);
-	if (sect == NULL) {
-		printk(KERN_ERR "vDSO64: the .text section was not found\n");
-		return -1;
-	}
-	v64->text = sect - vdso64_kbase;
-#endif /* CONFIG_PPC64 */
-
-	return 0;
-}
-
 static __init void vdso_setup_trampolines(struct lib32_elfinfo *v32,
 					  struct lib64_elfinfo *v64)
 {
@@ -500,99 +266,10 @@ static __init void vdso_setup_trampolines(struct lib32_elfinfo *v32,
 #ifdef CONFIG_PPC64
 	vdso64_rt_sigtramp = find_function64(v64, "__kernel_sigtramp_rt64");
 #endif
+#ifdef CONFIG_VDSO32
 	vdso32_sigtramp	   = find_function32(v32, "__kernel_sigtramp32");
 	vdso32_rt_sigtramp = find_function32(v32, "__kernel_sigtramp_rt32");
-}
-
-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;
-
-       	sym64 = find_symbol64(v64, "__kernel_datapage_offset");
-	if (sym64 == NULL) {
-		printk(KERN_ERR "vDSO64: Can't find symbol "
-		       "__kernel_datapage_offset !\n");
-		return -1;
-	}
-	*((int *)(vdso64_kbase + sym64->st_value - VDSO64_LBASE)) =
-		(vdso64_pages << PAGE_SHIFT) -
-		(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 "
-		       "__kernel_datapage_offset !\n");
-		return -1;
-	}
-	*((int *)(vdso32_kbase + (sym32->st_value - VDSO32_LBASE))) =
-		(vdso32_pages << PAGE_SHIFT) -
-		(sym32->st_value - VDSO32_LBASE);
 #endif
-
-	return 0;
-}
-
-
-static __init int vdso_fixup_features(struct lib32_elfinfo *v32,
-				      struct lib64_elfinfo *v64)
-{
-	unsigned long size;
-	void *start;
-
-#ifdef CONFIG_PPC64
-	start = find_section64(v64->hdr, "__ftr_fixup", &size);
-	if (start)
-		do_feature_fixups(cur_cpu_spec->cpu_features,
-				  start, start + size);
-
-	start = find_section64(v64->hdr, "__mmu_ftr_fixup", &size);
-	if (start)
-		do_feature_fixups(cur_cpu_spec->mmu_features,
-				  start, start + size);
-
-	start = find_section64(v64->hdr, "__fw_ftr_fixup", &size);
-	if (start)
-		do_feature_fixups(powerpc_firmware_features,
-				  start, start + size);
-
-	start = find_section64(v64->hdr, "__lwsync_fixup", &size);
-	if (start)
-		do_lwsync_fixups(cur_cpu_spec->cpu_features,
-				 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,
-				  start, start + size);
-
-	start = find_section32(v32->hdr, "__mmu_ftr_fixup", &size);
-	if (start)
-		do_feature_fixups(cur_cpu_spec->mmu_features,
-				  start, start + size);
-
-#ifdef CONFIG_PPC64
-	start = find_section32(v32->hdr, "__fw_ftr_fixup", &size);
-	if (start)
-		do_feature_fixups(powerpc_firmware_features,
-				  start, start + size);
-#endif /* CONFIG_PPC64 */
-
-	start = find_section32(v32->hdr, "__lwsync_fixup", &size);
-	if (start)
-		do_lwsync_fixups(cur_cpu_spec->cpu_features,
-				 start, start + size);
-#endif
-
-	return 0;
 }
 
 static __init int vdso_fixup_alt_funcs(struct lib32_elfinfo *v32,
@@ -616,7 +293,9 @@ static __init int vdso_fixup_alt_funcs(struct lib32_elfinfo *v32,
 		 * It would be easy to do, but doesn't seem to be necessary,
 		 * patching the OPD symbol is enough.
 		 */
+#ifdef CONFIG_VDSO32
 		vdso_do_func_patch32(v32, patch->gen_name, patch->fix_name);
+#endif
 #ifdef CONFIG_PPC64
 		vdso_do_func_patch64(v64, patch->gen_name, patch->fix_name);
 #endif /* CONFIG_PPC64 */
@@ -625,24 +304,19 @@ static __init int vdso_fixup_alt_funcs(struct lib32_elfinfo *v32,
 	return 0;
 }
 
-
 static __init int vdso_setup(void)
 {
 	struct lib32_elfinfo	v32;
 	struct lib64_elfinfo	v64;
 
-	v32.hdr = vdso32_kbase;
-#ifdef CONFIG_PPC64
-	v64.hdr = vdso64_kbase;
-#endif
-	if (vdso_do_find_sections(&v32, &v64))
-		return -1;
-
-	if (vdso_fixup_datapage(&v32, &v64))
+#ifdef CONFIG_VDSO32
+	if (vdso_setup32(&v32))
 		return -1;
-
-	if (vdso_fixup_features(&v32, &v64))
+#endif
+#ifdef CONFIG_PPC64
+	if (vdso_setup64(&v64))
 		return -1;
+#endif
 
 	if (vdso_fixup_alt_funcs(&v32, &v64))
 		return -1;
arch/powerpc/kernel/vdso_common.c new file +221 -0

221 lines not on this page · raw message

Signature · 7 lines
2.10.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#6 lore raw

PATCH v3 4/8 powerpc/vdso: introduce init_vdso{32,64}_pagelist

In reply to Dmitry Safonov

Impact: cleanup

Move allocation/initialization of vDSO's pagelist for 32/64-bit vDSO into common vdso code, introducing a function for that.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Oleg Nesterov <[email protected]>
---
 arch/powerpc/kernel/vdso.c        | 27 ++-------------------------
 arch/powerpc/kernel/vdso_common.c | 22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+), 25 deletions(-)
arch/powerpc/kernel/vdso.c +2 -25
index 8010a0d82049..25d03d773c49 100644
@@ -382,8 +382,6 @@ early_initcall(vdso_getcpu_init);
 
 static int __init vdso_init(void)
 {
-	int i;
-
 #ifdef CONFIG_PPC64
 	/*
 	 * Fill up the "systemcfg" stuff for backward compatibility
@@ -454,32 +452,11 @@ static int __init vdso_init(void)
 	}
 
 #ifdef CONFIG_VDSO32
-	/* Make sure pages are in the correct state */
-	vdso32_pagelist = kzalloc(sizeof(struct page *) * (vdso32_pages + 2),
-				  GFP_KERNEL);
-	BUG_ON(vdso32_pagelist == NULL);
-	for (i = 0; i < vdso32_pages; i++) {
-		struct page *pg = virt_to_page(vdso32_kbase + i*PAGE_SIZE);
-		ClearPageReserved(pg);
-		get_page(pg);
-		vdso32_pagelist[i] = pg;
-	}
-	vdso32_pagelist[i++] = virt_to_page(vdso_data);
-	vdso32_pagelist[i] = NULL;
+	init_vdso32_pagelist();
 #endif
 
 #ifdef CONFIG_PPC64
-	vdso64_pagelist = kzalloc(sizeof(struct page *) * (vdso64_pages + 2),
-				  GFP_KERNEL);
-	BUG_ON(vdso64_pagelist == NULL);
-	for (i = 0; i < vdso64_pages; i++) {
-		struct page *pg = virt_to_page(vdso64_kbase + i*PAGE_SIZE);
-		ClearPageReserved(pg);
-		get_page(pg);
-		vdso64_pagelist[i] = pg;
-	}
-	vdso64_pagelist[i++] = virt_to_page(vdso_data);
-	vdso64_pagelist[i] = NULL;
+	init_vdso64_pagelist();
 #endif /* CONFIG_PPC64 */
 
 	get_page(virt_to_page(vdso_data));
arch/powerpc/kernel/vdso_common.c +22 -0
index ac25d66134fb..c97c30606b3f 100644
@@ -14,6 +14,7 @@
 #define VDSO_LBASE	CONCAT3(VDSO, BITS, _LBASE)
 #define vdso_kbase	CONCAT3(vdso, BITS, _kbase)
 #define vdso_pages	CONCAT3(vdso, BITS, _pages)
+#define vdso_pagelist	CONCAT3(vdso, BITS, _pagelist)
 
 #undef pr_fmt
 #define pr_fmt(fmt)	"vDSO" __stringify(BITS) ": " fmt
@@ -202,6 +203,25 @@ static __init int vdso_setup(struct lib_elfinfo *v)
 	return 0;
 }
 
+#define init_vdso_pagelist CONCAT3(init_vdso, BITS, _pagelist)
+static __init void init_vdso_pagelist(void)
+{
+	int i;
+
+	/* Make sure pages are in the correct state */
+	vdso_pagelist = kzalloc(sizeof(struct page *) * (vdso_pages + 2),
+				  GFP_KERNEL);
+	BUG_ON(vdso_pagelist == NULL);
+	for (i = 0; i < vdso_pages; i++) {
+		struct page *pg = virt_to_page(vdso_kbase + i*PAGE_SIZE);
+
+		ClearPageReserved(pg);
+		get_page(pg);
+		vdso_pagelist[i] = pg;
+	}
+	vdso_pagelist[i++] = virt_to_page(vdso_data);
+	vdso_pagelist[i] = NULL;
+}
 
 #undef find_section
 #undef find_symbol
@@ -211,10 +231,12 @@ static __init int vdso_setup(struct lib_elfinfo *v)
 #undef vdso_fixup_datapage
 #undef vdso_fixup_features
 #undef vdso_setup
+#undef init_vdso_pagelist
 
 #undef VDSO_LBASE
 #undef vdso_kbase
 #undef vdso_pages
+#undef vdso_pagelist
 #undef lib_elfinfo
 #undef BITS
 #undef _CONCAT3
Signature · 7 lines
2.10.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#7 lore raw

PATCH v3 5/8 powerpc/vdso: split map_vdso from arch_setup_additional_pages

In reply to Dmitry Safonov

Impact: cleanup

I'll be easier to introduce vm_special_mapping struct in a smaller map_vdso() function (see the next patches). The same way it's handeled on x86.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Oleg Nesterov <[email protected]>
---
 arch/powerpc/kernel/vdso.c | 67 +++++++++++++++++++++-------------------------
 1 file changed, 31 insertions(+), 36 deletions(-)
arch/powerpc/kernel/vdso.c +31 -36
index 25d03d773c49..e68601ffc9ad 100644
@@ -143,52 +143,23 @@ struct lib64_elfinfo
 	unsigned long	text;
 };
 
-
-/*
- * This is called from binfmt_elf, we create the special vma for the
- * vDSO and insert it into the mm struct tree
- */
-int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
+static int map_vdso(struct page **vdso_pagelist, unsigned long vdso_pages,
+		unsigned long vdso_base)
 {
 	struct mm_struct *mm = current->mm;
-	struct page **vdso_pagelist;
-	unsigned long vdso_pages;
-	unsigned long vdso_base;
 	int ret = 0;
 
-	if (!vdso_ready)
-		return 0;
-
-#ifdef CONFIG_PPC64
-	if (is_32bit_task()) {
-		vdso_pagelist = vdso32_pagelist;
-		vdso_pages = vdso32_pages;
-		vdso_base = VDSO32_MBASE;
-	} else {
-		vdso_pagelist = vdso64_pagelist;
-		vdso_pages = vdso64_pages;
-		/*
-		 * On 64bit we don't have a preferred map address. This
-		 * allows get_unmapped_area to find an area near other mmaps
-		 * and most likely share a SLB entry.
-		 */
-		vdso_base = 0;
-	}
-#else
-	vdso_pagelist = vdso32_pagelist;
-	vdso_pages = vdso32_pages;
-	vdso_base = VDSO32_MBASE;
-#endif
-
-	current->mm->context.vdso_base = 0;
+	mm->context.vdso_base = 0;
 
-	/* vDSO has a problem and was disabled, just don't "enable" it for the
+	/*
+	 * vDSO has a problem and was disabled, just don't "enable" it for the
 	 * process
 	 */
 	if (vdso_pages == 0)
 		return 0;
+
 	/* Add a page to the vdso size for the data page */
-	vdso_pages ++;
+	vdso_pages++;
 
 	/*
 	 * pick a base address for the vDSO in process space. We try to put it
@@ -239,6 +210,30 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 	return ret;
 }
 
+/*
+ * This is called from binfmt_elf, we create the special vma for the
+ * vDSO and insert it into the mm struct tree
+ */
+int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
+{
+	if (!vdso_ready)
+		return 0;
+
+	if (is_32bit_task())
+		return map_vdso(vdso32_pagelist, vdso32_pages, VDSO32_MBASE);
+#ifdef CONFIG_PPC64
+	else
+		/*
+		 * On 64bit we don't have a preferred map address. This
+		 * allows get_unmapped_area to find an area near other mmaps
+		 * and most likely share a SLB entry.
+		 */
+		return map_vdso(vdso64_pagelist, vdso64_pages, 0);
+#endif
+	WARN_ONCE(1, "task is not 32-bit on non PPC64 kernel");
+	return -1;
+}
+
 const char *arch_vma_name(struct vm_area_struct *vma)
 {
 	if (vma->vm_mm && vma->vm_start == vma->vm_mm->context.vdso_base)
Signature · 7 lines
2.10.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#8 lore raw

PATCH v3 6/8 powerpc/vdso: switch from legacy_special_mapping_vmops

In reply to Dmitry Safonov

This will allow to handle vDSO vma like special_mapping, that has it's name and hooks. Needed for mremap hook, which will replace arch_mremap helper, also for removing arch_vma_name.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Oleg Nesterov <[email protected]>
---
 arch/powerpc/kernel/vdso.c        | 19 +++++++++++--------
 arch/powerpc/kernel/vdso_common.c |  8 ++++++--
 2 files changed, 17 insertions(+), 10 deletions(-)
arch/powerpc/kernel/vdso.c +11 -8
index e68601ffc9ad..9ee3fd65c6e9 100644
@@ -51,7 +51,7 @@
 #define VDSO_ALIGNMENT	(1 << 16)
 
 static unsigned int vdso32_pages;
-static struct page **vdso32_pagelist;
+static struct vm_special_mapping vdso32_mapping;
 unsigned long vdso32_sigtramp;
 unsigned long vdso32_rt_sigtramp;
 
@@ -64,7 +64,7 @@ static void *vdso32_kbase;
 extern char vdso64_start, vdso64_end;
 static void *vdso64_kbase = &vdso64_start;
 static unsigned int vdso64_pages;
-static struct page **vdso64_pagelist;
+static struct vm_special_mapping vdso64_mapping;
 unsigned long vdso64_rt_sigtramp;
 #endif /* CONFIG_PPC64 */
 
@@ -143,10 +143,11 @@ struct lib64_elfinfo
 	unsigned long	text;
 };
 
-static int map_vdso(struct page **vdso_pagelist, unsigned long vdso_pages,
+static int map_vdso(struct vm_special_mapping *vsm, unsigned long vdso_pages,
 		unsigned long vdso_base)
 {
 	struct mm_struct *mm = current->mm;
+	struct vm_area_struct *vma;
 	int ret = 0;
 
 	mm->context.vdso_base = 0;
@@ -198,12 +199,14 @@ static int map_vdso(struct page **vdso_pagelist, unsigned long vdso_pages,
 	 * It's fine to use that for setting breakpoints in the vDSO code
 	 * pages though.
 	 */
-	ret = install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT,
+	vma = _install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT,
 				     VM_READ|VM_EXEC|
 				     VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
-				     vdso_pagelist);
-	if (ret)
+				     vsm);
+	if (IS_ERR(vma)) {
+		ret = PTR_ERR(vma);
 		current->mm->context.vdso_base = 0;
+	}
 
 out_up_mmap_sem:
 	up_write(&mm->mmap_sem);
@@ -220,7 +223,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 		return 0;
 
 	if (is_32bit_task())
-		return map_vdso(vdso32_pagelist, vdso32_pages, VDSO32_MBASE);
+		return map_vdso(&vdso32_mapping, vdso32_pages, VDSO32_MBASE);
 #ifdef CONFIG_PPC64
 	else
 		/*
@@ -228,7 +231,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 		 * allows get_unmapped_area to find an area near other mmaps
 		 * and most likely share a SLB entry.
 		 */
-		return map_vdso(vdso64_pagelist, vdso64_pages, 0);
+		return map_vdso(&vdso64_mapping, vdso64_pages, 0);
 #endif
 	WARN_ONCE(1, "task is not 32-bit on non PPC64 kernel");
 	return -1;
arch/powerpc/kernel/vdso_common.c +6 -2
index c97c30606b3f..047f6b8b230f 100644
@@ -14,7 +14,7 @@
 #define VDSO_LBASE	CONCAT3(VDSO, BITS, _LBASE)
 #define vdso_kbase	CONCAT3(vdso, BITS, _kbase)
 #define vdso_pages	CONCAT3(vdso, BITS, _pages)
-#define vdso_pagelist	CONCAT3(vdso, BITS, _pagelist)
+#define vdso_mapping	CONCAT3(vdso, BITS, _mapping)
 
 #undef pr_fmt
 #define pr_fmt(fmt)	"vDSO" __stringify(BITS) ": " fmt
@@ -207,6 +207,7 @@ static __init int vdso_setup(struct lib_elfinfo *v)
 static __init void init_vdso_pagelist(void)
 {
 	int i;
+	struct page **vdso_pagelist;
 
 	/* Make sure pages are in the correct state */
 	vdso_pagelist = kzalloc(sizeof(struct page *) * (vdso_pages + 2),
@@ -221,6 +222,9 @@ static __init void init_vdso_pagelist(void)
 	}
 	vdso_pagelist[i++] = virt_to_page(vdso_data);
 	vdso_pagelist[i] = NULL;
+
+	vdso_mapping.pages = vdso_pagelist;
+	vdso_mapping.name = "[vdso]";
 }
 
 #undef find_section
@@ -236,7 +240,7 @@ static __init void init_vdso_pagelist(void)
 #undef VDSO_LBASE
 #undef vdso_kbase
 #undef vdso_pages
-#undef vdso_pagelist
+#undef vdso_mapping
 #undef lib_elfinfo
 #undef BITS
 #undef _CONCAT3
Signature · 7 lines
2.10.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#9 lore raw

PATCH v3 7/8 mm: kill arch_mremap

In reply to Dmitry Safonov

This reverts commit 4abad2ca4a4d ("mm: new arch_remap() hook") and commit 2ae416b142b6 ("mm: new mm hook framework").
It also keeps the same functionality of mremapping vDSO blob with introducing vm_special_mapping mremap op for powerpc. The same way it's being handled on x86.

Cc Laurent Dufour <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc "Kirill A. Shutemov" <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Oleg Nesterov <[email protected]>
Cc Andrew Morton <[email protected]>
---
 arch/alpha/include/asm/Kbuild            |  1 -
 arch/arc/include/asm/Kbuild              |  1 -
 arch/arm/include/asm/Kbuild              |  1 -
 arch/arm64/include/asm/Kbuild            |  1 -
 arch/avr32/include/asm/Kbuild            |  1 -
 arch/blackfin/include/asm/Kbuild         |  1 -
 arch/c6x/include/asm/Kbuild              |  1 -
 arch/cris/include/asm/Kbuild             |  1 -
 arch/frv/include/asm/Kbuild              |  1 -
 arch/h8300/include/asm/Kbuild            |  1 -
 arch/hexagon/include/asm/Kbuild          |  1 -
 arch/ia64/include/asm/Kbuild             |  1 -
 arch/m32r/include/asm/Kbuild             |  1 -
 arch/m68k/include/asm/Kbuild             |  1 -
 arch/metag/include/asm/Kbuild            |  1 -
 arch/microblaze/include/asm/Kbuild       |  1 -
 arch/mips/include/asm/Kbuild             |  1 -
 arch/mn10300/include/asm/Kbuild          |  1 -
 arch/nios2/include/asm/Kbuild            |  1 -
 arch/openrisc/include/asm/Kbuild         |  1 -
 arch/parisc/include/asm/Kbuild           |  1 -
 arch/powerpc/include/asm/mm-arch-hooks.h | 28 ----------------------------
 arch/powerpc/kernel/vdso.c               | 25 +++++++++++++++++++++++++
 arch/powerpc/kernel/vdso_common.c        |  1 +
 arch/s390/include/asm/Kbuild             |  1 -
 arch/score/include/asm/Kbuild            |  1 -
 arch/sh/include/asm/Kbuild               |  1 -
 arch/sparc/include/asm/Kbuild            |  1 -
 arch/tile/include/asm/Kbuild             |  1 -
 arch/um/include/asm/Kbuild               |  1 -
 arch/unicore32/include/asm/Kbuild        |  1 -
 arch/x86/include/asm/Kbuild              |  1 -
 arch/xtensa/include/asm/Kbuild           |  1 -
 include/asm-generic/mm-arch-hooks.h      | 16 ----------------
 include/linux/mm-arch-hooks.h            | 25 -------------------------
 mm/mremap.c                              |  4 ----
 36 files changed, 26 insertions(+), 103 deletions(-)
 delete mode 100644 arch/powerpc/include/asm/mm-arch-hooks.h
 delete mode 100644 include/asm-generic/mm-arch-hooks.h
 delete mode 100644 include/linux/mm-arch-hooks.h
arch/alpha/include/asm/Kbuild +0 -1
index bf8475ce85ee..0a5e0ec2842b 100644
@@ -6,7 +6,6 @@ generic-y += exec.h
 generic-y += export.h
 generic-y += irq_work.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += preempt.h
 generic-y += sections.h
 generic-y += trace_clock.h
arch/arc/include/asm/Kbuild +0 -1
index c332604606dd..e6059a808463 100644
@@ -22,7 +22,6 @@ generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += mman.h
 generic-y += msgbuf.h
 generic-y += msi.h
arch/arm/include/asm/Kbuild +0 -1
index 0745538b26d3..44b717cb4a55 100644
@@ -15,7 +15,6 @@ generic-y += irq_regs.h
 generic-y += kdebug.h
 generic-y += local.h
 generic-y += local64.h
-generic-y += mm-arch-hooks.h
 generic-y += msgbuf.h
 generic-y += msi.h
 generic-y += param.h
arch/arm64/include/asm/Kbuild +0 -1
index 44e1d7f10add..a42a1367aea4 100644
@@ -20,7 +20,6 @@ generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += mman.h
 generic-y += msgbuf.h
 generic-y += msi.h
arch/avr32/include/asm/Kbuild +0 -1
index 241b9b9729d8..519810d0d5e1 100644
@@ -12,7 +12,6 @@ generic-y += irq_work.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += param.h
 generic-y += percpu.h
 generic-y += preempt.h
arch/blackfin/include/asm/Kbuild +0 -1
index 91d49c0a3118..c80181e4454f 100644
@@ -21,7 +21,6 @@ generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += mman.h
 generic-y += msgbuf.h
 generic-y += mutex.h
arch/c6x/include/asm/Kbuild +0 -1
index 64465e7e2245..1b9cbed76cdd 100644
@@ -27,7 +27,6 @@ generic-y += kdebug.h
 generic-y += kmap_types.h
 generic-y += local.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += mman.h
 generic-y += mmu.h
 generic-y += mmu_context.h
arch/cris/include/asm/Kbuild +0 -1
index 1778805f6380..8e98d039780c 100644
@@ -24,7 +24,6 @@ generic-y += linkage.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += mman.h
 generic-y += module.h
 generic-y += msgbuf.h
arch/frv/include/asm/Kbuild +0 -1
index 1fa084cf1a43..2c987dc05af4 100644
@@ -4,7 +4,6 @@ generic-y += cputime.h
 generic-y += exec.h
 generic-y += irq_work.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += preempt.h
 generic-y += trace_clock.h
 generic-y += word-at-a-time.h
arch/h8300/include/asm/Kbuild +0 -1
index 373cb23301e3..2a63a32366f0 100644
@@ -33,7 +33,6 @@ generic-y += linkage.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += mman.h
 generic-y += mmu.h
 generic-y += mmu_context.h
arch/hexagon/include/asm/Kbuild +0 -1
index db8ddabc6bd2..0988816dded0 100644
@@ -28,7 +28,6 @@ generic-y += kmap_types.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += mman.h
 generic-y += msgbuf.h
 generic-y += pci.h
arch/ia64/include/asm/Kbuild +0 -1
index 502a91d8dbbd..dc05773e1f11 100644
@@ -4,7 +4,6 @@ generic-y += exec.h
 generic-y += irq_work.h
 generic-y += kvm_para.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += preempt.h
 generic-y += trace_clock.h
 generic-y += vtime.h
arch/m32r/include/asm/Kbuild +0 -1
index 860e440611c9..f09a5fdb3b77 100644
@@ -5,7 +5,6 @@ generic-y += exec.h
 generic-y += irq_work.h
 generic-y += kvm_para.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += module.h
 generic-y += preempt.h
 generic-y += sections.h
arch/m68k/include/asm/Kbuild +0 -1
index eb85bd9c6180..1555bc189c7d 100644
@@ -18,7 +18,6 @@ generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += mman.h
 generic-y += mutex.h
 generic-y += percpu.h
arch/metag/include/asm/Kbuild +0 -1
index 29acb89daaaa..611c0df2be39 100644
@@ -25,7 +25,6 @@ generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += msgbuf.h
 generic-y += mutex.h
 generic-y += param.h
arch/microblaze/include/asm/Kbuild +0 -1
index b0ae88c9fed9..cefeabae24cc 100644
@@ -6,7 +6,6 @@ generic-y += device.h
 generic-y += exec.h
 generic-y += irq_work.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += preempt.h
 generic-y += syscalls.h
 generic-y += trace_clock.h
arch/mips/include/asm/Kbuild +0 -1
index 9740066cc631..f0ce0ae0a358 100644
@@ -8,7 +8,6 @@ generic-y += emergency-restart.h
 generic-y += irq_work.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += mutex.h
 generic-y += parport.h
 generic-y += percpu.h
arch/mn10300/include/asm/Kbuild +0 -1
index 1c8dd0f5cd5d..27cbc0267b9c 100644
@@ -5,7 +5,6 @@ generic-y += cputime.h
 generic-y += exec.h
 generic-y += irq_work.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += preempt.h
 generic-y += sections.h
 generic-y += trace_clock.h
arch/nios2/include/asm/Kbuild +0 -1
index d63330e88379..e22478929719 100644
@@ -30,7 +30,6 @@ generic-y += kmap_types.h
 generic-y += kvm_para.h
 generic-y += local.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += mman.h
 generic-y += module.h
 generic-y += msgbuf.h
arch/openrisc/include/asm/Kbuild +0 -1
index 2832f031fb11..2a2e39b8109a 100644
@@ -36,7 +36,6 @@ generic-y += kmap_types.h
 generic-y += kvm_para.h
 generic-y += local.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += mman.h
 generic-y += module.h
 generic-y += msgbuf.h
arch/parisc/include/asm/Kbuild +0 -1
index f9b3a81aefcd..12b341d04f88 100644
@@ -15,7 +15,6 @@ generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += mutex.h
 generic-y += param.h
 generic-y += percpu.h
arch/powerpc/include/asm/mm-arch-hooks.h deleted +0 -28
deleted file mode 100644
index f2a2da895897..000000000000
@@ -1,28 +0,0 @@
-/*
- * Architecture specific mm hooks
- *
- * Copyright (C) 2015, IBM Corporation
- * Author: Laurent Dufour <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef _ASM_POWERPC_MM_ARCH_HOOKS_H
-#define _ASM_POWERPC_MM_ARCH_HOOKS_H
-
-static inline void arch_remap(struct mm_struct *mm,
-			      unsigned long old_start, unsigned long old_end,
-			      unsigned long new_start, unsigned long new_end)
-{
-	/*
-	 * mremap() doesn't allow moving multiple vmas so we can limit the
-	 * check to old_start == vdso_base.
-	 */
-	if (old_start == mm->context.vdso_base)
-		mm->context.vdso_base = new_start;
-}
-#define arch_remap arch_remap
-
-#endif /* _ASM_POWERPC_MM_ARCH_HOOKS_H */
arch/powerpc/kernel/vdso.c +25 -0
index 9ee3fd65c6e9..431bdf7ec68e 100644
@@ -143,6 +143,31 @@ struct lib64_elfinfo
 	unsigned long	text;
 };
 
+static int vdso_mremap(const struct vm_special_mapping *sm,
+		struct vm_area_struct *new_vma)
+{
+	unsigned long new_size = new_vma->vm_end - new_vma->vm_start;
+	unsigned long vdso_pages;
+
+	if (is_32bit_task())
+		vdso_pages = vdso32_pages;
+#ifdef CONFIG_PPC64
+	else
+		vdso_pages = vdso64_pages;
+#endif
+
+	/* Do not allow partial remap, +1 is for vDSO data page */
+	if (new_size != (vdso_pages + 1) << PAGE_SHIFT)
+		return -EINVAL;
+
+	if (WARN_ON_ONCE(current->mm != new_vma->vm_mm))
+		return -EFAULT;
+
+	current->mm->context.vdso_base = new_vma->vm_start;
+
+	return 0;
+}
+
 static int map_vdso(struct vm_special_mapping *vsm, unsigned long vdso_pages,
 		unsigned long vdso_base)
 {
arch/powerpc/kernel/vdso_common.c +1 -0
index 047f6b8b230f..11fdf3e8acc7 100644
@@ -225,6 +225,7 @@ static __init void init_vdso_pagelist(void)
 
 	vdso_mapping.pages = vdso_pagelist;
 	vdso_mapping.name = "[vdso]";
+	vdso_mapping.mremap = vdso_mremap;
 }
 
 #undef find_section
arch/s390/include/asm/Kbuild +0 -1
index 20f196b82a6e..c1ef8252cc20 100644
@@ -4,7 +4,6 @@ generic-y += clkdev.h
 generic-y += export.h
 generic-y += irq_work.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += preempt.h
 generic-y += trace_clock.h
 generic-y += word-at-a-time.h
arch/score/include/asm/Kbuild +0 -1
index a05218ff3fe4..ff19975beb33 100644
@@ -7,7 +7,6 @@ generic-y += clkdev.h
 generic-y += cputime.h
 generic-y += irq_work.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += preempt.h
 generic-y += sections.h
 generic-y += trace_clock.h
arch/sh/include/asm/Kbuild +0 -1
index 751c3373a92c..7d1fb2c7fcba 100644
@@ -17,7 +17,6 @@ generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += mman.h
 generic-y += msgbuf.h
 generic-y += param.h
arch/sparc/include/asm/Kbuild +0 -1
index cfc918067f80..0867d5ab7f87 100644
@@ -13,7 +13,6 @@ generic-y += linkage.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += module.h
 generic-y += mutex.h
 generic-y += preempt.h
arch/tile/include/asm/Kbuild +0 -1
index ba35c41c71ff..40d22b4a01f9 100644
@@ -19,7 +19,6 @@ generic-y += irq_regs.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += msgbuf.h
 generic-y += mutex.h
 generic-y += param.h
arch/um/include/asm/Kbuild +0 -1
index 904f3ebf4220..33c1d3e0caad 100644
@@ -16,7 +16,6 @@ generic-y += irq_regs.h
 generic-y += irq_work.h
 generic-y += kdebug.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += mutex.h
 generic-y += param.h
 generic-y += pci.h
arch/unicore32/include/asm/Kbuild +0 -1
index 256c45b3ae34..932070cd754a 100644
@@ -26,7 +26,6 @@ generic-y += kdebug.h
 generic-y += kmap_types.h
 generic-y += local.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += mman.h
 generic-y += module.h
 generic-y += msgbuf.h
arch/x86/include/asm/Kbuild +0 -1
index 2cfed174e3c9..51b3d95f05e9 100644
@@ -15,4 +15,3 @@ generic-y += cputime.h
 generic-y += dma-contiguous.h
 generic-y += early_ioremap.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
arch/xtensa/include/asm/Kbuild +0 -1
index 28cf4c5d65ef..bdade9995e36 100644
@@ -18,7 +18,6 @@ generic-y += linkage.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
 generic-y += percpu.h
 generic-y += preempt.h
 generic-y += resource.h
include/asm-generic/mm-arch-hooks.h deleted +0 -16
deleted file mode 100644
index 5ff0e5193f85..000000000000
@@ -1,16 +0,0 @@
-/*
- * Architecture specific mm hooks
- */
-
-#ifndef _ASM_GENERIC_MM_ARCH_HOOKS_H
-#define _ASM_GENERIC_MM_ARCH_HOOKS_H
-
-/*
- * This file should be included through arch/../include/asm/Kbuild for
- * the architecture which doesn't need specific mm hooks.
- *
- * In that case, the generic hooks defined in include/linux/mm-arch-hooks.h
- * are used.
- */
-
-#endif /* _ASM_GENERIC_MM_ARCH_HOOKS_H */
include/linux/mm-arch-hooks.h deleted +0 -25
deleted file mode 100644
index 4efc3f56e6df..000000000000
@@ -1,25 +0,0 @@
-/*
- * Generic mm no-op hooks.
- *
- * Copyright (C) 2015, IBM Corporation
- * Author: Laurent Dufour <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#ifndef _LINUX_MM_ARCH_HOOKS_H
-#define _LINUX_MM_ARCH_HOOKS_H
-
-#include <asm/mm-arch-hooks.h>
-
-#ifndef arch_remap
-static inline void arch_remap(struct mm_struct *mm,
-			      unsigned long old_start, unsigned long old_end,
-			      unsigned long new_start, unsigned long new_end)
-{
-}
-#define arch_remap arch_remap
-#endif
-
-#endif /* _LINUX_MM_ARCH_HOOKS_H */
mm/mremap.c +0 -4
index da22ad2a5678..5f1504c6cc77 100644
@@ -21,7 +21,6 @@
 #include <linux/syscalls.h>
 #include <linux/mmu_notifier.h>
 #include <linux/uaccess.h>
-#include <linux/mm-arch-hooks.h>
 
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
@@ -292,9 +291,6 @@ static unsigned long move_vma(struct vm_area_struct *vma,
 		old_len = new_len;
 		old_addr = new_addr;
 		new_addr = err;
-	} else {
-		arch_remap(mm, old_addr, old_addr + old_len,
-			   new_addr, new_addr + new_len);
 	}
 
 	/* Conceal VM_ACCOUNT so old reservation is not undone */
Signature · 7 lines
2.10.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#10 lore raw

PATCH v3 8/8 powerpc/vdso: remove arch_vma_name

In reply to Dmitry Safonov

It's not needed since vdso is inserted with vm_special_mapping which contains vma name.
This also reverts commit f2053f1a7bf6 ("powerpc/perf_counter: Fix vdso detection") as not needed anymore.
See also commit f7b6eb3fa072 ("x86: Set context.vdso before installing the mapping").

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Oleg Nesterov <[email protected]>
---
 arch/powerpc/kernel/vdso.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)
arch/powerpc/kernel/vdso.c +3 -17
index 431bdf7ec68e..f66f52aa94de 100644
@@ -208,13 +208,6 @@ static int map_vdso(struct vm_special_mapping *vsm, unsigned long vdso_pages,
 	vdso_base = ALIGN(vdso_base, VDSO_ALIGNMENT);
 
 	/*
-	 * Put vDSO base into mm struct. We need to do this before calling
-	 * install_special_mapping or the perf counter mmap tracking code
-	 * will fail to recognise it as a vDSO (since arch_vma_name fails).
-	 */
-	current->mm->context.vdso_base = vdso_base;
-
-	/*
 	 * our vma flags don't have VM_WRITE so by default, the process isn't
 	 * allowed to write those pages.
 	 * gdb can break that with ptrace interface, and thus trigger COW on
@@ -228,10 +221,10 @@ static int map_vdso(struct vm_special_mapping *vsm, unsigned long vdso_pages,
 				     VM_READ|VM_EXEC|
 				     VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
 				     vsm);
-	if (IS_ERR(vma)) {
+	if (IS_ERR(vma))
 		ret = PTR_ERR(vma);
-		current->mm->context.vdso_base = 0;
-	}
+	else
+		current->mm->context.vdso_base = vdso_base;
 
 out_up_mmap_sem:
 	up_write(&mm->mmap_sem);
@@ -262,13 +255,6 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 	return -1;
 }
 
-const char *arch_vma_name(struct vm_area_struct *vma)
-{
-	if (vma->vm_mm && vma->vm_start == vma->vm_mm->context.vdso_base)
-		return "[vdso]";
-	return NULL;
-}
-
 #ifdef CONFIG_VDSO32
 #include "vdso_common.c"
 #endif /* CONFIG_VDSO32 */
Signature · 7 lines
2.10.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#11 lore raw
In reply to Dmitry Safonov

2016-10-27 20:09 GMT+03:00 Dmitry Safonov <[email protected]>:

Quoted 59 lines

Changes since v1, v2:
- use vdso64_pages only under CONFIG_PPC64 (32-bit build fix)
- remove arch_vma_name helper as not needed anymore, simplify vdso_base pointer initializing in map_vdso()

Cleanup patches for vDSO on powerpc.
Originally, I wanted to add vDSO remapping on arm/aarch64 and I decided to cleanup that part on powerpc.
I've add a hook for vm_ops for vDSO just like I did for x86, which makes cross-arch arch_mremap hook no more needed. Other changes - reduce exhaustive code duplication by separating the common vdso code.

No visible to userspace changes expected.
Tested on qemu with buildroot rootfs.

Dmitry Safonov (8):
powerpc/vdso: unify return paths in setup_additional_pages powerpc/vdso: remove unused params in vdso_do_func_patch{32,64} powerpc/vdso: separate common code in vdso_common powerpc/vdso: introduce init_vdso{32,64}_pagelist powerpc/vdso: split map_vdso from arch_setup_additional_pages powerpc/vdso: switch from legacy_special_mapping_vmops
mm: kill arch_mremap
powerpc/vdso: remove arch_vma_name

 arch/alpha/include/asm/Kbuild            |   1 -
 arch/arc/include/asm/Kbuild              |   1 -
 arch/arm/include/asm/Kbuild              |   1 -
 arch/arm64/include/asm/Kbuild            |   1 -
 arch/avr32/include/asm/Kbuild            |   1 -
 arch/blackfin/include/asm/Kbuild         |   1 -
 arch/c6x/include/asm/Kbuild              |   1 -
 arch/cris/include/asm/Kbuild             |   1 -
 arch/frv/include/asm/Kbuild              |   1 -
 arch/h8300/include/asm/Kbuild            |   1 -
 arch/hexagon/include/asm/Kbuild          |   1 -
 arch/ia64/include/asm/Kbuild             |   1 -
 arch/m32r/include/asm/Kbuild             |   1 -
 arch/m68k/include/asm/Kbuild             |   1 -
 arch/metag/include/asm/Kbuild            |   1 -
 arch/microblaze/include/asm/Kbuild       |   1 -
 arch/mips/include/asm/Kbuild             |   1 -
 arch/mn10300/include/asm/Kbuild          |   1 -
 arch/nios2/include/asm/Kbuild            |   1 -
 arch/openrisc/include/asm/Kbuild         |   1 -
 arch/parisc/include/asm/Kbuild           |   1 -
 arch/powerpc/include/asm/mm-arch-hooks.h |  28 --
 arch/powerpc/kernel/vdso.c               | 502 +++++--------------------------
 arch/powerpc/kernel/vdso_common.c        | 248 +++++++++++++++
 arch/s390/include/asm/Kbuild             |   1 -
 arch/score/include/asm/Kbuild            |   1 -
 arch/sh/include/asm/Kbuild               |   1 -
 arch/sparc/include/asm/Kbuild            |   1 -
 arch/tile/include/asm/Kbuild             |   1 -
 arch/um/include/asm/Kbuild               |   1 -
 arch/unicore32/include/asm/Kbuild        |   1 -
 arch/x86/include/asm/Kbuild              |   1 -
 arch/xtensa/include/asm/Kbuild           |   1 -
Quoted 8 lines
 include/asm-generic/mm-arch-hooks.h      |  16 -
 include/linux/mm-arch-hooks.h            |  25 --
 mm/mremap.c                              |   4 -
 36 files changed, 324 insertions(+), 529 deletions(-)
 delete mode 100644 arch/powerpc/include/asm/mm-arch-hooks.h
 create mode 100644 arch/powerpc/kernel/vdso_common.c
 delete mode 100644 include/asm-generic/mm-arch-hooks.h
 delete mode 100644 include/linux/mm-arch-hooks.h

ping?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#12 lore raw
Quoted 3 lines · Dmitry Safonov

2016-10-27 20:09 GMT+03:00 Dmitry Safonov <[email protected]>:

ping?

There's another series doing some similar changes:

http://www.spinics.net/lists/linux-mm/msg115860.html

And I don't like all the macro games in 3/8, eg:

+#ifndef BITS
+#define BITS 32
+#endif
+
+#undef Elf_Ehdr
+#undef Elf_Sym
+#undef Elf_Shdr
+
+#define _CONCAT3(a, b, c) a ## b ## c
+#define CONCAT3(a, b, c) _CONCAT3(a, b, c)

+#define Elf_Ehdr	CONCAT3(Elf,  BITS, _Ehdr)
+#define Elf_Sym		CONCAT3(Elf,  BITS, _Sym)
+#define Elf_Shdr	CONCAT3(Elf,  BITS, _Shdr)

+#define VDSO_LBASE CONCAT3(VDSO, BITS, _LBASE)
+#define vdso_kbase CONCAT3(vdso, BITS, _kbase)
+#define vdso_pages CONCAT3(vdso, BITS, _pages)
+
+#undef pr_fmt
+#define pr_fmt(fmt) "vDSO" __stringify(BITS) ": " fmt
+
+#define lib_elfinfo CONCAT3(lib, BITS, _elfinfo)
+
+#define find_section CONCAT3(find_section, BITS,)
+static void * __init find_section(Elf_Ehdr *ehdr, const char *secname,
+ unsigned long *size)

I'd rather we kept the duplication of code than the obfuscation those macros add.

If we can come up with a way to share more of the code without having to do all those tricks then I'd be interested.

cheers

#13 lore raw
Quoted 9 lines · Michael Ellerman
Quoted 3 lines · Dmitry Safonov

2016-10-27 20:09 GMT+03:00 Dmitry Safonov <[email protected]>:

ping?

There's another series doing some similar changes:

http://www.spinics.net/lists/linux-mm/msg115860.html

Well, that version makes arch_mremap hook more general with renaming vdso pointer. While this series erases that hook totaly. So, we've agreed that it would be better without this hook, but with generic version of vdso_mremap special_mapping helper:
https://marc.info/[email protected]

Quoted 29 lines

And I don't like all the macro games in 3/8, eg:

(quoted diff) +25 -0
+#ifndef BITS
+#define BITS 32
+#endif
+
+#undef Elf_Ehdr
+#undef Elf_Sym
+#undef Elf_Shdr
+
+#define _CONCAT3(a, b, c)	a ## b ## c
+#define CONCAT3(a, b, c)	_CONCAT3(a, b, c)
+#define Elf_Ehdr	CONCAT3(Elf,  BITS, _Ehdr)
+#define Elf_Sym		CONCAT3(Elf,  BITS, _Sym)
+#define Elf_Shdr	CONCAT3(Elf,  BITS, _Shdr)
+#define VDSO_LBASE	CONCAT3(VDSO, BITS, _LBASE)
+#define vdso_kbase	CONCAT3(vdso, BITS, _kbase)
+#define vdso_pages	CONCAT3(vdso, BITS, _pages)
+
+#undef pr_fmt
+#define pr_fmt(fmt)	"vDSO" __stringify(BITS) ": " fmt
+
+#define lib_elfinfo CONCAT3(lib, BITS, _elfinfo)
+
+#define find_section CONCAT3(find_section, BITS,)
+static void * __init find_section(Elf_Ehdr *ehdr, const char *secname,
+		unsigned long *size)
Quoted 5 lines

I'd rather we kept the duplication of code than the obfuscation those macros add.

If we can come up with a way to share more of the code without having to do all those tricks then I'd be interested.

Well, ok, I thought it's quite common even outside of tracing:
e.g, fs/compat_binfmt_elf.c does quite the same trick. But as you find it obscured - than ok, I will resend without that common-vdso part.

Quoted 3 lines

cheers

Signature · 1 line
             Dmitry