From patchwork Wed Jul 6 20:12:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 12908558 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8B484C433EF for ; Wed, 6 Jul 2022 20:13:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=4Spzb/hdiOHHm82Y/yHfbp+d5A+GEKYy2VIbgOU/gdc=; b=Sk3LbbSkOFaAG8 J63wGel40wuo3zSqxZcrhR3cWxKs7MJQoT+MXD02BqyD0NyA+mXSvVeMct3TB6H0bL27sk/CqktXb pWj0V32BWEGR5sNHRex2+4tOZkCkvD+SNuIPynYEi1briZw8L/p0frayXnMSd4W61/Tvvun2ogRpR MEu4uzWNQgU0XGa4RbEy+tPHtQ4AVmalgmiAHkHkWCg2ajRO/mO0xKIT9UvrJRb3RteLB8YZ5b5e3 4S9Ea6xxRydrvLJg1p0KeGY4mLUf59IPUlvVtbnUmdEdR7ROUaDabzfCSlb6030+4gnPMKAUWGUQK 0ZcGl6/LpO2e8JSR5z2A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o9BO3-00CI3p-T9; Wed, 06 Jul 2022 20:12:39 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o9BNz-00CI3W-1i for linux-arm-kernel@lists.infradead.org; Wed, 06 Jul 2022 20:12:36 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 91230620C3; Wed, 6 Jul 2022 20:12:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DDF8C3411C; Wed, 6 Jul 2022 20:12:33 +0000 (UTC) Date: Wed, 6 Jul 2022 16:12:31 -0400 From: Steven Rostedt To: LKML Cc: Ingo Molnar , Andrew Morton , Sascha Hauer , linux-arm-kernel@lists.infradead.org Subject: [PATCH] ftrace: Be more specific about arch impact when function tracer is enabled Message-ID: <20220706161231.085a83da@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220706_131235_173756_8216C7CC X-CRM114-Status: GOOD ( 14.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Steven Rostedt (Google) It was brought up that on ARMv7, that because the FUNCTION_TRACER does not use nops to keep function tracing disabled because of the use of a link register, it does have some performance impact. The start of functions when -pg is used to compile the kernel is: push {lr} bl 8010e7c0 <__gnu_mcount_nc> When function tracing is tuned off, it becomes: push {lr} add sp, sp, #4 Which just puts the stack back to its normal location. But these two instructions at the start of every function does incur some overhead. Be more honest in the Kconfig FUNCTION_TRACER description and specify that the overhead being in the noise was x86 specific, but other architectures may vary. Link: https://lore.kernel.org/all/20220705105416.GE5208@pengutronix.de/ Reported-by: Sascha Hauer Signed-off-by: Steven Rostedt (Google) Acked-by: Sascha Hauer diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index debbbb083286..ccd6a5ade3e9 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig @@ -194,7 +194,8 @@ config FUNCTION_TRACER sequence is then dynamically patched into a tracer call when tracing is enabled by the administrator. If it's runtime disabled (the bootup default), then the overhead of the instructions is very - small and not measurable even in micro-benchmarks. + small and not measurable even in micro-benchmarks (at least on + x86, but may have impact on other architectures). config FUNCTION_GRAPH_TRACER bool "Kernel Function Graph Tracer"