From patchwork Sun Sep 24 13:38:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 144086 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp668807vqu; Sun, 24 Sep 2023 06:38:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHjV7iUxLLP6omDe88hDOrP/I6sUxJiVUPnVqPI1rUjXI96OD8Af15RdTXr+RVy9/52+QsX X-Received: by 2002:a05:6808:611:b0:3a4:24aa:b556 with SMTP id y17-20020a056808061100b003a424aab556mr4882467oih.13.1695562737416; Sun, 24 Sep 2023 06:38:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695562737; cv=none; d=google.com; s=arc-20160816; b=uc7tIqtUsPMzudmylP7UhvL+CjR4ps7XtOmkfWa8EpkmNWUtyYRNtQbE8fEzjor7Ip rZaIGbS7cauQyZ6lGkTRdQ5T8HNQv6JYLlTyy8F01es0x+iwy28TnpZsAPwVfdjoVUod Vg0oTKqekYC+iISZ0Z5eqhJnA1LxpB4J0J/DuhHGm4qnKE+nKX6U4jDpdKnZ09Btph1g lF9CFrWNlPQ4kvP9X/PNRJmfJHMWgXdLAOUN8Q8MoE1VMcNTZfe/i5g/YOTSQ9s6+AG6 pKNaGQr5+Acdu3GO1WKma4W4Bd4nlMALtiZk+opihj36LLt2YuSg66evzBsqPEzwypx6 ZP4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FtMigg13SlVXhJwnQHFG7w/Qu8MO8Af/XlF2dg5TXrQ=; fh=SIgps5XdV0XNwjZfT2uAI7g3mrspDldK9Qs8qQAfoa4=; b=lauX5VzSoMjU5PB1ASu7qIiT+Qdo4POVl9RbTaTlDUaXebPeZ3j9O3KPFSOQMWKojt xhTpLV7I5+morf8xjsbBuUBLXVl8gglRnS1MKfyHndtoAbg2zLfgLU/PDrxIGZ6hZgcP MsAld9C1R1n9pVeJiLgi7bcN7uZZZPKbbEpfEo8Yo0tWZle2pClE1MOmvcMDyChpuKrC TtGBbdmqwCn5sqo08A/Gpk9KoTgzbAJpMZR0RE/LzPjflDDOQJRiW8/YblmfiZ/9nmrr CRXu3u4FdMM4+Cou5NABC0PMgOGnHXrLeVDjM2ry+HB48nHwQR9GWhCU5yDzpnCcp6y3 aPTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pV93df4U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id bk13-20020a056a02028d00b00582f2161cb4si292257pgb.300.2023.09.24.06.38.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 06:38:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pV93df4U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 15ACE80298B0; Sun, 24 Sep 2023 06:38:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231283AbjIXNis (ORCPT + 30 others); Sun, 24 Sep 2023 09:38:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229809AbjIXNi3 (ORCPT ); Sun, 24 Sep 2023 09:38:29 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B61ADE4D for ; Sun, 24 Sep 2023 06:38:08 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80C1CC433C9; Sun, 24 Sep 2023 13:38:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695562688; bh=CLUahLECFFMThaMlg6kBR2ihukQ2SmAsdwcA4AdH8rk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pV93df4UU5q1m05W20xMqKCAie39MI7vyF8y2HIqDTWOsxFBvDzv2eP9xz/EzI0oF e0r4Iuz1rqZhPm2sX88w62J6AMOUShFxf9hVU3p8esqhejBVuWBiqvGfDkIsyv8cdz V02/uAiHnmVFhuk0yj086D+g54+ycpHy3bAB3VryqWXWYY/mxSa66sxl400CIEnKNH tHNbC2rokwrO5AowIFkrUaC4WenWq9wlV/3DYfIR5XkbfMCb0g0IcWm9n45dsLd5Mb 4bF04iwvGb3sWZPighPuFFn7s7wBq6B5nrMjhIYKf1I0uJ+RR6vuiW51e7xhy4OvoC ghBfS8cf5aNOA== From: "Masami Hiramatsu (Google)" To: Alexei Starovoitov , Steven Rostedt , Florent Revest Cc: linux-trace-kernel@vger.kernel.org, LKML , Martin KaFai Lau , bpf , Sven Schnelle , Alexei Starovoitov , Jiri Olsa , Arnaldo Carvalho de Melo , Daniel Borkmann , Alan Maguire , Mark Rutland , Peter Zijlstra , Thomas Gleixner , Guo Ren Subject: [PATCH v5 11/12] Documentation: probes: Update fprobe document to use ftrace_regs Date: Sun, 24 Sep 2023 22:38:01 +0900 Message-Id: <169556268150.146934.2968626447452628416.stgit@devnote2> X-Mailer: git-send-email 2.34.1 In-Reply-To: <169556254640.146934.5654329452696494756.stgit@devnote2> References: <169556254640.146934.5654329452696494756.stgit@devnote2> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sun, 24 Sep 2023 06:38:55 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777926393107609490 X-GMAIL-MSGID: 1777926393107609490 From: Masami Hiramatsu (Google) Update fprobe document so that the entry/exit handler uses ftrace_regs instead of pt_regs. Signed-off-by: Masami Hiramatsu (Google) Acked-by: Florent Revest --- Documentation/trace/fprobe.rst | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Documentation/trace/fprobe.rst b/Documentation/trace/fprobe.rst index 196f52386aaa..64ef522f7a64 100644 --- a/Documentation/trace/fprobe.rst +++ b/Documentation/trace/fprobe.rst @@ -91,9 +91,9 @@ The prototype of the entry/exit callback function are as follows: .. code-block:: c - int entry_callback(struct fprobe *fp, unsigned long entry_ip, unsigned long ret_ip, struct pt_regs *regs, void *entry_data); + int entry_callback(struct fprobe *fp, unsigned long entry_ip, unsigned long ret_ip, struct ftrace_regs *fregs, void *entry_data); - void exit_callback(struct fprobe *fp, unsigned long entry_ip, unsigned long ret_ip, struct pt_regs *regs, void *entry_data); + void exit_callback(struct fprobe *fp, unsigned long entry_ip, unsigned long ret_ip, struct ftrace_regs *fregs, void *entry_data); Note that the @entry_ip is saved at function entry and passed to exit handler. If the entry callback function returns !0, the corresponding exit callback will be cancelled. @@ -112,12 +112,10 @@ If the entry callback function returns !0, the corresponding exit callback will This is the return address that the traced function will return to, somewhere in the caller. This can be used at both entry and exit. -@regs - This is the `pt_regs` data structure at the entry and exit. Note that - the instruction pointer of @regs may be different from the @entry_ip - in the entry_handler. If you need traced instruction pointer, you need - to use @entry_ip. On the other hand, in the exit_handler, the instruction - pointer of @regs is set to the current return address. +@fregs + This is the `ftrace_regs` data structure at the entry and exit. Note that + the instruction pointer of @fregs may be incorrect in entry handler and + exit handler, so you have to use @entry_ip and @ret_ip instead. @entry_data This is a local storage to share the data between entry and exit handlers.