Commit f64366ef authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Thomas Gleixner

x86/int3: Inline bsearch()

Avoid calling out to bsearch() by inlining it, for normal kernel configs
this was the last external call and poke_int3_handler() is now fully self
sufficient -- no calls to external code.
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarAlexandre Chartre <alexandre.chartre@oracle.com>
Acked-by: default avatarAndy Lutomirski <luto@kernel.org>
Link: https://lkml.kernel.org/r/20200505135313.731774429@linutronix.de


parent df65bba1
...@@ -1033,7 +1033,7 @@ static __always_inline void *text_poke_addr(struct text_poke_loc *tp) ...@@ -1033,7 +1033,7 @@ static __always_inline void *text_poke_addr(struct text_poke_loc *tp)
return _stext + tp->rel_addr; return _stext + tp->rel_addr;
} }
static int noinstr patch_cmp(const void *key, const void *elt) static __always_inline int patch_cmp(const void *key, const void *elt)
{ {
struct text_poke_loc *tp = (struct text_poke_loc *) elt; struct text_poke_loc *tp = (struct text_poke_loc *) elt;
...@@ -1077,9 +1077,9 @@ int noinstr poke_int3_handler(struct pt_regs *regs) ...@@ -1077,9 +1077,9 @@ int noinstr poke_int3_handler(struct pt_regs *regs)
* Skip the binary search if there is a single member in the vector. * Skip the binary search if there is a single member in the vector.
*/ */
if (unlikely(desc->nr_entries > 1)) { if (unlikely(desc->nr_entries > 1)) {
tp = bsearch(ip, desc->vec, desc->nr_entries, tp = __inline_bsearch(ip, desc->vec, desc->nr_entries,
sizeof(struct text_poke_loc), sizeof(struct text_poke_loc),
patch_cmp); patch_cmp);
if (!tp) if (!tp)
goto out_put; goto out_put;
} else { } else {
......
...@@ -570,6 +570,11 @@ DEFINE_IDTENTRY_ERRORCODE(exc_general_protection) ...@@ -570,6 +570,11 @@ DEFINE_IDTENTRY_ERRORCODE(exc_general_protection)
dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code) dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)
{ {
/*
* poke_int3_handler() is completely self contained code; it does (and
* must) *NOT* call out to anything, lest it hits upon yet another
* INT3.
*/
if (poke_int3_handler(regs)) if (poke_int3_handler(regs))
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment