* [PATCH -tip] x86: unification of module.c
@ 2009-03-26 13:08 Jaswinder Singh Rajput
2009-03-26 17:38 ` Thomas Gleixner
2009-03-26 22:12 ` Rusty Russell
0 siblings, 2 replies; 5+ messages in thread
From: Jaswinder Singh Rajput @ 2009-03-26 13:08 UTC (permalink / raw)
To: Ingo Molnar, x86 maintainers, LKML, Rusty Russell, Andi Kleen
This patch is based on -tip:x86/core:
From: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
Date: Thu, 26 Mar 2009 18:33:45 +0530
Subject: [PATCH] x86: unification of module.c
Impact: Unification, cleanup
Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
arch/x86/kernel/Makefile | 2 +-
arch/x86/kernel/module.c | 261 +++++++++++++++++++++++++++++++++++++++++++
arch/x86/kernel/module_32.c | 152 -------------------------
arch/x86/kernel/module_64.c | 194 --------------------------------
4 files changed, 262 insertions(+), 347 deletions(-)
create mode 100644 arch/x86/kernel/module.c
delete mode 100644 arch/x86/kernel/module_32.c
delete mode 100644 arch/x86/kernel/module_64.c
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 339ce35..87b1c05 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -72,7 +72,7 @@ obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o
obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o
obj-$(CONFIG_X86_VSMP) += vsmp_64.o
obj-$(CONFIG_KPROBES) += kprobes.o
-obj-$(CONFIG_MODULES) += module_$(BITS).o
+obj-$(CONFIG_MODULES) += module.o
obj-$(CONFIG_EFI) += efi.o efi_$(BITS).o efi_stub_$(BITS).o
obj-$(CONFIG_DOUBLEFAULT) += doublefault_32.o
obj-$(CONFIG_KGDB) += kgdb.o
diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c
new file mode 100644
index 0000000..051b4d0
--- /dev/null
+++ b/arch/x86/kernel/module.c
@@ -0,0 +1,261 @@
+/* Kernel module help for x86.
+ Copyright (C) 2001 Rusty Russell.
+ Copyright (C) 2002,2003 Andi Kleen, SuSE Labs.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+#include <linux/moduleloader.h>
+#include <linux/vmalloc.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/slab.h>
+#include <linux/bug.h>
+#include <linux/elf.h>
+#include <linux/fs.h>
+#include <linux/mm.h>
+
+#include <asm/pgtable.h>
+#include <asm/system.h>
+#include <asm/page.h>
+
+#define DEBUGP(fmt...)
+
+#if (defined(CONFIG_X86_32) || !defined(CONFIG_UML))
+
+#ifdef CONFIG_X86_64
+static inline void *module_vmalloc(unsigned long size)
+{
+ struct vm_struct *area;
+
+ size = PAGE_ALIGN(size);
+ if (size > MODULES_LEN)
+ return NULL;
+
+ area = __get_vm_area(size, VM_ALLOC, MODULES_VADDR, MODULES_END);
+ if (!area)
+ return NULL;
+
+ return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL_EXEC);
+}
+#else
+static inline void *module_vmalloc(unsigned long size)
+{
+ return vmalloc_exec(size);
+}
+#endif
+
+void *module_alloc(unsigned long size)
+{
+ if (size == 0)
+ return NULL;
+ return module_vmalloc(size);
+}
+
+
+/* Free memory returned from module_alloc */
+void module_free(struct module *mod, void *module_region)
+{
+ vfree(module_region);
+ /* FIXME: If module_region == mod->init_region, trim exception
+ table entries. */
+}
+#endif
+
+/* We don't need anything special. */
+int module_frob_arch_sections(Elf_Ehdr *hdr,
+ Elf_Shdr *sechdrs,
+ char *secstrings,
+ struct module *mod)
+{
+ return 0;
+}
+
+#ifdef CONFIG_X86_32
+int apply_relocate(Elf32_Shdr *sechdrs,
+ const char *strtab,
+ unsigned int symindex,
+ unsigned int relsec,
+ struct module *me)
+{
+ unsigned int i;
+ Elf32_Rel *rel = (void *)sechdrs[relsec].sh_addr;
+ Elf32_Sym *sym;
+ uint32_t *location;
+
+ DEBUGP("Applying relocate section %u to %u\n", relsec,
+ sechdrs[relsec].sh_info);
+ for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
+ /* This is where to make the change */
+ location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
+ + rel[i].r_offset;
+ /* This is the symbol it is referring to. Note that all
+ undefined symbols have been resolved. */
+ sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
+ + ELF32_R_SYM(rel[i].r_info);
+
+ switch (ELF32_R_TYPE(rel[i].r_info)) {
+ case R_386_32:
+ /* We add the value into the location given */
+ *location += sym->st_value;
+ break;
+ case R_386_PC32:
+ /* Add the value, subtract its postition */
+ *location += sym->st_value - (uint32_t)location;
+ break;
+ default:
+ printk(KERN_ERR "module %s: Unknown relocation: %u\n",
+ me->name, ELF32_R_TYPE(rel[i].r_info));
+ return -ENOEXEC;
+ }
+ }
+ return 0;
+}
+
+int apply_relocate_add(Elf32_Shdr *sechdrs,
+ const char *strtab,
+ unsigned int symindex,
+ unsigned int relsec,
+ struct module *me)
+{
+ printk(KERN_ERR "module %s: add relocation not supported\n", me->name);
+ return -ENOEXEC;
+}
+
+#else /* CONFIG_X86_32 */
+int apply_relocate_add(Elf64_Shdr *sechdrs,
+ const char *strtab,
+ unsigned int symindex,
+ unsigned int relsec,
+ struct module *me)
+{
+ unsigned int i;
+ Elf64_Rela *rel = (void *)sechdrs[relsec].sh_addr;
+ Elf64_Sym *sym;
+ void *loc;
+ u64 val;
+
+ DEBUGP("Applying relocate section %u to %u\n", relsec,
+ sechdrs[relsec].sh_info);
+ for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
+ /* This is where to make the change */
+ loc = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
+ + rel[i].r_offset;
+
+ /*
+ * This is the symbol it is referring to. Note that all
+ * undefined symbols have been resolved.
+ */
+ sym = (Elf64_Sym *)sechdrs[symindex].sh_addr
+ + ELF64_R_SYM(rel[i].r_info);
+
+ DEBUGP("type %d st_value %Lx r_addend %Lx loc %Lx\n",
+ (int)ELF64_R_TYPE(rel[i].r_info),
+ sym->st_value, rel[i].r_addend, (u64)loc);
+
+ val = sym->st_value + rel[i].r_addend;
+
+ switch (ELF64_R_TYPE(rel[i].r_info)) {
+ case R_X86_64_NONE:
+ break;
+ case R_X86_64_64:
+ *(u64 *)loc = val;
+ break;
+ case R_X86_64_32:
+ *(u32 *)loc = val;
+ if (val != *(u32 *)loc)
+ goto overflow;
+ break;
+ case R_X86_64_32S:
+ *(s32 *)loc = val;
+ if ((s64)val != *(s32 *)loc)
+ goto overflow;
+ break;
+ case R_X86_64_PC32:
+ val -= (u64)loc;
+ *(u32 *)loc = val;
+ break;
+ default:
+ printk(KERN_ERR "module %s: Unknown rela relocation: %llu\n",
+ me->name, ELF64_R_TYPE(rel[i].r_info));
+ return -ENOEXEC;
+ }
+ }
+ return 0;
+
+overflow:
+ printk(KERN_ERR "overflow in relocation type %d val %Lx\n",
+ (int)ELF64_R_TYPE(rel[i].r_info), val);
+ printk(KERN_ERR "`%s' likely not compiled with -mcmodel=kernel\n",
+ me->name);
+ return -ENOEXEC;
+}
+
+int apply_relocate(Elf_Shdr *sechdrs,
+ const char *strtab,
+ unsigned int symindex,
+ unsigned int relsec,
+ struct module *me)
+{
+ printk(KERN_ERR "module %s: add relocation not supported\n", me->name);
+ return -ENOSYS;
+}
+
+#endif /* CONFIG_X86_32 */
+
+int module_finalize(const Elf_Ehdr *hdr,
+ const Elf_Shdr *sechdrs,
+ struct module *me)
+{
+ const Elf_Shdr *s, *text = NULL, *alt = NULL, *locks = NULL,
+ *para = NULL;
+ char *secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
+
+ for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) {
+ if (!strcmp(".text", secstrings + s->sh_name))
+ text = s;
+ if (!strcmp(".altinstructions", secstrings + s->sh_name))
+ alt = s;
+ if (!strcmp(".smp_locks", secstrings + s->sh_name))
+ locks = s;
+ if (!strcmp(".parainstructions", secstrings + s->sh_name))
+ para = s;
+ }
+
+ if (alt) {
+ /* patch .altinstructions */
+ void *aseg = (void *)alt->sh_addr;
+ apply_alternatives(aseg, aseg + alt->sh_size);
+ }
+ if (locks && text) {
+ void *lseg = (void *)locks->sh_addr;
+ void *tseg = (void *)text->sh_addr;
+ alternatives_smp_module_add(me, me->name,
+ lseg, lseg + locks->sh_size,
+ tseg, tseg + text->sh_size);
+ }
+
+ if (para) {
+ void *pseg = (void *)para->sh_addr;
+ apply_paravirt(pseg, pseg + para->sh_size);
+ }
+
+ return module_bug_finalize(hdr, sechdrs, me);
+}
+
+void module_arch_cleanup(struct module *mod)
+{
+ alternatives_smp_module_del(mod);
+ module_bug_cleanup(mod);
+}
diff --git a/arch/x86/kernel/module_32.c b/arch/x86/kernel/module_32.c
deleted file mode 100644
index 0edd819..0000000
--- a/arch/x86/kernel/module_32.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/* Kernel module help for i386.
- Copyright (C) 2001 Rusty Russell.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-#include <linux/moduleloader.h>
-#include <linux/elf.h>
-#include <linux/vmalloc.h>
-#include <linux/fs.h>
-#include <linux/string.h>
-#include <linux/kernel.h>
-#include <linux/bug.h>
-
-#if 0
-#define DEBUGP printk
-#else
-#define DEBUGP(fmt...)
-#endif
-
-void *module_alloc(unsigned long size)
-{
- if (size == 0)
- return NULL;
- return vmalloc_exec(size);
-}
-
-
-/* Free memory returned from module_alloc */
-void module_free(struct module *mod, void *module_region)
-{
- vfree(module_region);
- /* FIXME: If module_region == mod->init_region, trim exception
- table entries. */
-}
-
-/* We don't need anything special. */
-int module_frob_arch_sections(Elf_Ehdr *hdr,
- Elf_Shdr *sechdrs,
- char *secstrings,
- struct module *mod)
-{
- return 0;
-}
-
-int apply_relocate(Elf32_Shdr *sechdrs,
- const char *strtab,
- unsigned int symindex,
- unsigned int relsec,
- struct module *me)
-{
- unsigned int i;
- Elf32_Rel *rel = (void *)sechdrs[relsec].sh_addr;
- Elf32_Sym *sym;
- uint32_t *location;
-
- DEBUGP("Applying relocate section %u to %u\n", relsec,
- sechdrs[relsec].sh_info);
- for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
- /* This is where to make the change */
- location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
- + rel[i].r_offset;
- /* This is the symbol it is referring to. Note that all
- undefined symbols have been resolved. */
- sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
- + ELF32_R_SYM(rel[i].r_info);
-
- switch (ELF32_R_TYPE(rel[i].r_info)) {
- case R_386_32:
- /* We add the value into the location given */
- *location += sym->st_value;
- break;
- case R_386_PC32:
- /* Add the value, subtract its postition */
- *location += sym->st_value - (uint32_t)location;
- break;
- default:
- printk(KERN_ERR "module %s: Unknown relocation: %u\n",
- me->name, ELF32_R_TYPE(rel[i].r_info));
- return -ENOEXEC;
- }
- }
- return 0;
-}
-
-int apply_relocate_add(Elf32_Shdr *sechdrs,
- const char *strtab,
- unsigned int symindex,
- unsigned int relsec,
- struct module *me)
-{
- printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n",
- me->name);
- return -ENOEXEC;
-}
-
-int module_finalize(const Elf_Ehdr *hdr,
- const Elf_Shdr *sechdrs,
- struct module *me)
-{
- const Elf_Shdr *s, *text = NULL, *alt = NULL, *locks = NULL,
- *para = NULL;
- char *secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
-
- for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) {
- if (!strcmp(".text", secstrings + s->sh_name))
- text = s;
- if (!strcmp(".altinstructions", secstrings + s->sh_name))
- alt = s;
- if (!strcmp(".smp_locks", secstrings + s->sh_name))
- locks = s;
- if (!strcmp(".parainstructions", secstrings + s->sh_name))
- para = s;
- }
-
- if (alt) {
- /* patch .altinstructions */
- void *aseg = (void *)alt->sh_addr;
- apply_alternatives(aseg, aseg + alt->sh_size);
- }
- if (locks && text) {
- void *lseg = (void *)locks->sh_addr;
- void *tseg = (void *)text->sh_addr;
- alternatives_smp_module_add(me, me->name,
- lseg, lseg + locks->sh_size,
- tseg, tseg + text->sh_size);
- }
-
- if (para) {
- void *pseg = (void *)para->sh_addr;
- apply_paravirt(pseg, pseg + para->sh_size);
- }
-
- return module_bug_finalize(hdr, sechdrs, me);
-}
-
-void module_arch_cleanup(struct module *mod)
-{
- alternatives_smp_module_del(mod);
- module_bug_cleanup(mod);
-}
diff --git a/arch/x86/kernel/module_64.c b/arch/x86/kernel/module_64.c
deleted file mode 100644
index c23880b..0000000
--- a/arch/x86/kernel/module_64.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/* Kernel module help for x86-64
- Copyright (C) 2001 Rusty Russell.
- Copyright (C) 2002,2003 Andi Kleen, SuSE Labs.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-#include <linux/moduleloader.h>
-#include <linux/elf.h>
-#include <linux/vmalloc.h>
-#include <linux/fs.h>
-#include <linux/string.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/slab.h>
-#include <linux/bug.h>
-
-#include <asm/system.h>
-#include <asm/page.h>
-#include <asm/pgtable.h>
-
-#define DEBUGP(fmt...)
-
-#ifndef CONFIG_UML
-void module_free(struct module *mod, void *module_region)
-{
- vfree(module_region);
- /* FIXME: If module_region == mod->init_region, trim exception
- table entries. */
-}
-
-void *module_alloc(unsigned long size)
-{
- struct vm_struct *area;
-
- if (!size)
- return NULL;
- size = PAGE_ALIGN(size);
- if (size > MODULES_LEN)
- return NULL;
-
- area = __get_vm_area(size, VM_ALLOC, MODULES_VADDR, MODULES_END);
- if (!area)
- return NULL;
-
- return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL_EXEC);
-}
-#endif
-
-/* We don't need anything special. */
-int module_frob_arch_sections(Elf_Ehdr *hdr,
- Elf_Shdr *sechdrs,
- char *secstrings,
- struct module *mod)
-{
- return 0;
-}
-
-int apply_relocate_add(Elf64_Shdr *sechdrs,
- const char *strtab,
- unsigned int symindex,
- unsigned int relsec,
- struct module *me)
-{
- unsigned int i;
- Elf64_Rela *rel = (void *)sechdrs[relsec].sh_addr;
- Elf64_Sym *sym;
- void *loc;
- u64 val;
-
- DEBUGP("Applying relocate section %u to %u\n", relsec,
- sechdrs[relsec].sh_info);
- for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
- /* This is where to make the change */
- loc = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
- + rel[i].r_offset;
-
- /* This is the symbol it is referring to. Note that all
- undefined symbols have been resolved. */
- sym = (Elf64_Sym *)sechdrs[symindex].sh_addr
- + ELF64_R_SYM(rel[i].r_info);
-
- DEBUGP("type %d st_value %Lx r_addend %Lx loc %Lx\n",
- (int)ELF64_R_TYPE(rel[i].r_info),
- sym->st_value, rel[i].r_addend, (u64)loc);
-
- val = sym->st_value + rel[i].r_addend;
-
- switch (ELF64_R_TYPE(rel[i].r_info)) {
- case R_X86_64_NONE:
- break;
- case R_X86_64_64:
- *(u64 *)loc = val;
- break;
- case R_X86_64_32:
- *(u32 *)loc = val;
- if (val != *(u32 *)loc)
- goto overflow;
- break;
- case R_X86_64_32S:
- *(s32 *)loc = val;
- if ((s64)val != *(s32 *)loc)
- goto overflow;
- break;
- case R_X86_64_PC32:
- val -= (u64)loc;
- *(u32 *)loc = val;
-#if 0
- if ((s64)val != *(s32 *)loc)
- goto overflow;
-#endif
- break;
- default:
- printk(KERN_ERR "module %s: Unknown rela relocation: %llu\n",
- me->name, ELF64_R_TYPE(rel[i].r_info));
- return -ENOEXEC;
- }
- }
- return 0;
-
-overflow:
- printk(KERN_ERR "overflow in relocation type %d val %Lx\n",
- (int)ELF64_R_TYPE(rel[i].r_info), val);
- printk(KERN_ERR "`%s' likely not compiled with -mcmodel=kernel\n",
- me->name);
- return -ENOEXEC;
-}
-
-int apply_relocate(Elf_Shdr *sechdrs,
- const char *strtab,
- unsigned int symindex,
- unsigned int relsec,
- struct module *me)
-{
- printk(KERN_ERR "non add relocation not supported\n");
- return -ENOSYS;
-}
-
-int module_finalize(const Elf_Ehdr *hdr,
- const Elf_Shdr *sechdrs,
- struct module *me)
-{
- const Elf_Shdr *s, *text = NULL, *alt = NULL, *locks = NULL,
- *para = NULL;
- char *secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
-
- for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) {
- if (!strcmp(".text", secstrings + s->sh_name))
- text = s;
- if (!strcmp(".altinstructions", secstrings + s->sh_name))
- alt = s;
- if (!strcmp(".smp_locks", secstrings + s->sh_name))
- locks = s;
- if (!strcmp(".parainstructions", secstrings + s->sh_name))
- para = s;
- }
-
- if (alt) {
- /* patch .altinstructions */
- void *aseg = (void *)alt->sh_addr;
- apply_alternatives(aseg, aseg + alt->sh_size);
- }
- if (locks && text) {
- void *lseg = (void *)locks->sh_addr;
- void *tseg = (void *)text->sh_addr;
- alternatives_smp_module_add(me, me->name,
- lseg, lseg + locks->sh_size,
- tseg, tseg + text->sh_size);
- }
-
- if (para) {
- void *pseg = (void *)para->sh_addr;
- apply_paravirt(pseg, pseg + para->sh_size);
- }
-
- return module_bug_finalize(hdr, sechdrs, me);
-}
-
-void module_arch_cleanup(struct module *mod)
-{
- alternatives_smp_module_del(mod);
- module_bug_cleanup(mod);
-}
--
1.6.0.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH -tip] x86: unification of module.c
2009-03-26 13:08 [PATCH -tip] x86: unification of module.c Jaswinder Singh Rajput
@ 2009-03-26 17:38 ` Thomas Gleixner
2009-03-26 22:34 ` Ingo Molnar
2009-03-26 22:12 ` Rusty Russell
1 sibling, 1 reply; 5+ messages in thread
From: Thomas Gleixner @ 2009-03-26 17:38 UTC (permalink / raw)
To: Jaswinder Singh Rajput
Cc: Ingo Molnar, x86 maintainers, LKML, Rusty Russell, Andi Kleen
On Thu, 26 Mar 2009, Jaswinder Singh Rajput wrote:
> This patch is based on -tip:x86/core:
>
> From: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> Date: Thu, 26 Mar 2009 18:33:45 +0530
> Subject: [PATCH] x86: unification of module.c
>
> Impact: Unification, cleanup
>
> Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> ---
> arch/x86/kernel/Makefile | 2 +-
> arch/x86/kernel/module.c | 261 +++++++++++++++++++++++++++++++++++++++++++
> arch/x86/kernel/module_32.c | 152 -------------------------
> arch/x86/kernel/module_64.c | 194 --------------------------------
> 4 files changed, 262 insertions(+), 347 deletions(-)
> create mode 100644 arch/x86/kernel/module.c
> delete mode 100644 arch/x86/kernel/module_32.c
> delete mode 100644 arch/x86/kernel/module_64.c
Sigh. We went through this before.
First make module_32 and module_64 the same if necessary in several
steps. The last step is to rename one of the files to module.c and
remove the other one.
This cobble all together approach is hard to review and error prone.
Thanks,
tglx
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -tip] x86: unification of module.c
2009-03-26 13:08 [PATCH -tip] x86: unification of module.c Jaswinder Singh Rajput
2009-03-26 17:38 ` Thomas Gleixner
@ 2009-03-26 22:12 ` Rusty Russell
1 sibling, 0 replies; 5+ messages in thread
From: Rusty Russell @ 2009-03-26 22:12 UTC (permalink / raw)
To: Jaswinder Singh Rajput; +Cc: Ingo Molnar, x86 maintainers, LKML, Andi Kleen
On Thursday 26 March 2009 23:38:33 Jaswinder Singh Rajput wrote:
> Impact: Unification, cleanup
...
> +#if (defined(CONFIG_X86_32) || !defined(CONFIG_UML))
> +
> +#ifdef CONFIG_X86_64
This looks wrong...
Rusty.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -tip] x86: unification of module.c
2009-03-26 17:38 ` Thomas Gleixner
@ 2009-03-26 22:34 ` Ingo Molnar
2009-03-29 14:47 ` Jaswinder Singh Rajput
0 siblings, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2009-03-26 22:34 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Jaswinder Singh Rajput, x86 maintainers, LKML, Rusty Russell,
Andi Kleen
* Thomas Gleixner <tglx@linutronix.de> wrote:
> On Thu, 26 Mar 2009, Jaswinder Singh Rajput wrote:
> > This patch is based on -tip:x86/core:
> >
> > From: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> > Date: Thu, 26 Mar 2009 18:33:45 +0530
> > Subject: [PATCH] x86: unification of module.c
> >
> > Impact: Unification, cleanup
> >
> > Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> > ---
> > arch/x86/kernel/Makefile | 2 +-
> > arch/x86/kernel/module.c | 261 +++++++++++++++++++++++++++++++++++++++++++
> > arch/x86/kernel/module_32.c | 152 -------------------------
> > arch/x86/kernel/module_64.c | 194 --------------------------------
> > 4 files changed, 262 insertions(+), 347 deletions(-)
> > create mode 100644 arch/x86/kernel/module.c
> > delete mode 100644 arch/x86/kernel/module_32.c
> > delete mode 100644 arch/x86/kernel/module_64.c
>
> Sigh. We went through this before.
>
> First make module_32 and module_64 the same if necessary in
> several steps. The last step is to rename one of the files to
> module.c and remove the other one.
>
> This cobble all together approach is hard to review and error
> prone.
Correct. There are countless examples of properly structured and
well executed unifications in the arch/x86 tree.
The most recent one has been done by Gustavo F. Padovan - and this
was one of this first complex contributions to Linux:
c577b09: x86, fixmap: unify fixmap.h
c78f322: x86, fixmap: prepare fixmap_32.h for unification
e365bcd: x86, fixmap: prepare fixmap_64.h for unification
5f403fa: x86, fixmap: add CONFIG_EFI
2ae38da: x86, fixmap: add CONFIG_X86_{LOCAL,IO}_APIC
fd862dd: x86, fixmap: define reserve_top_address for x86_64
ab93e3c: x86, fixmap: define FIXADDR_BOOT_* and redefine FIX_ADDR_SIZE
d09375a: x86, fixmap: rename __FIXADDR_SIZE and __FIXADDR_BOOT_SIZE
Please use this as a template - all-in-one patches for unifications
are not reviewable, not testable and not acceptable.
Ingo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -tip] x86: unification of module.c
2009-03-26 22:34 ` Ingo Molnar
@ 2009-03-29 14:47 ` Jaswinder Singh Rajput
0 siblings, 0 replies; 5+ messages in thread
From: Jaswinder Singh Rajput @ 2009-03-29 14:47 UTC (permalink / raw)
To: Ingo Molnar
Cc: Thomas Gleixner, x86 maintainers, LKML, Rusty Russell, Andi Kleen
On Thu, 2009-03-26 at 23:34 +0100, Ingo Molnar wrote:
> * Thomas Gleixner <tglx@linutronix.de> wrote:
>
> > On Thu, 26 Mar 2009, Jaswinder Singh Rajput wrote:
> > > This patch is based on -tip:x86/core:
> > >
> > > From: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> > > Date: Thu, 26 Mar 2009 18:33:45 +0530
> > > Subject: [PATCH] x86: unification of module.c
> > >
> > > Impact: Unification, cleanup
> > >
> > > Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> > > ---
> > > arch/x86/kernel/Makefile | 2 +-
> > > arch/x86/kernel/module.c | 261 +++++++++++++++++++++++++++++++++++++++++++
> > > arch/x86/kernel/module_32.c | 152 -------------------------
> > > arch/x86/kernel/module_64.c | 194 --------------------------------
> > > 4 files changed, 262 insertions(+), 347 deletions(-)
> > > create mode 100644 arch/x86/kernel/module.c
> > > delete mode 100644 arch/x86/kernel/module_32.c
> > > delete mode 100644 arch/x86/kernel/module_64.c
> >
> > Sigh. We went through this before.
> >
> > First make module_32 and module_64 the same if necessary in
> > several steps. The last step is to rename one of the files to
> > module.c and remove the other one.
> >
> > This cobble all together approach is hard to review and error
> > prone.
>
> Correct. There are countless examples of properly structured and
> well executed unifications in the arch/x86 tree.
>
> The most recent one has been done by Gustavo F. Padovan - and this
> was one of this first complex contributions to Linux:
>
> c577b09: x86, fixmap: unify fixmap.h
> c78f322: x86, fixmap: prepare fixmap_32.h for unification
> e365bcd: x86, fixmap: prepare fixmap_64.h for unification
> 5f403fa: x86, fixmap: add CONFIG_EFI
> 2ae38da: x86, fixmap: add CONFIG_X86_{LOCAL,IO}_APIC
> fd862dd: x86, fixmap: define reserve_top_address for x86_64
> ab93e3c: x86, fixmap: define FIXADDR_BOOT_* and redefine FIX_ADDR_SIZE
> d09375a: x86, fixmap: rename __FIXADDR_SIZE and __FIXADDR_BOOT_SIZE
>
> Please use this as a template - all-in-one patches for unifications
> are not reviewable, not testable and not acceptable.
>
OK, pull request withdrawn.
Thanks,
--
JSR
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-03-29 14:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-26 13:08 [PATCH -tip] x86: unification of module.c Jaswinder Singh Rajput
2009-03-26 17:38 ` Thomas Gleixner
2009-03-26 22:34 ` Ingo Molnar
2009-03-29 14:47 ` Jaswinder Singh Rajput
2009-03-26 22:12 ` Rusty Russell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox