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 X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 768C9C433ED for ; Fri, 16 Apr 2021 16:48:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5748A611BF for ; Fri, 16 Apr 2021 16:48:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236495AbhDPQtD (ORCPT ); Fri, 16 Apr 2021 12:49:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:48404 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235437AbhDPQtC (ORCPT ); Fri, 16 Apr 2021 12:49:02 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 58E016117A; Fri, 16 Apr 2021 16:48:36 +0000 (UTC) Date: Fri, 16 Apr 2021 12:48:34 -0400 From: Steven Rostedt To: Masami Hiramatsu Cc: Andrii Nakryiko , Jiri Olsa , Jiri Olsa , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Networking , bpf , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Daniel Xu , Jesper Brouer , Toke =?UTF-8?B?SMO4?= =?UTF-8?B?aWxhbmQtSsO4cmdlbnNlbg==?= , Viktor Malik Subject: Re: [PATCHv2 RFC bpf-next 0/7] bpf: Add support for ftrace probe Message-ID: <20210416124834.05862233@gandalf.local.home> In-Reply-To: <20210417000304.fc987dc00d706e7551b29c04@kernel.org> References: <20210413121516.1467989-1-jolsa@kernel.org> <20210415111002.324b6bfa@gandalf.local.home> <20210415170007.31420132@gandalf.local.home> <20210417000304.fc987dc00d706e7551b29c04@kernel.org> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Sat, 17 Apr 2021 00:03:04 +0900 Masami Hiramatsu wrote: > > Anyway, IIRC, Masami wasn't sure that the full regs was ever needed for the > > return (who cares about the registers on return, except for the return > > value?) > > I think kretprobe and ftrace are for a bit different usage. kretprobe can be > used for something like debugger. In that case, accessing full regs stack > will be more preferrable. (BTW, what the not "full regs" means? Does that > save partial registers?) When the REGS flag is not set in the ftrace_ops (where kprobes uses the REGS flags), the regs parameter is not a full set of regs, but holds just enough to get access to the parameters. This just happened to be what was saved in the mcount/fentry trampoline, anyway, because tracing the start of the program, you had to save the arguments before calling the trace code, otherwise you would corrupt the parameters of the function being traced. I just tweaked it so that by default, the ftrace callbacks now have access to the saved regs (call ftrace_regs, to not let a callback get confused and think it has full regs when it does not). Now for the exit of a function, what does having the full pt_regs give you? Besides the information to get the return value, the rest of the regs are pretty much meaningless. Is there any example that someone wants access to the regs at the end of a function besides getting the return value? -- Steve