split exception table content out of module.h into extable.h
Subsystems (14)
cover split exception table content out of module.h into extable.h
[RFC: Not looking for detailed review given the merge window is open.
As long as nobody thinks the general idea is horrible, I'll expand into more fringe arch and resend in 2wks and get it added then to linux-next.]
While doing an audit looking for unnecessary instances of module.h inclusion across arch/x86/ I found a significant number of includes of module.h were for things like search_exception_table and friends.
For historical reasons (i.e. pre-git) the exception table stuff was buried in the middle of the module.h file. So we have core kernel files that are completely non-modular (both arch specific and arch independent) that are just including module.h for this.
The converse is also true, in that conventional drivers, be they for filesystems or actual hardware peripherals or similar, do not normally care about the exception tables.
Here we fork the exception table content out of module.h into a new extable.h file. The gain here is that module.h gets a bit smaller; a win for all modular drivers that we build for allmodconfig. Also most core files that only need exception table stuff get to shed an include of module.h that brings in lots of extra stuff and just looks generally out of place. They use the tiny extable.h instead.
We temporarily include extable.h into the module.h itself. Then we will work our way across the arch independent and arch specific files needing just exception table content, and move them off module.h and onto extable.h
Once that is done, we can remove the extable.h from module.h and in doing it like this, we avoid introducing build failures into the git history.
We have the option of taking this final one line commit and pushing it out a complete release if we want to open up a bigger window for converting some of the more fringe archtectures.
I've converted about a dozen architectures here w/o issue; that largely reflects what I currently have toolchains for. Build testing seems necessary in all instances, since the odds are high that the module.h presence was hiding implicit use of other headers, as was the case for s390.
Paul.
Signature · 89 lines
Cc: Andrew Morton <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Chris Metcalf <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Helge Deller <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Ivan Kokshaysky <[email protected]> Cc: "James E.J. Bottomley" <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Martin Schwidefsky <[email protected]> Cc: Matt Turner <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: Richard Henderson <[email protected]> Cc: Russell King <[email protected]> Cc: Rusty Russell <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Will Deacon <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Paul Gortmaker (14): exceptions: fork exception table content from module.h into extable.h x86: migrate exception table users off module.h and onto extable.h arm: migrate exception table users off module.h and onto extable.h arm64: migrate exception table users off module.h and onto extable.h mips: migrate exception table users off module.h and onto extable.h sparc: migrate exception table users off module.h and onto extable.h powerpc: migrate exception table users off module.h and onto extable.h m68k: migrate exception table users off module.h and onto extable.h s390: migrate exception table users off module.h and onto extable.h tile: migrate exception table users off module.h and onto extable.h alpha: migrate exception table users off module.h and onto extable.h parisc: migrate exception table users off module.h and onto extable.h core: migrate exception table users off module.h and onto extable.h module.h: remove extable.h include now users have migrated arch/alpha/kernel/traps.c | 2 +- arch/alpha/mm/fault.c | 2 +- arch/arm/mm/extable.c | 2 +- arch/arm/mm/fault.c | 2 +- arch/arm64/kernel/probes/kprobes.c | 2 +- arch/arm64/mm/extable.c | 2 +- arch/arm64/mm/fault.c | 2 +- arch/m68k/kernel/signal.c | 2 +- arch/mips/kernel/module.c | 1 + arch/mips/kernel/traps.c | 2 +- arch/mips/mm/extable.c | 2 +- arch/parisc/mm/fault.c | 2 +- arch/powerpc/kernel/kprobes.c | 2 +- arch/powerpc/mm/fault.c | 2 +- arch/s390/kernel/early.c | 2 +- arch/s390/kernel/kprobes.c | 2 ++ arch/s390/kernel/traps.c | 3 ++- arch/s390/mm/fault.c | 2 +- arch/sparc/kernel/kprobes.c | 2 +- arch/sparc/kernel/traps_64.c | 2 +- arch/sparc/kernel/unaligned_64.c | 2 +- arch/sparc/mm/fault_64.c | 2 +- arch/sparc/mm/init_64.c | 2 +- arch/tile/kernel/unaligned.c | 2 +- arch/tile/mm/extable.c | 2 +- arch/tile/mm/fault.c | 2 +- arch/x86/kernel/kprobes/core.c | 2 +- arch/x86/kernel/kprobes/opt.c | 2 +- arch/x86/mm/extable.c | 2 +- arch/x86/mm/fault.c | 2 +- include/linux/extable.h | 30 ++++++++++++++++++++++++++++++ include/linux/module.h | 26 +------------------------- init/main.c | 1 + kernel/extable.c | 1 + kernel/module.c | 1 + 35 files changed, 66 insertions(+), 53 deletions(-) create mode 100644 include/linux/extable.h -- 2.8.4
PATCH 1/14 exceptions: fork exception table content from module.h into extable.h
For historical reasons (i.e. pre-git) the exception table stuff was buried in the middle of the module.h file. I noticed this while doing an audit for needless includes of module.h and found core kernel files (both arch specific and arch independent) were just including module.h for this.
The converse is also true, in that conventional drivers, be they for filesystems or actual hardware peripherals or similar, do not normally care about the exception tables.
Here we fork the exception table content out of module.h into a new file called extable.h -- and temporarily include it into the module.h itself.
Then we will work our way across the arch independent and arch specific files needing just exception table content, and move them off module.h and onto extable.h
Once that is done, we can remove the extable.h from module.h and in doing it like this, we avoid introducing build failures into the git history.
The gain here is that module.h gets a bit smaller, across all modular drivers that we build for allmodconfig. Also the core files that only need exception table stuff don't have an include of module.h that brings in lots of extra stuff and just looks generally out of place.
--- include/linux/extable.h | 30 ++++++++++++++++++++++++++++++ include/linux/module.h | 27 ++------------------------- 2 files changed, 32 insertions(+), 25 deletions(-) create mode 100644 include/linux/extable.h
include/linux/extable.h new file +30 -0
@@ -0,0 +1,30 @@ +#ifndef _LINUX_EXTABLE_H +#define _LINUX_EXTABLE_H + +struct module ; +struct exception_table_entry ; + +const struct exception_table_entry * +search_extable (const struct exception_table_entry *first, +const struct exception_table_entry *last, +unsigned long value); +void sort_extable (struct exception_table_entry *start, +struct exception_table_entry *finish); +void sort_main_extable (void ); +void trim_init_extable (struct module *m); + +/* Given an address, look for it in the exception tables */ +const struct exception_table_entry *search_exception_tables (unsigned long add); + +#ifdef CONFIG_MODULES +/* For extable.c to search modules' exception tables. */ +const struct exception_table_entry *search_module_extables (unsigned long addr); +#else +static inline const struct exception_table_entry * +search_module_extables (unsigned long addr) +{ +return NULL ; +} +#endif /*CONFIG_MODULES*/ + +#endif /* _LINUX_EXTABLE_H */
include/linux/module.h +2 -25
@@ -18,6 +18,7 @@#include <linux/moduleparam.h> #include <linux/jump_label.h> #include <linux/export.h> +#include <linux/extable.h> /* only as arch move module.h -> extable.h */ #include <linux/rbtree_latch.h> #include <linux/percpu.h>
@@ -37,6 +38,7 @@ struct modversion_info { };struct module ; +struct exception_table_entry ;struct module_kobject {struct kobject kobj;
@@ -155,18 +157,6 @@ extern void cleanup_module(void);#define __INITRODATA_OR_MODULE __INITRODATA#endif /*CONFIG_MODULES*/ -/* Archs provide a method of finding the correct exception table. */ -struct exception_table_entry ; - -const struct exception_table_entry * -search_extable (const struct exception_table_entry *first, -const struct exception_table_entry *last, -unsigned long value); -void sort_extable (struct exception_table_entry *start, -struct exception_table_entry *finish); -void sort_main_extable (void ); -void trim_init_extable (struct module *m); -/* Generic info of form tag = "info" */ #define MODULE_INFO (tag, info) __MODULE_INFO(tag, tag, info)
@@ -268,9 +258,6 @@ extern const typeof(name) __mod_##type##__##name##_device_table \* files require multiple MODULE_FIRMWARE() specifiers */ #define MODULE_FIRMWARE (_firmware) MODULE_INFO(firmware, _firmware) -/* Given an address, look for it in the exception tables */ -const struct exception_table_entry *search_exception_tables (unsigned long add); -struct notifier_block ;#ifdef CONFIG_MODULES
@@ -630,9 +617,6 @@ const char *module_address_lookup(unsigned long addr,int lookup_module_symbol_name (unsigned long addr,char *symname);int lookup_module_symbol_attrs (unsigned long addr,unsigned long *size,unsigned long *offset,char *modname,char *name); -/* For extable.c to search modules' exception tables. */ -const struct exception_table_entry *search_module_extables (unsigned long addr); -int register_module_notifier (struct notifier_block *nb);int unregister_module_notifier (struct notifier_block *nb);
@@ -657,13 +641,6 @@ static inline bool is_livepatch_module(struct module *mod)#else /* !CONFIG_MODULES... */ -/* Given an address, look for it in the exception tables. */ -static inline const struct exception_table_entry * -search_module_extables (unsigned long addr) -{ -return NULL ; -} -static inline struct module *__module_address (unsigned long addr) {return NULL ;
Signature · 1 line
2.8.4
Re: [PATCH 01/14] exceptions: fork exception table content from module.h into extable.h
Quoted 5 lines · Paul Gortmaker
For historical reasons (i.e. pre-git) the exception table stuff was buried in the middle of the
module.hfile. I noticed this while doing an audit for needless includes ofmodule.hand found core kernel files (both arch specific and arch independent) were just includingmodule.hfor this.
I'm going to include this first patch now; it's trivial, and allows the rest of the changes to proceed at the archs' leisure.
I have another patch series which had to be tweaked, so I'm deferring the push to Linus for a couple of days stewing in linux-next anyway.
Thanks,
Rusty.
Quoted 143 lines
The converse is also true, in that conventional drivers, be they for filesystems or actual hardware peripherals or similar, do not normally care about the exception tables.
Here we fork the exception table content out of
module.hinto a new file calledextable.h-- and temporarily include it into themodule.hitself.Then we will work our way across the arch independent and arch specific files needing just exception table content, and move them off
module.hand ontoextable.hOnce that is done, we can remove the
extable.hfrommodule.hand in doing it like this, we avoid introducing build failures into the git history.The gain here is that
module.hgets a bit smaller, across all modular drivers that we build for allmodconfig. Also the core files that only need exception table stuff don't have an include ofmodule.hthat brings in lots of extra stuff and just looks generally out of place.Cc Rusty Russell <[email protected]>Cc Andrew Morton <[email protected]>Cc Linus Torvalds <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>--- include/linux/extable.h | 30 ++++++++++++++++++++++++++++++ include/linux/module.h | 27 ++------------------------- 2 files changed, 32 insertions(+), 25 deletions(-) create mode 100644 include/linux/extable.hinclude/linux/extable.h new file +30
-0@@ -0,0 +1,30 @@ +#ifndef _LINUX_EXTABLE_H +#define _LINUX_EXTABLE_H + +struct module ; +struct exception_table_entry ; + +const struct exception_table_entry * +search_extable (const struct exception_table_entry *first, +const struct exception_table_entry *last, +unsigned long value); +void sort_extable (struct exception_table_entry *start, +struct exception_table_entry *finish); +void sort_main_extable (void ); +void trim_init_extable (struct module *m); + +/* Given an address, look for it in the exception tables */ +const struct exception_table_entry *search_exception_tables (unsigned long add); + +#ifdef CONFIG_MODULES +/* For extable.c to search modules' exception tables. */ +const struct exception_table_entry *search_module_extables (unsigned long addr); +#else +static inline const struct exception_table_entry * +search_module_extables (unsigned long addr) +{ +return NULL ; +} +#endif /*CONFIG_MODULES*/ + +#endif /* _LINUX_EXTABLE_H */ include/linux/module.h +2
-25@@ -18,6 +18,7 @@#include <linux/moduleparam.h> #include <linux/jump_label.h> #include <linux/export.h> +#include <linux/extable.h> /* only as arch move module.h -> extable.h */ #include <linux/rbtree_latch.h> #include <linux/percpu.h> @@ -37,6 +38,7 @@ struct modversion_info { };struct module ; +struct exception_table_entry ;struct module_kobject {struct kobject kobj;@@ -155,18 +157,6 @@ extern void cleanup_module(void);#define __INITRODATA_OR_MODULE __INITRODATA#endif /*CONFIG_MODULES*/ -/* Archs provide a method of finding the correct exception table. */ -struct exception_table_entry ; - -const struct exception_table_entry * -search_extable (const struct exception_table_entry *first, -const struct exception_table_entry *last, -unsigned long value); -void sort_extable (struct exception_table_entry *start, -struct exception_table_entry *finish); -void sort_main_extable (void ); -void trim_init_extable (struct module *m); -/* Generic info of form tag = "info" */ #define MODULE_INFO (tag, info) __MODULE_INFO(tag, tag, info)@@ -268,9 +258,6 @@ extern const typeof(name) __mod_##type##__##name##_device_table \* files require multiple MODULE_FIRMWARE() specifiers */ #define MODULE_FIRMWARE (_firmware) MODULE_INFO(firmware, _firmware) -/* Given an address, look for it in the exception tables */ -const struct exception_table_entry *search_exception_tables (unsigned long add); -struct notifier_block ;#ifdef CONFIG_MODULES @@ -630,9 +617,6 @@ const char *module_address_lookup(unsigned long addr,int lookup_module_symbol_name (unsigned long addr,char *symname);int lookup_module_symbol_attrs (unsigned long addr,unsigned long *size,unsigned long *offset,char *modname,char *name); -/* For extable.c to search modules' exception tables. */ -const struct exception_table_entry *search_module_extables (unsigned long addr); -int register_module_notifier (struct notifier_block *nb);int unregister_module_notifier (struct notifier_block *nb);@@ -657,13 +641,6 @@ static inline bool is_livepatch_module(struct module *mod)#else /* !CONFIG_MODULES... */ -/* Given an address, look for it in the exception tables. */ -static inline const struct exception_table_entry * -search_module_extables (unsigned long addr) -{ -return NULL ; -} -static inline struct module *__module_address (unsigned long addr) {return NULL ;Signature · 1 line
2.8.4
PATCH 2/14 x86: migrate exception table users off module.h and onto extable.h
In reply to Paul GortmakerThese files were only including module.h for exception table related functions. We've now separated that content out into its own file "extable.h" so now move over to that and avoid all the extra header content in module.h that we don't really need to compile these files.
--- arch/x86/kernel/kprobes/core.c | 2 +- arch/x86/kernel/kprobes/opt.c | 2 +- arch/x86/mm/extable.c | 2 +- arch/x86/mm/fault.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/kprobes/core.c +1 -1
@@ -45,7 +45,7 @@#include <linux/slab.h> #include <linux/hardirq.h> #include <linux/preempt.h> -#include <linux/module.h> +#include <linux/extable.h> #include <linux/kdebug.h> #include <linux/kallsyms.h> #include <linux/ftrace.h>
arch/x86/kernel/kprobes/opt.c +1 -1
@@ -24,7 +24,7 @@#include <linux/slab.h> #include <linux/hardirq.h> #include <linux/preempt.h> -#include <linux/module.h> +#include <linux/extable.h> #include <linux/kdebug.h> #include <linux/kallsyms.h> #include <linux/ftrace.h>
arch/x86/mm/extable.c +1 -1
@@ -1,4 +1,4 @@ -#include <linux/module.h> +#include <linux/extable.h> #include <asm/uaccess.h> #include <asm/traps.h> #include <asm/kdebug.h>
arch/x86/mm/fault.c +1 -1
@@ -5,7 +5,7 @@*/ #include <linux/sched.h> /* test_thread_flag(), ... */ #include <linux/kdebug.h> /* oops_begin/end, ... */ -#include <linux/module.h> /* search_exception_table */ +#include <linux/extable.h> /* search_exception_table */ #include <linux/bootmem.h> /* max_low_pfn */ #include <linux/kprobes.h> /* NOKPROBE_SYMBOL, ... */ #include <linux/mmiotrace.h> /* kmmio_handler, ... */
Signature · 1 line
2.8.4
Re: [PATCH 02/14] x86: migrate exception table users off module.h and onto extable.h
Quoted 11 lines · Paul Gortmaker
These files were only including
module.hfor exception table related functions. We've now separated that content out into its own file "extable.h" so now move over to that and avoid all the extra header content inmodule.hthat we don't really need to compile these files.Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc "H. Peter Anvin" <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>
Thanks,
Ingo
PATCH 3/14 arm: migrate exception table users off module.h and onto extable.h
In reply to Paul GortmakerThese files were only including module.h for exception table related functions. We've now separated that content out into its own file "extable.h" so now move over to that and avoid all the extra header content in module.h that we don't really need to compile these files.
--- arch/arm/mm/extable.c | 2 +- arch/arm/mm/fault.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mm/extable.c +1 -1
@@ -1,7 +1,7 @@/* * linux/arch/arm/mm/extable.c */ -#include <linux/module.h> +#include <linux/extable.h> #include <linux/uaccess.h> int fixup_exception (struct pt_regs *regs)
arch/arm/mm/fault.c +1 -1
@@ -8,7 +8,7 @@* it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ -#include <linux/module.h> +#include <linux/extable.h> #include <linux/signal.h> #include <linux/mm.h> #include <linux/hardirq.h>
Signature · 1 line
2.8.4
PATCH 4/14 arm64: migrate exception table users off module.h and onto extable.h
In reply to Paul GortmakerThese files were only including module.h for exception table related functions. We've now separated that content out into its own file "extable.h" so now move over to that and avoid all the extra header content in module.h that we don't really need to compile these files.
--- arch/arm64/kernel/probes/kprobes.c | 2 +- arch/arm64/mm/extable.c | 2 +- arch/arm64/mm/fault.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
arch/arm64/kernel/probes/kprobes.c +1 -1
@@ -19,7 +19,7 @@#include <linux/kasan.h> #include <linux/kernel.h> #include <linux/kprobes.h> -#include <linux/module.h> +#include <linux/extable.h> #include <linux/slab.h> #include <linux/stop_machine.h> #include <linux/stringify.h>
arch/arm64/mm/extable.c +1 -1
@@ -2,7 +2,7 @@* Based on arch/arm/mm/extable.c */ -#include <linux/module.h> +#include <linux/extable.h> #include <linux/uaccess.h> int fixup_exception (struct pt_regs *regs)
arch/arm64/mm/fault.c +1 -1
@@ -18,7 +18,7 @@* along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <linux/module.h> +#include <linux/extable.h> #include <linux/signal.h> #include <linux/mm.h> #include <linux/hardirq.h>
Signature · 1 line
2.8.4
Re: [PATCH 04/14] arm64: migrate exception table users off module.h and onto extable.h
Quoted 10 lines · Paul Gortmaker
These files were only including
module.hfor exception table related functions. We've now separated that content out into its own file "extable.h" so now move over to that and avoid all the extra header content inmodule.hthat we don't really need to compile these files.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc linux-arm-kernel at lists.infradead.orgSigned-off-by Paul Gortmaker <[email protected]>
PATCH 5/14 mips: migrate exception table users off module.h and onto extable.h
In reply to Paul GortmakerThese files were only including module.h for exception table related functions. We've now separated that content out into its own file "extable.h" so now move over to that and avoid all the extra header content in module.h that we don't really need to compile these files.
--- arch/mips/kernel/module.c | 1 + arch/mips/kernel/traps.c | 2 +- arch/mips/mm/extable.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-)
arch/mips/kernel/module.c +1 -0
@@ -20,6 +20,7 @@#undef DEBUG +#include <linux/extable.h> #include <linux/moduleloader.h> #include <linux/elf.h> #include <linux/mm.h>
arch/mips/kernel/traps.c +1 -1
@@ -20,7 +20,7 @@#include <linux/kexec.h> #include <linux/init.h> #include <linux/kernel.h> -#include <linux/module.h> +#include <linux/extable.h> #include <linux/mm.h> #include <linux/sched.h> #include <linux/smp.h>
arch/mips/mm/extable.c +1 -1
@@ -5,7 +5,7 @@* * Copyright (C) 1997, 99, 2001 - 2004 Ralf Baechle <[email protected]> */ -#include <linux/module.h> +#include <linux/extable.h> #include <linux/spinlock.h> #include <asm/branch.h> #include <asm/uaccess.h>
Signature · 1 line
2.8.4
kbuild test robot
build botRe: [PATCH 05/14] mips: migrate exception table users off module.h and onto extable.h
url: https://github.com/0day-ci/linux/commits/Paul-Gortmaker/split-exception-table-content-out-of-module-h-into-extable-h/20160725-152314 config: mips-jz4740 (attached as .config) compiler…
Hi,
[auto build test ERROR on next-20160724]
[cannot apply to stable/master linus/master linux/master v4.7-rc7 v4.7-rc6 v4.7-rc5 v4.7] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Paul-Gortmaker/split-exception-table-content-out-of-module-h-into-extable-h/20160725-152314
config: mips-jz4740 (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 5.4.0-6) 5.4.0 20160609
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips
All errors (new ones prefixed by >>):
arch/mips/kernel/traps.c: In function 'show_registers':
>> arch/mips/kernel/traps.c:354:2: error: implicit declaration of function 'print_modules' [-Werror=implicit-function-declaration]
print_modules();
^cc1: some warnings being treated as errors
vim +/print_modules +354 arch/mips/kernel/traps.c
c1bf207d David Daney 2010-08-03 348 void show_registers(struct pt_regs *regs)
^1da177e Linus Torvalds 2005-04-16 349 {
39b8d525 Ralf Baechle 2008-04-28 350 const int field = 2 * sizeof(unsigned long);
83e4da1e Leonid Yegoshin 2013-10-08 351 mm_segment_t old_fs = get_fs();
39b8d525 Ralf Baechle 2008-04-28 352
eae23f2c Ralf Baechle 2007-10-14 353 __show_regs(regs);
^1da177e Linus Torvalds 2005-04-16 @354 print_modules();
39b8d525 Ralf Baechle 2008-04-28 355 printk("Process %s (pid: %d, threadinfo=%p, task=%p, tls=%0*lx)\n",
39b8d525 Ralf Baechle 2008-04-28 356 current->comm, current->pid, current_thread_info(), current,
39b8d525 Ralf Baechle 2008-04-28 357 field, current_thread_info()->tp_value);:::::: The code at line 354 was first introduced by commit :::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <[email protected]> :::::: CC: Linus Torvalds <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH 6/14 sparc: migrate exception table users off module.h and onto extable.h
In reply to Paul GortmakerThese files were only including module.h for exception table related functions. We've now separated that content out into its own file "extable.h" so now move over to that and avoid all the extra header content in module.h that we don't really need to compile these files.
--- arch/sparc/kernel/kprobes.c | 2 +- arch/sparc/kernel/traps_64.c | 2 +- arch/sparc/kernel/unaligned_64.c | 2 +- arch/sparc/mm/fault_64.c | 2 +- arch/sparc/mm/init_64.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
arch/sparc/kernel/kprobes.c +1 -1
@@ -5,7 +5,7 @@#include <linux/kernel.h> #include <linux/kprobes.h> -#include <linux/module.h> +#include <linux/extable.h> #include <linux/kdebug.h> #include <linux/slab.h> #include <linux/context_tracking.h>
arch/sparc/kernel/traps_64.c +1 -1
@@ -8,7 +8,7 @@* I like traps on v9, :)))) */ -#include <linux/module.h> +#include <linux/extable.h> #include <linux/sched.h> #include <linux/linkage.h> #include <linux/kernel.h>
arch/sparc/kernel/unaligned_64.c +1 -1
@@ -11,7 +11,7 @@#include <linux/kernel.h> #include <linux/sched.h> #include <linux/mm.h> -#include <linux/module.h> +#include <linux/extable.h> #include <asm/asi.h> #include <asm/ptrace.h> #include <asm/pstate.h>
arch/sparc/mm/fault_64.c +1 -1
@@ -14,7 +14,7 @@#include <linux/mman.h> #include <linux/signal.h> #include <linux/mm.h> -#include <linux/module.h> +#include <linux/extable.h> #include <linux/init.h> #include <linux/perf_event.h> #include <linux/interrupt.h>
arch/sparc/mm/init_64.c +1 -1
@@ -5,7 +5,7 @@* Copyright (C) 1997-1999 Jakub Jelinek ([email protected]) */ -#include <linux/module.h> +#include <linux/extable.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/string.h>
Signature · 1 line
2.8.4
PATCH 7/14 powerpc: migrate exception table users off module.h and onto extable.h
In reply to Paul GortmakerThese files were only including module.h for exception table related functions. We've now separated that content out into its own file "extable.h" so now move over to that and avoid all the extra header content in module.h that we don't really need to compile these files.
--- arch/powerpc/kernel/kprobes.c | 2 +- arch/powerpc/mm/fault.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/kprobes.c +1 -1
@@ -29,7 +29,7 @@#include <linux/kprobes.h> #include <linux/ptrace.h> #include <linux/preempt.h> -#include <linux/module.h> +#include <linux/extable.h> #include <linux/kdebug.h> #include <linux/slab.h> #include <asm/code-patching.h>
arch/powerpc/mm/fault.c +1 -1
@@ -26,7 +26,7 @@#include <linux/mm.h> #include <linux/interrupt.h> #include <linux/highmem.h> -#include <linux/module.h> +#include <linux/extable.h> #include <linux/kprobes.h> #include <linux/kdebug.h> #include <linux/perf_event.h>
Signature · 1 line
2.8.4
PATCH 8/14 m68k: migrate exception table users off module.h and onto extable.h
In reply to Paul GortmakerThis file was only including module.h for exception table related functions. We've now separated that content out into its own file "extable.h" so now move over to that and avoid all the extra header content in module.h that we don't really need to compile this.
--- arch/m68k/kernel/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m68k/kernel/signal.c +1 -1
@@ -42,7 +42,7 @@#include <linux/personality.h> #include <linux/tty.h> #include <linux/binfmts.h> -#include <linux/module.h> +#include <linux/extable.h> #include <linux/tracehook.h> #include <asm/setup.h>
Signature · 1 line
2.8.4
PATCH 9/14 s390: migrate exception table users off module.h and onto extable.h
In reply to Paul GortmakerThese files were only including module.h for exception table related functions. We've now separated that content out into its own file "extable.h" so now move over to that and avoid all the extra header content in module.h that we don't really need to compile these files.
The additions of uaccess.h are to deal with implict includes like:
arch/s390/kernel/traps.c: In function 'do_report_trap':arch/s390/kernel/traps.c:56:4: error: implicit declaration of function 'extable_fixup' [-Werror=implicit-function-declaration] arch/s390/kernel/traps.c: In function 'illegal_op':arch/s390/kernel/traps.c:173:3: error: implicit declaration of function 'get_user' [-Werror=implicit-function-declaration]
--- arch/s390/kernel/early.c | 2 +- arch/s390/kernel/kprobes.c | 2 ++ arch/s390/kernel/traps.c | 3 ++- arch/s390/mm/fault.c | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-)
arch/s390/kernel/early.c +1 -1
@@ -13,7 +13,7 @@#include <linux/string.h> #include <linux/ctype.h> #include <linux/lockdep.h> -#include <linux/module.h> +#include <linux/extable.h> #include <linux/pfn.h> #include <linux/uaccess.h> #include <linux/kernel.h>
arch/s390/kernel/kprobes.c +2 -0
@@ -26,12 +26,14 @@#include <linux/stop_machine.h> #include <linux/kdebug.h> #include <linux/uaccess.h> +#include <linux/extable.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/hardirq.h> #include <linux/ftrace.h> #include <asm/cacheflush.h> #include <asm/sections.h> +#include <asm/uaccess.h> #include <asm/dis.h> DEFINE_PER_CPU(struct kprobe *, current_kprobe);
arch/s390/kernel/traps.c +2 -1
@@ -14,11 +14,12 @@*/ #include <linux/kprobes.h> #include <linux/kdebug.h> -#include <linux/module.h> +#include <linux/extable.h> #include <linux/ptrace.h> #include <linux/sched.h> #include <linux/mm.h> #include <linux/slab.h> +#include <asm/uaccess.h> #include <asm/fpu/api.h> #include "entry.h"
arch/s390/mm/fault.c +1 -1
@@ -24,7 +24,7 @@#include <linux/kdebug.h> #include <linux/init.h> #include <linux/console.h> -#include <linux/module.h> +#include <linux/extable.h> #include <linux/hardirq.h> #include <linux/kprobes.h> #include <linux/uaccess.h>
Signature · 1 line
2.8.4
PATCH 10/14 tile: migrate exception table users off module.h and onto extable.h
In reply to Paul GortmakerThese files were only including module.h for exception table related functions. We've now separated that content out into its own file "extable.h" so now move over to that and avoid all the extra header content in module.h that we don't really need to compile these files.
--- arch/tile/kernel/unaligned.c | 2 +- arch/tile/mm/extable.c | 2 +- arch/tile/mm/fault.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
arch/tile/kernel/unaligned.c +1 -1
@@ -22,7 +22,7 @@#include <linux/mman.h> #include <linux/types.h> #include <linux/err.h> -#include <linux/module.h> +#include <linux/extable.h> #include <linux/compat.h> #include <linux/prctl.h> #include <asm/cacheflush.h>
arch/tile/mm/extable.c +1 -1
@@ -12,7 +12,7 @@* more details. */ -#include <linux/module.h> +#include <linux/extable.h> #include <linux/spinlock.h> #include <linux/uaccess.h>
arch/tile/mm/fault.c +1 -1
@@ -29,7 +29,7 @@#include <linux/tty.h> #include <linux/vt_kern.h> /* For unblank_screen() */ #include <linux/highmem.h> -#include <linux/module.h> +#include <linux/extable.h> #include <linux/kprobes.h> #include <linux/hugetlb.h> #include <linux/syscalls.h>
Signature · 1 line
2.8.4
PATCH 11/14 alpha: migrate exception table users off module.h and onto extable.h
In reply to Paul GortmakerThese files were only including module.h for exception table related functions. We've now separated that content out into its own file "extable.h" so now move over to that and avoid all the extra header content in module.h that we don't really need to compile these files.
--- arch/alpha/kernel/traps.c | 2 +- arch/alpha/mm/fault.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/alpha/kernel/traps.c +1 -1
@@ -13,7 +13,7 @@#include <linux/sched.h> #include <linux/tty.h> #include <linux/delay.h> -#include <linux/module.h> +#include <linux/extable.h> #include <linux/kallsyms.h> #include <linux/ratelimit.h>
arch/alpha/mm/fault.c +1 -1
@@ -22,7 +22,7 @@#include <linux/mman.h> #include <linux/smp.h> #include <linux/interrupt.h> -#include <linux/module.h> +#include <linux/extable.h> #include <linux/uaccess.h> extern void die_if_kernel (char *,struct pt_regs *,long ,unsigned long *);
Signature · 1 line
2.8.4
PATCH 12/14 parisc: migrate exception table users off module.h and onto extable.h
In reply to Paul GortmakerThis file was only including module.h for exception table related functions. We've now separated that content out into its own file "extable.h" so now move over to that and avoid all the extra header content in module.h that we don't really need to compile this file.
--- arch/parisc/mm/fault.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/parisc/mm/fault.c +1 -1
@@ -14,7 +14,7 @@#include <linux/ptrace.h> #include <linux/sched.h> #include <linux/interrupt.h> -#include <linux/module.h> +#include <linux/extable.h> #include <linux/uaccess.h> #include <asm/traps.h>
Signature · 1 line
2.8.4
PATCH 13/14 core: migrate exception table users off module.h and onto extable.h
In reply to Paul GortmakerThese files were including module.h for exception table related functions. We've now separated that content out into its own file "extable.h" so now move over to that and where possible, avoid all the extra header content in module.h that we don't really need to compile these non-modular files.
Note:
init/main.c still needs module.h for __init_or_module kernel/extable.c still needs module.h for is_module_text_address
...and so we don't get the benefit of removing module.h from the cpp feed for these two files, unlike the almost universal 1:1 exchange of module.h for extable.h we were able to do in the arch dirs.
--- init/main.c | 1 + kernel/extable.c | 1 + kernel/module.c | 1 + 3 files changed, 3 insertions(+)
init/main.c +1 -0
@@ -12,6 +12,7 @@#define DEBUG /* Enable initcall_debug */ #include <linux/types.h> +#include <linux/extable.h> #include <linux/module.h> #include <linux/proc_fs.h> #include <linux/kernel.h>
kernel/extable.c +1 -0
@@ -17,6 +17,7 @@*/ #include <linux/ftrace.h> #include <linux/memory.h> +#include <linux/extable.h> #include <linux/module.h> #include <linux/mutex.h> #include <linux/init.h>
kernel/module.c +1 -0
@@ -17,6 +17,7 @@Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <linux/export.h> +#include <linux/extable.h> #include <linux/moduleloader.h> #include <linux/trace_events.h> #include <linux/init.h>
Signature · 1 line
2.8.4
PATCH 14/14 module.h: remove extable.h include now users have migrated
In reply to Paul GortmakerWith hopefully most/all users of module.h that were looking for exception table functions moved over to the new extable.h header, we can remove the back-compat include that let us transition without introducing build regressions.
--- include/linux/module.h | 1 - 1 file changed, 1 deletion(-)
include/linux/module.h +0 -1
@@ -18,7 +18,6 @@#include <linux/moduleparam.h> #include <linux/jump_label.h> #include <linux/export.h> -#include <linux/extable.h> /* only as arch move module.h -> extable.h */ #include <linux/rbtree_latch.h> #include <linux/percpu.h>
Signature · 1 line
2.8.4
Quoted 10 lines · Paul Gortmaker
While doing an audit looking for unnecessary instances of
module.hinclusion acrossarch/x86/I found a significant number of includes ofmodule.hwere for things likesearch_exception_tableand friends.For historical reasons (i.e. pre-git) the exception table stuff was buried in the middle of the
module.hfile. So we have core kernel files that are completely non-modular (both arch specific and arch independent) that are just includingmodule.hfor this.
Quoted 5 lines
The converse is also true, in that conventional drivers, be they for filesystems or actual hardware peripherals or similar, do not normally care about the exception tables.
Here we fork the exception table content [...]
This looks to be the right thing to do as far as I can tell. I'm not sure how big of a problem the extable stuff is (we definitely have much bigger unnecessary include files that cause a lot more problems), but it seems like a reasonable cleanup.
Linus