From patchwork Sat Aug 12 05:38:10 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: 134815 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1536497vqi; Fri, 11 Aug 2023 22:46:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFY18GG4tHKNifInGgXtMlXD8igB3U63scnsZ65hF6WC5bmjXcdEQNjb5tmMpzRKrv0OEPm X-Received: by 2002:a17:907:7886:b0:993:d7ff:afe7 with SMTP id ku6-20020a170907788600b00993d7ffafe7mr3531644ejc.13.1691819183517; Fri, 11 Aug 2023 22:46:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691819183; cv=none; d=google.com; s=arc-20160816; b=JWjH6GeVpI2xU3hT5w7x1LMs6620YbVKcSWFlnSSpqo94Xu1zuBp0Rli3i3zqmTcmr pEFxyJwdwb0psLHipKnPB0WToJ9w2a4y3VJ/DvFFvK9o3HhDy1XFidSKlVqiRkSIRKpP LRnQsNM8MYlyDS0sH8TNGkI1333Vxw7JQacByLOkJFH15dT45zNXVp3qFvYSF35cMVu3 dg9uO/dMkosThGJONRJWEg6jA+cSTKmCgua5PBSEEam0xi22dHnyj1BcSZkSFWwcIkB1 YHOrR1dKAAx2fzZ3muJ7D90UGI/TlBBm2Xsy7Or/U+nyn7Wtj/pL1a0hdb5fuEH8Hn+W yBlQ== 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=VhTQqWfpeulyuK/3Nd3H8+KRgbXglpWC9QFhAsbHfTY=; fh=nNLeqPmm07c4DrdDej5z+HdJpmx5SqFFnpeka2nrMVM=; b=e4SHyDXceuBjYmD912t+vJnnJVMlZOeRkZeTuq5r7RYEx19koI1oqcFiWWG747qLPz n4lJO/YqwalqJpQeDCPO1r943MTHjDBPSrce4Zh96InK2bUHBny4i59bBmrh8U0/cQOL ODC2Nra0hjsUUTyGsRRoon4PL4CC/gyKRgm5nT2aPoN+9G7w/F/s992k2Hc5/WkI5wA2 QVzUnq13MM6etBDzL6SBcydi2FLnEcbqFUw/fPrg0H3V6BFUOhEdmGLRqDJKcToJBofj uJW81AkLKd0T+OJbJ57RL6xM6GyMgUnSR+REjgKbIqwLjSK2vzpdxxoOFX3UYmBLIYBu OxcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vIyseh5+; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a2-20020a17090640c200b0099ce392aec9si4451511ejk.803.2023.08.11.22.45.57; Fri, 11 Aug 2023 22:46:23 -0700 (PDT) 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=vIyseh5+; 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 S234859AbjHLFiU (ORCPT + 99 others); Sat, 12 Aug 2023 01:38:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229912AbjHLFiS (ORCPT ); Sat, 12 Aug 2023 01:38:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 570A41712; Fri, 11 Aug 2023 22:38:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E24486430F; Sat, 12 Aug 2023 05:38:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8381C433C8; Sat, 12 Aug 2023 05:38:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691818696; bh=nAPla5bM8WSnDqOSNz1wS0JqUKaETcUf6cGd53WZP3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vIyseh5+5Iingx8OnLvN6kaJ7wrl4oBRajbwJKbZugplFLx7LonBLHuGJaNAidhln Qj456vP1yYN9RTIN1KuRcN1+7BD2igrXkl02vy+9zwYogTG1qgfV9HKHQjlGtrmyRk 7F3XE+M124rLYmw3dNQ+yLvjS+4/VIV0NVZmZYodOkndN7GRRi1pjqquI0UCwfICEA oMtY+DIpevdQU/qN/LntUD3J3ZAHzGhhrRsKDfHB2WpivcowDRu1nwtpEhigKlCUxd VbiOauyMb0KjEINJ82tB7NfWPNNOduLNqjb/NTr8azbs51dA96LmNmw/uL73Jlv6Lt WbQlYsCxikycQ== 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 Subject: [PATCH v3 8/8] Documentations: probes: Update fprobe document to use ftrace_regs Date: Sat, 12 Aug 2023 14:38:10 +0900 Message-Id: <169181869006.505132.4695602314698748304.stgit@devnote2> X-Mailer: git-send-email 2.34.1 In-Reply-To: <169181859570.505132.10136520092011157898.stgit@devnote2> References: <169181859570.505132.10136520092011157898.stgit@devnote2> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774000992230935830 X-GMAIL-MSGID: 1774000992230935830 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) --- 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 a6d682478147..8eee88eda4e6 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 of the traced function. 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 currect 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.