From patchwork Wed Mar 29 19:45:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 76801 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp656527vqo; Wed, 29 Mar 2023 13:04:58 -0700 (PDT) X-Google-Smtp-Source: AKy350aY6idecbYn8pX/7V2uap1jxnI1pmPBuO5LtdfyJDT1ToP1AtCZ6IP7OX+hXm9GiktDPnxd X-Received: by 2002:a17:903:2347:b0:1a0:50bd:31c0 with SMTP id c7-20020a170903234700b001a050bd31c0mr25710166plh.24.1680120298433; Wed, 29 Mar 2023 13:04:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680120298; cv=none; d=google.com; s=arc-20160816; b=m1IJiOiCjE3PuZUFkpwOxPyY4GhG5WuvO0jL2pKaahFnN4firXPhlT2QdAD7T4WO3P 9NMzCQnS2wfVjsjaGb3O4m27EU/nkM+ayb/VdCAnmhdzSL2b2uC8dxyZ93dD0gXlQkeS GDmLJlulogkBxJhAcxWdq++UfC0hhKWbZmv0I55SNPy2XFVZc95LihW83lvzCZ39jVf+ Tr/r64DUZD2RY5RVKTPx//Q3Q1j6dtoInU/q+TzNFOaOic19J/5sTSnpFlvhuLQTcNdI 3P/QSWRiXWu5FRyrnDBJ7E4xFwekDVkAPGSzOi+Sy6SZjjORNoVHpVmgdFqtWVSrPmX6 /eUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id; bh=2/3N+yD/dQBNxMAGMB69AdE3RWTGR0FaAhpKzhs3l7s=; b=gR6IJqUAl3jMMCLaq25NzjMBDemEcHW/yKkD3wcB33BvkXRTEU6oWsaFMj+6gsz803 lVnJRQsTKfWU/WR0Um3mEYPmBQBGvlRhWb35VQZENZDPg/UsjjxqchAg8qG91+ogixB8 aBlIxZQsfGldg6JLVXK2JjIXtBfrUwM4MHWIC/1Hx6R7qDunYMeNU6evzguci9fpdcZE RguGZNqoscUZ8se34IWhzps3jnP0x5JZwosgUvkeHT9a0RVqyKpKzfMzhRpSMfcAcUf8 FrS/os7U4dT3mnKhJiDi9WCBApeu4O+L7mQhpO3YngXd7bYnXtDen0pj8bWciVhnWTqg yqxw== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e5-20020a17090301c500b0019e4154578esi34344257plh.76.2023.03.29.13.04.45; Wed, 29 Mar 2023 13:04:58 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230263AbjC2TqS (ORCPT + 99 others); Wed, 29 Mar 2023 15:46:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229940AbjC2Tpx (ORCPT ); Wed, 29 Mar 2023 15:45:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A240CA2 for ; Wed, 29 Mar 2023 12:45:52 -0700 (PDT) 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 0F9BA61E21 for ; Wed, 29 Mar 2023 19:45:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 787B0C43442; Wed, 29 Mar 2023 19:45:51 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1phbjy-002Ri3-1x; Wed, 29 Mar 2023 15:45:50 -0400 Message-ID: <20230329194550.418276586@goodmis.org> User-Agent: quilt/0.66 Date: Wed, 29 Mar 2023 15:45:23 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Andrew Morton , Florent Revest , Will Deacon Subject: [for-next][PATCH 07/25] docs: tracing: Update fprobe documentation References: <20230329194516.146147554@goodmis.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761733821787556904?= X-GMAIL-MSGID: =?utf-8?q?1761733821787556904?= From: "Masami Hiramatsu (Google)" Update fprobe.rst for - the private entry_data argument - the return value of the entry handler - the nr_rethook_node field. Link: https://lkml.kernel.org/r/167526701579.433354.3057889264263546659.stgit@mhiramat.roam.corp.google.com Cc: Florent Revest Cc: Mark Rutland Cc: Will Deacon Signed-off-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) --- Documentation/trace/fprobe.rst | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Documentation/trace/fprobe.rst b/Documentation/trace/fprobe.rst index b64bec1ce144..40dd2fbce861 100644 --- a/Documentation/trace/fprobe.rst +++ b/Documentation/trace/fprobe.rst @@ -87,14 +87,16 @@ returns as same as unregister_ftrace_function(). The fprobe entry/exit handler ============================= -The prototype of the entry/exit callback function is as follows: +The prototype of the entry/exit callback function are as follows: .. code-block:: c - void callback_func(struct fprobe *fp, unsigned long entry_ip, struct pt_regs *regs); + int entry_callback(struct fprobe *fp, unsigned long entry_ip, struct pt_regs *regs, void *entry_data); -Note that both entry and exit callbacks have same ptototype. The @entry_ip is -saved at function entry and passed to exit handler. + void exit_callback(struct fprobe *fp, unsigned long entry_ip, struct pt_regs *regs, 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. @fp This is the address of `fprobe` data structure related to this handler. @@ -113,6 +115,12 @@ saved at function entry and passed to exit handler. to use @entry_ip. On the other hand, in the exit_handler, the instruction pointer of @regs is set to the currect return address. +@entry_data + This is a local storage to share the data between entry and exit handlers. + This storage is NULL by default. If the user specify `exit_handler` field + and `entry_data_size` field when registering the fprobe, the storage is + allocated and passed to both `entry_handler` and `exit_handler`. + Share the callbacks with kprobes ================================