From mboxrd@z Thu Jan 1 00:00:00 1970 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 03005C36008 for ; Tue, 17 Sep 2024 10:10:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zyeXhXP07AtTcnGczk0Zu3wJ2FL65eGJVS2tDCXVfQU=; b=3Cclzhc+VcdeEEiKgb1UY3KJ7k 1fddkqQvQj1cngUKO9HbwfSnHVngr2W8/SvrZeZaTwdY9H/CEPmLoUnlaRnrYerB/tj1+Rb9tcwUd vMLp5wLYyN46nqFNdU9VgGz41UmJfLdj9mO1Wz1F7UQvfLgnS+XjmvUR+6QGCqHF7NneKmQHeFqt0 SJV8g/8ZYurvR7JpRjJWKehsCY46z8/ip61fg4ljPe+38oXBiYVyVUlR0K0sn5Nt/+FGY3sNaEBTZ Q8j2YfJh/HxTaSP+93gHahLU/YDFFR514jwZvajQTw0YyfjjB319cOrDIftu5ryIVfoVNOJ7SpRms Nu5cNnnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sqVAB-00000005uXc-01qq; Tue, 17 Sep 2024 10:10:27 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sqV8h-00000005uMo-2CMG for linux-arm-kernel@lists.infradead.org; Tue, 17 Sep 2024 10:08:56 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 28B625C5AE2; Tue, 17 Sep 2024 10:08:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5243BC4CEC5; Tue, 17 Sep 2024 10:08:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1726567734; bh=+p+xzX06Jj/qgHQUUsyqMfiIDzxXJxTBwKU5YNzm6aE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=V7T5lCk5nRzzKAhyIkC6pLUkkNBm9pTCQq2/12J0Pc/Uze6ei05mfSz4Fr+XtaV2G jHprXcyCpfQcU/8wHY5VRw09tfgnj3qGtNr1k29ejZsi6kh/p0UUvZ9zYG5aY3+JHP /ZtrwCM08+NCT7aGwBjfL4/1x/pVHFSD+grUyT+SnU126u1yRm2KgE2DBzp65iC96t Xf5+zbcXwPLKX/h7xy9x3H65XWbKBOvVWqq9/Hc1bFGHyKi8wQ3ABHpJ2+SylHHGC9 0SzNm81H7ohWIuRyigQBcl/X6sKK2cCUskdg3iu3svC//jbOv787dtvKRmC1hE7TYL O9xBlVa51CegA== Date: Tue, 17 Sep 2024 11:08:48 +0100 From: Will Deacon To: Steven Rostedt Cc: Catalin Marinas , linux-arm-kernel@lists.infradead.org, "Masami Hiramatsu (Google)" , Florent Revest , linux-trace-kernel@vger.kernel.org, LKML , Alexei Starovoitov , Jiri Olsa , Arnaldo Carvalho de Melo , Daniel Borkmann , Mark Rutland Subject: Re: [PATCH v14 05/19] function_graph: Pass ftrace_regs to retfunc Message-ID: <20240917100848.GB27384@willie-the-truck> References: <172615368656.133222.2336770908714920670.stgit@devnote2> <172615374207.133222.13117574733580053025.stgit@devnote2> <20240915044920.29a86d25@rorschach.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240915044920.29a86d25@rorschach.local.home> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240917_030855_676798_EBDE10EB X-CRM114-Status: GOOD ( 24.11 ) 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 On Sun, Sep 15, 2024 at 04:49:20AM -0400, Steven Rostedt wrote: > On Fri, 13 Sep 2024 00:09:02 +0900 > "Masami Hiramatsu (Google)" wrote: > > > From: Masami Hiramatsu (Google) > > > > Pass ftrace_regs to the fgraph_ops::retfunc(). If ftrace_regs is not > > available, it passes a NULL instead. User callback function can access > > some registers (including return address) via this ftrace_regs. > > > > Signed-off-by: Masami Hiramatsu (Google) > > --- > > Changes in v8: > > - Pass ftrace_regs to retfunc, instead of adding retregfunc. > > Changes in v6: > > - update to use ftrace_regs_get_return_value() because of reordering > > patches. > > Changes in v3: > > - Update for new multiple fgraph. > > - Save the return address to instruction pointer in ftrace_regs. > > --- > > include/linux/ftrace.h | 3 ++- > > kernel/trace/fgraph.c | 16 +++++++++++----- > > kernel/trace/ftrace.c | 3 ++- > > kernel/trace/trace.h | 3 ++- > > kernel/trace/trace_functions_graph.c | 7 ++++--- > > kernel/trace/trace_irqsoff.c | 3 ++- > > kernel/trace/trace_sched_wakeup.c | 3 ++- > > kernel/trace/trace_selftest.c | 3 ++- > > 8 files changed, 27 insertions(+), 14 deletions(-) > > > > diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h > > index 13987cd63553..e7c41d9988e1 100644 > > --- a/include/linux/ftrace.h > > +++ b/include/linux/ftrace.h > > @@ -1069,7 +1069,8 @@ struct fgraph_ops; > > > > /* Type of the callback handlers for tracing function graph*/ > > typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *, > > - struct fgraph_ops *); /* return */ > > + struct fgraph_ops *, > > + struct ftrace_regs *); /* return */ > > typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *, > > struct fgraph_ops *, > > struct ftrace_regs *); /* entry */ > > diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c > > index 30bebe43607d..6a3e2db16aa4 100644 > > --- a/kernel/trace/fgraph.c > > +++ b/kernel/trace/fgraph.c > > @@ -297,7 +297,8 @@ static int entry_run(struct ftrace_graph_ent *trace, struct fgraph_ops *ops, > > } > > > > /* ftrace_graph_return set to this to tell some archs to run function graph */ > > -static void return_run(struct ftrace_graph_ret *trace, struct fgraph_ops *ops) > > +static void return_run(struct ftrace_graph_ret *trace, struct fgraph_ops *ops, > > + struct ftrace_regs *fregs) > > { > > } > > > > @@ -491,7 +492,8 @@ int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace, > > } > > > > static void ftrace_graph_ret_stub(struct ftrace_graph_ret *trace, > > - struct fgraph_ops *gops) > > + struct fgraph_ops *gops, > > + struct ftrace_regs *fregs) > > { > > } > > > > @@ -787,6 +789,9 @@ __ftrace_return_to_handler(struct ftrace_regs *fregs, unsigned long frame_pointe > > } > > > > trace.rettime = trace_clock_local(); > > + if (fregs) > > + ftrace_regs_set_instruction_pointer(fregs, ret); Where does the instruction pointer get used after this? The arm64 'return_to_handler' function doesn't look at it when we return. Will