From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753797AbbCYSEu (ORCPT ); Wed, 25 Mar 2015 14:04:50 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:36803 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752235AbbCYSEq (ORCPT ); Wed, 25 Mar 2015 14:04:46 -0400 Date: Wed, 25 Mar 2015 19:04:41 +0100 From: Ingo Molnar To: Denys Vlasenko Cc: Linus Torvalds , Steven Rostedt , Borislav Petkov , "H. Peter Anvin" , Andy Lutomirski , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] x86/asm/entry/64: do not TRACE_IRQS fast SYSRET64 path Message-ID: <20150325180441.GB7321@gmail.com> References: <1427303896-24023-1-git-send-email-dvlasenk@redhat.com> <1427303896-24023-2-git-send-email-dvlasenk@redhat.com> <20150325172922.GA7321@gmail.com> <5512F339.8060209@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5512F339.8060209@redhat.com> 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 * Denys Vlasenko wrote: > On 03/25/2015 06:29 PM, Ingo Molnar wrote: > > > > * Denys Vlasenko wrote: > > > >> SYSRET code path has a small irq-off block. > >> On this code path, TRACE_IRQS_ON can't be called right before interrupts > >> are enabled for real, we can't clobber registers there. > >> So current code does it earlier, in a safe place. > >> > >> But with this, TRACE_IRQS_OFF/ON frames just two fast instructions, > >> which is ridiculous: now most of irq-off block is _outside_ of the framing. > >> > >> Do the same thing that we do on SYSCALL entry: do not track this irq-off block, > >> it is very small to ever cause noticeable irq latency. > >> > >> Be careful: make sure that "jnz int_ret_from_sys_call_irqs_off" now does > >> invoke TRACE_IRQS_OFF - move int_ret_from_sys_call_irqs_off label before > >> TRACE_IRQS_OFF. > > > >> @@ -345,8 +346,8 @@ tracesys_phase2: > >> */ > >> GLOBAL(int_ret_from_sys_call) > >> DISABLE_INTERRUPTS(CLBR_NONE) > >> - TRACE_IRQS_OFF > >> int_ret_from_sys_call_irqs_off: > >> + TRACE_IRQS_OFF > >> movl $_TIF_ALLWORK_MASK,%edi > >> /* edi: mask to check */ > > > > This latter trick absolutely needs a comment, to keep future lockdep > > developers from wondering about the mismatch and the weird label > > placement ... > > Unsure how to format it. > > How about: > > > DISABLE_INTERRUPTS(CLBR_NONE) > int_ret_from_sys_call_irqs_off: /* jumps come here with irqs off */ > TRACE_IRQS_OFF Why not something like 'jumps come here from the irqs-off SYSRET path'? > > > > (In truth, there is only one jump as of now, but using pliral > "jumps" if that would change) I'd also put a comment to the actual sysret IRQ-disablement that we are skipping with the annotation. Explain that it's an optimization for a visible irqs-off path that needs no annotation - and that the moment something complex is done in that path, this optimization loses its validity. Thanks, Ingo