Messages in this thread Patch in this message | | | From | Andy Lutomirski <> | Subject | [PATCH 4/4] x86/entry/64: Bypass enter_from_user_mode on non-context-tracking boots | Date | Fri, 6 Nov 2015 15:12:46 -0800 |
| |
On CONFIG_CONTEXT_TRACKING kernels that have context tracking disabled at runtime (which includes most distro kernels), we still have the overhead of a call to enter_from_user_mode in interrupt and exception entries.
If jump labels are available, this uses the jump label infrastructure to skip the call.
Signed-off-by: Andy Lutomirski <luto@kernel.org> --- arch/x86/entry/calling.h | 15 +++++++++++++++ arch/x86/entry/entry_64.S | 8 ++------ 2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/arch/x86/entry/calling.h b/arch/x86/entry/calling.h index 3c71dd947c7b..271e30c585bc 100644 --- a/arch/x86/entry/calling.h +++ b/arch/x86/entry/calling.h @@ -1,3 +1,5 @@ +#include <linux/jump_label.h> + /* x86 function call convention, 64-bit: @@ -232,3 +234,16 @@ For 32-bit we have the following conventions - kernel is built with #endif /* CONFIG_X86_64 */ +/* + * This does 'call enter_from_user_mode' unless we can avoid it based on + * kernel config or using the static jump infrastructure. + */ +.macro CALL_ENTER_FROM_USER_MODE +#ifdef CONFIG_CONTEXT_TRACKING +#ifdef HAVE_JUMP_LABEL + STATIC_JUMP_IF_FALSE .Lafter_call_\@, context_tracking_enabled, def=0 +#endif + call enter_from_user_mode +.Lafter_call_\@: +#endif +.endm diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index f585df24ab3d..9b49b56efa29 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -517,9 +517,7 @@ END(irq_entries_start) */ TRACE_IRQS_OFF -#ifdef CONFIG_CONTEXT_TRACKING - call enter_from_user_mode -#endif + CALL_ENTER_FROM_USER_MODE 1: /* @@ -1058,9 +1056,7 @@ ENTRY(error_entry) .Lerror_entry_from_usermode_after_swapgs: TRACE_IRQS_OFF -#ifdef CONFIG_CONTEXT_TRACKING - call enter_from_user_mode -#endif + CALL_ENTER_FROM_USER_MODE ret .Lerror_entry_done: -- 2.4.3
| |