Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1118489rwb; Thu, 1 Dec 2022 12:38:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf4cLoLLNfIWzk3UnYMrf/Yumu3chjhaB1XtAzKe5qnNNs6md7+A223TEKLx+exwEIFbN477 X-Received: by 2002:a05:6a00:e0f:b0:563:312d:745b with SMTP id bq15-20020a056a000e0f00b00563312d745bmr49371173pfb.69.1669927127064; Thu, 01 Dec 2022 12:38:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669927127; cv=none; d=google.com; s=arc-20160816; b=r8aZiPoDoNN8E5WCpNXqm+4eI/SlpGVsFdT5HYJ2ZzlOML1OPHxXUljO83Fjrp5qRo zV7fxf0vo5Y8mOhas07jCTWy9CeRG6GKON8ET95+OzH+Y7QpsYGytA0eaZKXd46YYbPv yvABTrPtqJTjiJV9fSdFCeDUMqYz8Jl7gOQKM9lLkpdAu8IqdebQi5YNyVBx0SX49mgW xPuTZjA+PK14Et+KX9/BlJBJtoTzTZDmnoQ1aEsVDcVOsnW/s9BwvrcPlpbslM2tgmbw SbUibHxFPpocozXpCpqvGu5UCDbqDG2VB15TbGinVa40vkuGmJK8UasvmfAFI2zatNf9 xC6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=X6jCoDWn4vxxkdUolJN12fKBfV/QUq+JhIRVlXbcxzk=; b=hmTR1oSM5y16bgxHiw3B6p+snfU0uDaV+S085RG95Xub2U9VNe91jnjh6f0UZ3872x bFAA+dBr0PybpZwRqA3ZZ8VgVXApzaT4ehnhr9KivvK5Pig4X6BfxheRIfihU7Bj4GC4 qUkF+Mij31MxvikhlMvJhxqhWbt6EcA01ETa8QvVmXkmLxiFcKqodW3ClhfLcUCZe4hF ULlyrO4JttGl6PO+9tcSsBgbFlS8XsW50bvX/OIaNdQKqxYK0GrIxGZUeG7mCUeUUDGv RelDeseL6fmrbCGNSEAawFOwjuRtKaNj6esjOgkJvxjVMl4pw/BS7JKR4M/5yf0dxyHU Ay4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sfskE8Pq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v10-20020a63f20a000000b00478642ccec6si5230557pgh.809.2022.12.01.12.38.35; Thu, 01 Dec 2022 12:38:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sfskE8Pq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230521AbiLAUQD (ORCPT + 82 others); Thu, 1 Dec 2022 15:16:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230442AbiLAUP7 (ORCPT ); Thu, 1 Dec 2022 15:15:59 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72A0CBF659 for ; Thu, 1 Dec 2022 12:15:53 -0800 (PST) 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 0C4846210F for ; Thu, 1 Dec 2022 20:15:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D9FFC433D6; Thu, 1 Dec 2022 20:15:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669925752; bh=vVCfhscBzI9hn0s5h73jc2HuArjB4WLayXOmvKzLUo4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sfskE8PqGZAE0YG11Edae4n8y4yWSGcNRmmu1azjGMUZLqBzNWIuh9gs2rLPEUwn3 mWFDLZtbpnoT181NqZB6ZxAQajpEk6nXI+zJihxAecgvMGnT7kCQGOZYj7I4egm5VK 7/X7zOyOnH9tnWdb3OhbwVFH82y8u3/wz72kZWXTp9bzZx5OiU3Gdwp8K/ClkcG3Si US4hWWCYF/cpmd2SCt74dK8A239FzO9BOlyOJa6uUm9lit+9oPQG6Q0dkRvf3xNViW I8wwd7uCEut4eToKMajbE9s7FmU0BquA/BoziUayCUzZ+PG++Q75e7Dw308qqRMum/ kD6mJMeAmcAWg== Date: Thu, 1 Dec 2022 20:15:46 +0000 From: Conor Dooley To: Palmer Dabbelt Cc: guoren@kernel.org, anup@brainfault.org, Paul Walmsley , Conor Dooley , heiko@sntech.de, rostedt@goodmis.org, mhiramat@kernel.org, jolsa@redhat.com, bp@suse.de, jpoimboe@kernel.org, suagrfillet@gmail.com, andy.chiu@sifive.com, mark.rutland@arm.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V4 6/7] riscv: ftrace: Add DYNAMIC_FTRACE_WITH_DIRECT_CALLS support Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 01, 2022 at 12:06:39PM -0800, Palmer Dabbelt wrote: > On Thu, 01 Dec 2022 12:02:56 PST (-0800), Conor Dooley wrote: > > On Mon, Nov 28, 2022 at 10:32:29PM -0500, guoren@kernel.org wrote: > > > From: Song Shuai > > > > > > This patch adds DYNAMIC_FTRACE_WITH_DIRECT_CALLS support for RISC-V. > > > > > > select the DYNAMIC_FTRACE_WITH_DIRECT_CALLS to provide the > > > register_ftrace_direct[_multi] interfaces allowing users to register > > > the customed trampoline (direct_caller) as the mcount for one or > > > more target functions. And modify_ftrace_direct[_multi] are also > > > provided for modifying direct_caller. > > > > > > To make the direct_caller and the other ftrace hooks (eg. function/fgraph > > > tracer, k[ret]probes) co-exist, a temporary register is nominated to > > > store the address of direct_caller in ftrace_regs_caller. After the > > > setting of the address direct_caller by direct_ops->func and the > > > RESTORE_REGS in ftrace_regs_caller, direct_caller will be jumped to > > > by the `jr` inst. > > > > > > Signed-off-by: Song Shuai > > > Tested-by: Guo Ren > > > Signed-off-by: Guo Ren > > > --- > > > arch/riscv/Kconfig | 1 + > > > arch/riscv/include/asm/ftrace.h | 6 ++++++ > > > arch/riscv/kernel/mcount-dyn.S | 4 ++++ > > > 3 files changed, 11 insertions(+) > > > > > > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig > > > index 1d0e5838b11b..2828537abfcd 100644 > > > --- a/arch/riscv/Kconfig > > > +++ b/arch/riscv/Kconfig > > > @@ -278,6 +278,7 @@ config ARCH_RV64I > > > select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 > > > select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && $(cc-option,-fpatchable-function-entry=8) > > > select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE > > > + select HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS > > > select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL > > > select HAVE_FUNCTION_GRAPH_TRACER > > > select HAVE_FUNCTION_TRACER if !XIP_KERNEL && !PREEMPTION > > > > Please sort new entries here in alphabetical order, so move the new > > entry up by one line :) > > IIRC whomever sorted these entrties orignially posted a script that does > that. Maybe that should be integrated into either checkpatch or one of the > patchwork robots so we don't have to manually remember the alphabet? If it actually does *sorting* I am not sure it's a suitable inclusion as-is that'd seem better as a pre-commit hook. But maybe it can be co-opted somehow. I'll try to dig it up off of lore tomorrow. Thanks, Conor.