From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753450AbbKLITA (ORCPT ); Thu, 12 Nov 2015 03:19:00 -0500 Received: from mail-wm0-f49.google.com ([74.125.82.49]:35661 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751165AbbKLIS6 (ORCPT ); Thu, 12 Nov 2015 03:18:58 -0500 Date: Thu, 12 Nov 2015 09:18:54 +0100 From: Ingo Molnar To: Andy Lutomirski Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Brian Gerst , Linus Torvalds , Borislav Petkov , =?iso-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , Peter Zijlstra Subject: Re: [PATCH v2 4/4] x86/entry/64: Bypass enter_from_user_mode on non-context-tracking boots Message-ID: <20151112081854.GA8793@gmail.com> References: <73ee804fff48cd8c66b65b724f9f728a11a8c686.1447217194.git.luto@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <73ee804fff48cd8c66b65b724f9f728a11a8c686.1447217194.git.luto@kernel.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Andy Lutomirski wrote: > 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 > --- > 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..e32206e09868 100644 > --- a/arch/x86/entry/calling.h > +++ b/arch/x86/entry/calling.h > @@ -1,3 +1,5 @@ > +#include > + > /* > > 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 a55697d19824..9d34d3cfceb6 100644 > --- a/arch/x86/entry/entry_64.S > +++ b/arch/x86/entry/entry_64.S > @@ -520,9 +520,7 @@ END(irq_entries_start) > */ > TRACE_IRQS_OFF > > -#ifdef CONFIG_CONTEXT_TRACKING > - call enter_from_user_mode > -#endif > + CALL_enter_from_user_mode > > 1: > /* > @@ -1066,9 +1064,7 @@ ENTRY(error_entry) > * (which can take locks). > */ > TRACE_IRQS_OFF > -#ifdef CONFIG_CONTEXT_TRACKING > - call enter_from_user_mode > -#endif > + CALL_enter_from_user_mode > ret > > .Lerror_entry_done: > -- > 2.5.0 > hm, this patch does not apply to latest -tip: patching file arch/x86/entry/entry_64.S Hunk #1 FAILED at 520. Hunk #2 FAILED at 1066. 2 out of 2 hunks FAILED -- rejects in file arch/x86/entry/entry_64.S am I missing some dependency, or are they against an older tree? Thanks, Ingo