Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3642451ybb; Tue, 31 Mar 2020 09:09:25 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtJuyHSbIyw6X/KnPXXrGqhCKuYlwjaAo4WGPO6srklIeo+vQP5w+mgSpTThnmtXi4Pkbqp X-Received: by 2002:a9d:480b:: with SMTP id c11mr12927996otf.109.1585670965383; Tue, 31 Mar 2020 09:09:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585670965; cv=none; d=google.com; s=arc-20160816; b=bzkMldMXnYdsiS0/7rsM5l19dkJqjeh0d934BBOmAu+A4QFsj+YtXHmXriRWdkDSoi Rvh7qFuHlKpe4CLxQx8WfGIrpZ1/+s7iIrqnRf0xrFJ/rwMMIlZQi9qJ5bDCDaDHwKUk 2ViPcnTL2yObLsEGGDZT0Y+q1QtiQAvpZe6vnJ1WbeAfTItGvf5PprabbcTswHm1SHVL H5wNtjnEaJfzmgcu1utWro8YpVPn2pNrLqhACxTPQev1ayoGgG/fNPjHRZVtJB4TDpdU GcD+E5FJYGbUtQoaPrJ6WJvOI7FoTNGjZqH9LOr1sKVzeuxqCvsGPcCCUxBIvOCCnP8/ My9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=qRwSxdkJvHVO9CkLZvWsN5O2euno318Z4mdLOQ7HH6c=; b=rC2Z4KGHQAtnM5Z69hu3EOdkd9cmf1Pp7kbsGkzBvBkwr3g2niZ7804itTaTZ0mgXR roR3ZOvC3323O/RsxeL6+Mgr+jQPgd8S+bgp8R7L2t2zYkw0YKF2JyZViQbOdIKi4wME FT0766X0+JeXAiIbqV9OfnAJPgSaLDNINey2STxK0yP/g2fN6p3V/o5Ay1CAPE1MqohA SpU1/+cA/DjsYrw4SM5AflZHvP5rn9iF6ZbNQtxAAQHKR8kVM2M2S+p+aTRUZ+IlGXjw QQUVdgYehT5dnClIn6e8uBFJw8EwVfeZe3MtF9V3p4iKe284MoG+1gjqOIYa17zLiGOU Xz/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=MZJOQji6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l10si3184184otq.305.2020.03.31.09.09.07; Tue, 31 Mar 2020 09:09:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=MZJOQji6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730644AbgCaQGu (ORCPT + 99 others); Tue, 31 Mar 2020 12:06:50 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:35170 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730366AbgCaQGu (ORCPT ); Tue, 31 Mar 2020 12:06:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=qRwSxdkJvHVO9CkLZvWsN5O2euno318Z4mdLOQ7HH6c=; b=MZJOQji6zdAFUyZaVuBWCB+w1q 4ZVHLlU+o7L4njebBrdJk5IHN8a+SfwEpY/U9tVwuqF0pDmfkTycFUlwFuzqi769zZVXroNtXugA+ xEfu36aHljRgKSeQ6RZne3c6+Cgo3MdGeT7xTRA0UVNbDMLOnvTz59hrbb2+VTjIzAck5gFndhULy kXvLbb6zKNzK8wnSikNNlR/f/53yzLTGx8NScrLwmHwb8ruEQeDgezYtCHf1qgQnqRlI/ZG6WxPRs Q+Oh/odfoL6p84/Xm3LlKRKJCkjidrk7Oooq1r0gZORMoDk7YP84mqcZdZ4mghXuA0ZIyvp/1GYBD uptCUYqw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jJJPW-0000PV-5b; Tue, 31 Mar 2020 16:06:42 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 5A1A930015A; Tue, 31 Mar 2020 18:06:40 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 062F329D910F5; Tue, 31 Mar 2020 18:06:39 +0200 (CEST) Date: Tue, 31 Mar 2020 18:06:39 +0200 From: Peter Zijlstra To: Steven Rostedt Cc: Josh Poimboeuf , tglx@linutronix.de, linux-kernel@vger.kernel.org, x86@kernel.org, mhiramat@kernel.org, mbenes@suse.cz Subject: [RFC][PATCH] x86,ftrace: Shrink ftrace_regs_caller() by one byte Message-ID: <20200331160639.GV20730@hirez.programming.kicks-ass.net> References: <20200326113049.GD20696@hirez.programming.kicks-ass.net> <20200326135620.tlmof5fa7p5wct62@treble> <20200326154938.GO20713@hirez.programming.kicks-ass.net> <20200326195718.GD2452@worktop.programming.kicks-ass.net> <20200327010001.i3kebxb4um422ycb@treble> <20200330170200.GU20713@hirez.programming.kicks-ass.net> <20200330190205.k5ssixd5hpshpjjq@treble> <20200330200254.GV20713@hirez.programming.kicks-ass.net> <20200331111652.GH20760@hirez.programming.kicks-ass.net> <20200331113136.01316614@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200331113136.01316614@gandalf.local.home> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 31, 2020 at 11:31:36AM -0400, Steven Rostedt wrote: > On Tue, 31 Mar 2020 13:16:52 +0200 > Peter Zijlstra wrote: > > > @@ -235,8 +237,8 @@ SYM_INNER_LABEL(ftrace_regs_call, SYM_L_GLOBAL) > > > > /* If ORIG_RAX is anything but zero, make this a call to that */ > > movq ORIG_RAX(%rsp), %rax > > - cmpq $0, %rax > > - je 1f > > + testq %rax, %rax > > + jz 1f > > > > /* Swap the flags with orig_rax */ > > movq MCOUNT_REG_SIZE(%rsp), %rdi > > Hi Peter, > > Can you send this change as a separate patch as it has nothing to do with > this current change, and is a clean up patch that stands on its own. Sure. But then I have to like write a Changelog for it... :/ --- Subject: x86,ftrace: Shrink ftrace_regs_caller() by one byte 'Optimize' ftrace_regs_caller. Instead of comparing against an immediate, the more natural way to test for zero on x86 is: 'test %r,%r'. 48 83 f8 00 cmp $0x0,%rax 74 49 je 226 48 85 c0 test %rax,%rax 74 49 je 225 Signed-off-by: Peter Zijlstra (Intel) --- arch/x86/kernel/ftrace_64.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/ftrace_64.S b/arch/x86/kernel/ftrace_64.S index 369e61faacfe..8e71c492d623 100644 --- a/arch/x86/kernel/ftrace_64.S +++ b/arch/x86/kernel/ftrace_64.S @@ -235,8 +235,8 @@ SYM_INNER_LABEL(ftrace_regs_call, SYM_L_GLOBAL) /* If ORIG_RAX is anything but zero, make this a call to that */ movq ORIG_RAX(%rsp), %rax - cmpq $0, %rax - je 1f + testq %rax, %rax + jz 1f /* Swap the flags with orig_rax */ movq MCOUNT_REG_SIZE(%rsp), %rdi