Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp188250rdb; Thu, 21 Dec 2023 06:36:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGWNlKzCpf9wLbRT60gBpoyGqj1gx5Unpw7OosrYR+bnxn1aEB/h4xeFtOET91yrx1KKFRw X-Received: by 2002:a05:6a21:998d:b0:190:85d9:9d4b with SMTP id ve13-20020a056a21998d00b0019085d99d4bmr881073pzb.95.1703169363916; Thu, 21 Dec 2023 06:36:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703169363; cv=none; d=google.com; s=arc-20160816; b=zQ8b9bOMrtizoTizN7psu88ukthjlHAmOuuiRsU5bXM5o9zwLLCGWp/Tr2getjtRi+ x+AvaL5fQkfCUjX/cBRqH5unfh+zvvZMjMHuhE5y8hDXb32EyRT9IGQIdv7zfZBFiOW6 RXa4e7fKvxMf9T+AZnOmIZzm+Rb12QDk6wTBTxqTnafGqAWod9gRqtWO3Y6w5cjDzigB H/zt5XVq1flYxPG6Cs2J0XFO5BXRlpZpuSUpX8xrraow5CPpTRA/Cwz7W06KmUJS0DPx kRoZjakePmgQoFwviQEqVV/GKw9Tbk+xHJpWeSVOiZuZDtxmudFisUM9DQ7SSSFmwurL /j+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=t/ES0m5jV72Hk6vPdh6Ff629ykgs4kzUDD3rJjdvhf4=; fh=KNOldakjq6bYX9diWdJ6lmuLLFx0zF2En3LDyVM6VdM=; b=ZQ/iriVSzutAij5QXGBTkaiFPo1d9nFVyZc5ECwLGytFf2PptYRMn8k8hbcaTNKRBC lWXNIVgoe3pdxpQPfDzYI36QWZe80xW5JQHsyWZxw6wJ651NIbzo6D7DbLIUOQ0EOGAh o21fEllVKG1VOedxUxPLIAUiAHWlNrJPsAao7kEKvRhbDpPKqPGZ63wB+UKd6RMxcgfZ hz6cEY7+CYzlVU2N/nwt9t3MkqEmxRTO8Dby3Wog6QkNZSTxS9+maBv2CzY/MOK9MptH M1c/1cJV/7Tdr1GM4pDIfjz0pdJmWeBDOfRIggXwMB2G28CmRRnM6aodcGs3cpwzSito /Gtg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-8566-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8566-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 71-20020a63014a000000b005cdba908616si1707361pgb.99.2023.12.21.06.36.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 06:36:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8566-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-8566-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8566-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id CE41EB21AE0 for ; Thu, 21 Dec 2023 14:24:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C3A7D6D6F9; Thu, 21 Dec 2023 14:24:44 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C9396D6D9 for ; Thu, 21 Dec 2023 14:24:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3065C433C9; Thu, 21 Dec 2023 14:24:42 +0000 (UTC) Date: Thu, 21 Dec 2023 09:25:45 -0500 From: Steven Rostedt To: Christophe Leroy Cc: Naveen N Rao , "linuxppc-dev@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" , Michael Ellerman , Nicholas Piggin , "Aneesh Kumar K.V" , Mark Rutland , Florent Revest , Masami Hiramatsu Subject: Re: [RFC PATCH 6/9] powerpc/ftrace: Update and move function profile instructions out-of-line Message-ID: <20231221092545.1b696eb6@gandalf.local.home> In-Reply-To: References: <39363eb6b1857f26f9fa51808ad48b0121899b84.1702045299.git.naveen@kernel.org> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 21 Dec 2023 10:46:08 +0000 Christophe Leroy wrote: > > To enable ftrace, the nop at function entry is changed to an > > unconditional branch to 'tramp'. The call to ftrace_caller() may be > > updated to ftrace_regs_caller() depending on the registered ftrace ops. > > On 64-bit powerpc, we additionally change the instruction at 'tramp' to > > 'mflr r0' from an unconditional branch back to func+4. This is so that > > functions entered through the GEP can skip the function profile sequence > > unless ftrace is enabled. > > > > With the context_switch microbenchmark on a P9 machine, there is a > > performance improvement of ~6% with this patch applied, going from 650k > > context switches to 690k context switches without ftrace enabled. With > > ftrace enabled, the performance was similar at 86k context switches. > > Wondering how significant that context_switch micorbenchmark is. > > I ran it on both mpc885 and mpc8321 and I'm a bit puzzled by some of the > results: > # ./context_switch --no-fp > Using threads with yield on cpus 0/0 touching FP:no altivec:no vector:no > vdso:no > > On 885, I get the following results before and after your patch. > > CONFIG_FTRACE not selected : 44,9k > CONFIG_FTRACE selected, before : 32,8k > CONFIG_FTRACE selected, after : 33,6k > > All this is with CONFIG_INIT_STACK_ALL_ZERO which is the default. But > when I select CONFIG_INIT_STACK_NONE, the CONFIG_FTRACE not selected > result is only 34,4. > > On 8321: > > CONFIG_FTRACE not selected : 100,3k > CONFIG_FTRACE selected, before : 72,5k > CONFIG_FTRACE selected, after : 116k > > So the results look odd to me. BTW, CONFIG_FTRACE just enables the tracing system (I would like to change that to CONFIG_TRACING, but not sure if I can without breaking .configs all over the place). The nops for ftrace is enabled with CONFIG_FUNCTION_TRACER. -- Steve