ia64: make use of new extable.h header
PATCH 1/2 ia64: macro-ize ia64_done_with_exception in asm/uaccess.h
In reply to Paul GortmakerMost of the other C content in this file is already implemented in macro form. Doing the same for this function will allow us to get rid of the duplicated search_exception_tables prototype. We will bring it in as required via <linux/extable.h> inclusion.
--- arch/ia64/include/asm/uaccess.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
arch/ia64/include/asm/uaccess.h +11 -11
@@ -363,17 +363,17 @@ struct exception_table_entry {extern void ia64_handle_exception (struct pt_regs *regs,const struct exception_table_entry *e);extern const struct exception_table_entry *search_exception_tables (unsigned long addr); -static inline int -ia64_done_with_exception (struct pt_regs *regs) -{ -const struct exception_table_entry *e; - e =search_exception_tables (regs->cr_iip +ia64_psr (regs)->ri); -if (e) { -ia64_handle_exception (regs, e); -return 1 ; - } -return 0 ; -} +#define ia64_done_with_exception (regs) \ +({ \ + int __ex_ret = 0; \ + const struct exception_table_entry *e; \ + e = search_exception_tables((regs)->cr_iip + ia64_psr(regs)->ri); \ + if (e) { \ + ia64_handle_exception(regs, e); \ + __ex_ret = 1; \ + } \ + __ex_ret; \ +})#define ARCH_HAS_TRANSLATE_MEM_PTR 1 static __inline__ void *
Signature · 1 line
2.8.4
PATCH 2/2 ia64: ensure exception table search users include extable.h
In reply to Paul GortmakerWe start with a delete of a duplicate prototype in asm/uaccess.h that doesn't need to exist, as it duplicates content in extable.h and since that header is so small, there is no point trying to avoid using it.
Then we make sure anyone using search_exception_tables directly or via the ia64_done_with_exception macro has included extable.h
In the process, we remove an include of moduleloader.h that was apparently not really required; it would have been fetching in module.h and hence the previous location of the exception search function prototypes, but we need not rely on that anymore.
--- arch/ia64/include/asm/uaccess.h | 4 ++-- arch/ia64/kernel/kprobes.c | 2 +- arch/ia64/kernel/traps.c | 3 ++- arch/ia64/kernel/unaligned.c | 1 + arch/ia64/mm/fault.c | 1 + 5 files changed, 7 insertions(+), 4 deletions(-)
arch/ia64/include/asm/uaccess.h +2 -2
@@ -360,8 +360,8 @@ struct exception_table_entry {int fixup;/* location-relative continuation addr.; if bit 2 is set, r9 is set to 0 */ }; -extern void ia64_handle_exception (struct pt_regs *regs,const struct exception_table_entry *e); -extern const struct exception_table_entry *search_exception_tables (unsigned long addr); +extern void ia64_handle_exception (struct pt_regs *regs, +const struct exception_table_entry *e);#define ia64_done_with_exception (regs) \ ({ \
arch/ia64/kernel/kprobes.c +1 -1
@@ -28,7 +28,7 @@#include <linux/string.h> #include <linux/slab.h> #include <linux/preempt.h> -#include <linux/moduleloader.h> +#include <linux/extable.h> #include <linux/kdebug.h> #include <asm/pgtable.h>
arch/ia64/kernel/traps.c +2 -1
@@ -12,7 +12,8 @@#include <linux/sched.h> #include <linux/tty.h> #include <linux/vt_kern.h> /* For unblank_screen() */ -#include <linux/module.h> /* for EXPORT_SYMBOL */ +#include <linux/export.h> +#include <linux/extable.h> #include <linux/hardirq.h> #include <linux/kprobes.h> #include <linux/delay.h> /* for ssleep() */
arch/ia64/kernel/unaligned.c +1 -0
@@ -17,6 +17,7 @@#include <linux/kernel.h> #include <linux/sched.h> #include <linux/tty.h> +#include <linux/extable.h> #include <linux/ratelimit.h> #include <asm/intrinsics.h>
arch/ia64/mm/fault.c +1 -0
@@ -7,6 +7,7 @@#include <linux/sched.h> #include <linux/kernel.h> #include <linux/mm.h> +#include <linux/extable.h> #include <linux/interrupt.h> #include <linux/kprobes.h> #include <linux/kdebug.h>
Signature · 1 line
2.8.4
cover ia64: make use of new extable.h header
We forked the exception table content out of module.h into a new extable.h file[1]. We temporarily include extable.h into the module.h itself. Now we 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.
Here we move ia64 onto using the new header, and in doing so also macro-ize something in uaccess.h to make it more consistent with the rest of that file.
Paul.
[1] https://lkml.org/lkml/2016/7/24/224
Signature · 13 lines
Paul Gortmaker (2): ia64: macro-ize ia64_done_with_exception in asm/uaccess.h ia64: ensure exception table search users include extable.h arch/ia64/include/asm/uaccess.h | 28 ++++++++++++++-------------- arch/ia64/kernel/kprobes.c | 2 +- arch/ia64/kernel/traps.c | 3 ++- arch/ia64/kernel/unaligned.c | 1 + arch/ia64/mm/fault.c | 1 + 5 files changed, 19 insertions(+), 16 deletions(-) -- 2.8.4
Re: [PATCH 1/2] ia64: macro-ize ia64_done_with_exception in asm/uaccess.h
In reply to Paul GortmakerQuoted 4 lines · Paul Gortmaker
Most of the other C content in this file is already implemented in macro form. Doing the same for this function will allow us to get rid of the duplicated
search_exception_tablesprototype. We will bring it in as required via <linux/extable.h> inclusion.
What is it doing in uaccess.h in the first place? ia64_done_with_exception() is used only in the guts of arch/ia64 (2 in kernel, 1 in mm), so why dump it into a widely-used header?
Re: [PATCH 1/2] ia64: macro-ize ia64_done_with_exception in asm/uaccess.h
Quoted 9 lines · [Re: [PATCH 1/2] ia64: macro-ize ia64_done_with_exception in asm/uaccess.h] On…
Quoted 4 lines · Paul Gortmaker
Most of the other C content in this file is already implemented in macro form. Doing the same for this function will allow us to get rid of the duplicated
search_exception_tablesprototype. We will bring it in as required via <linux/extable.h> inclusion.What is it doing in
uaccess.hin the first place?ia64_done_with_exception()is used only in the guts ofarch/ia64(2 in kernel, 1 in mm), so why dump it into a widely-used header?
Looking at arm and alpha, it seems there are other arch that have exception stuff in their own arch specific uaccess.h file, so I'm guessing it got there in ia64 just by happenstance of copying existing implementations.
THere is a precedent for arch specific asm/exception.h -- we could create one for ia64 and move the chunks over there if folks thought that was worthwhile I suppose.
Paul.
--