From patchwork Tue Nov 8 15:50:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 17114 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2790274wru; Tue, 8 Nov 2022 07:51:27 -0800 (PST) X-Google-Smtp-Source: AMsMyM70YddnGV25UYnSKAI0EayX0xRAFjd2qy1C3FwMEBl7ypgsIHTHZDZKJK7LrtUsqJlsLDrf X-Received: by 2002:a05:6402:298b:b0:44f:20a:2db2 with SMTP id eq11-20020a056402298b00b0044f020a2db2mr56496577edb.138.1667922687728; Tue, 08 Nov 2022 07:51:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667922687; cv=none; d=google.com; s=arc-20160816; b=B4gL6yV+YcrGdvCWUzHF7I/tcIajsZSjKvMB0NVk/TAOeUWlVYT6N9iOHbYnl/BFH9 xcjqjdJw6tEpWJHLldoQ0QuNfG/2vrVSDqQPdPnmQ31qYTZIRRZHX9cmW31OJ9xsCtGh riRcsEl6Ep/IJv+xu8lTaz/eU1x8a2Uq8eRVIZelBy6P1X0I3kYMjuMA5uOMqwbl7cro va6cLVJqhADoCqMGRsna7BHM/+ZHPkq5yN8GK2kzfcKEVxxZaVp6oqFLZc67OYj19peH G5AgI1EXK4e5F+03xfpzV0YXF7QJ4jcacXMJcK89GkqxZ9xHk8BDMISBJtaXYqP9AF2r nqTg== 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=uKNQqf7a+Wr/Mp+a8DPaiTaEGh+3/l3O+6MGzs0VJ+k=; b=dncHD+oFZJU1APTuS2pVHqhOGcKeAQn09hPyPwMqk21zjCpL7k7j0YM/Memps6khQr tVTsUVZERFwU536EH60LvoTJ7H7KhzIZsP3kZqPOgbmD0c4koZjEzvMmT2EmJNBYoGRM 6jkveKMaG/cw0UTbnSd67GBKDy4x/GQrUdkygung/7l4SN8PsQzxWYXkI9ACRwM+gRkx e2N6Huj2P5fjxm0hv7pZDt0tV5q5aqswziofls+H0ar/kkrgm0qmbtIhaqqlI/y0Zuoj G+QYVl9Guc1D1Nj+rdbAxlEpGzvZx89ATfalJfRdzQ2zMIN6jmwlydgTcSUOoFGNLuuZ 2usQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qZM6OR4Y; 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 ji4-20020a170907980400b007add882fe58si7990270ejc.796.2022.11.08.07.51.03; Tue, 08 Nov 2022 07:51:27 -0800 (PST) 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=qZM6OR4Y; 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 S234623AbiKHPug (ORCPT + 99 others); Tue, 8 Nov 2022 10:50:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234589AbiKHPuW (ORCPT ); Tue, 8 Nov 2022 10:50:22 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 430A120BFC; Tue, 8 Nov 2022 07:50:22 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id 057FBB81B4F; Tue, 8 Nov 2022 15:50:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6819CC433D6; Tue, 8 Nov 2022 15:50:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667922619; bh=ZwW0qCRKBchNeu3whdSe71nh1Tm4+42ATA3rao4qIss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qZM6OR4Y6Aqyo0+pNKeQSN6ge0SinOEsVZPWkr9UbGKgpet+lrD9PcSMptsHZqtIl vZvT2XTI4UbpvlMMGO3VA9E10Am+ksSUT5uY0J7u2WT1P4BGFTFCXmhLUcECSTTvdf w0LJPqXvFgnMRagRg51V6qD+OnK0uxA41g4K5jBblsJBxFTp8Zi4x1UvI34sgztBBh B5iqXIuDhuO6qSE1OV3Jap3vuJPbbJy5jOo3RUUic/1x3S3h4WHWRXtqe6zZglekEd y126OPYUB8CqyUsMgxRBManfAEI+4wg1hFMdl0CyL2/G4Nrx6jb5c23hQ6YFN5wQ4r M4r3DPjQ3FOjw== From: "Masami Hiramatsu (Google)" To: linux-trace-kernel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Steven Rostedt , mhiramat@kernel.org, Florent Revest , Mark Rutland , Will Deacon Subject: [RFC PATCH 7/9] docs: tracing: Update fprobe documentation Date: Wed, 9 Nov 2022 00:50:16 +0900 Message-Id: <166792261641.919356.4627265153244048545.stgit@devnote3> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <166792255429.919356.14116090269057513181.stgit@devnote3> References: <166792255429.919356.14116090269057513181.stgit@devnote3> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748943700091242357?= X-GMAIL-MSGID: =?utf-8?q?1748943700091242357?= 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. Signed-off-by: Masami Hiramatsu (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 ================================