Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp620948rdb; Sat, 19 Aug 2023 16:37:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IErqnRwIwDAF15unAjOO5T1WeP548mY04Cs8TR6f3RXK0C6ehnGUp4jiIaisJ5gZvNdvtjB X-Received: by 2002:a05:6a20:6a05:b0:136:f3ef:4d2 with SMTP id p5-20020a056a206a0500b00136f3ef04d2mr4242251pzk.3.1692488239742; Sat, 19 Aug 2023 16:37:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692488239; cv=none; d=google.com; s=arc-20160816; b=UluVsuIoALe/r336cyUg9kCFnTlGG/g/KXD+DVI+y7pxBi5+/edf+PsAxBoRSoq4Bi txEjQM01rqreQNudoc2Zc7NsTGHFg04l2lwv7AsbIqfxw4wcuwltLXfSSkI88eThnEan JOrU8Y5WXVJkXvpA5azN7FYRbWha5sv/o5VSGUSwzjXwyUq9EoCUovfD7Dnxm7Wyj0vP 7f2Bi8X4PZullOInQtS/a5IhevNzD37/KI6FekQbxt2/l+i5FZxyRoe8VvlKPOlQg1Nn +D94zA5zwLQkD4Wpp6FSMk0R8Vq7HqNMiee6UaDmwLhsptLLfV73bhyaMRZnrus0++Bz xurg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=zzJTGyBFfNHD26CtlWDf2OW3qCUaOPcLUEmxDdyzh1Y=; fh=4Ch4P+TGKtpbgfG71/kyuyy4wiNIYjEkJGijdTSHSpA=; b=e+MUgGThOUWbw70KgE6KsjrsezQqt2eTD0JUPZ0iKKtnjSoWaHSHfdgnVPludlU/wo DVCl4PUu6OSq3Ifc5SRyh4R6cu4pqfm54I5JfYa/Jo2V4lzLsIPWE2BWOnNxTN8LVehY uozauIP4mmgC1EMmjnOY1OZc9tUdh+x2lI0xHIeKVKKbuafBWYezsZajnMqS56xL4ncw U4u8IjbHprnfnPWaGlUUgVbPiQ+0E9ELZnYRHfWe0OxXwR6CdG8er6DM8AwLsoo2Cgo0 +8gtBuox7kmcnhAxF4y4gCK6kNCY/rKTpfLIR0C51Dygthb5hu6Q/Q/HN2zlvctnZQBV aLgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=AX4W4grs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i12-20020a633c4c000000b00563dc438e52si567700pgn.518.2023.08.19.16.36.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 16:37:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=AX4W4grs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 87CA18EEE6; Sat, 19 Aug 2023 11:05:15 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349170AbjHQI57 (ORCPT + 99 others); Thu, 17 Aug 2023 04:57:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349174AbjHQI5d (ORCPT ); Thu, 17 Aug 2023 04:57:33 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31B6B2D56 for ; Thu, 17 Aug 2023 01:57:30 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-563f8e8a53dso4434765a12.3 for ; Thu, 17 Aug 2023 01:57:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1692262649; x=1692867449; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=zzJTGyBFfNHD26CtlWDf2OW3qCUaOPcLUEmxDdyzh1Y=; b=AX4W4grsrDeNO020vqALXp3Khnl8rxn12/hWnVkm67FyUZYNK6smWA2tVd8XAqEEo5 FbFzjnUdn5GyY/imwd42Tip4Ey4NFPGonCAfEMdB44xSE9S0uD+/jMevNWO9J6uHj04P xtYQpsw8LEaz2Y0c/YJMNJg1TpbPHVQ9Qo0Co= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692262649; x=1692867449; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zzJTGyBFfNHD26CtlWDf2OW3qCUaOPcLUEmxDdyzh1Y=; b=RBOxtUX4gu9blDlwF9KObKDcd0pXaEFtCIyxpjnRoQoISqBcuN57yGJsuGhnUqGSWy LsrpWXVBA4nLnkQl8NKxAdXPKFBVHHqWeOMdrGIe0Jbmi7qA2NvhqhI8Sr0YmbK8baLj E36B1rAZAqvnAwyuor9a9FDhCCldZF9VMkiEVW0xN3fIeCAIdn4nJ3eiR9jDVS2NGYeW rSNIorapL+ew9l4dF2eqeytSudK+d1p7lQoMCE300nS84jr3HhxCPGfsF8nof0hBhpUd 23j1fsYyOUZMxp05/skOapKeQa5PoNbnukwUru96+zKR23MSzZjc2GtEO9Aq2S+cvN5i IiSA== X-Gm-Message-State: AOJu0YxDhUluQSZ6ikhq+TQ9C3VvVBdFOFwqPGO7m0W9kaOrxbkGYf0L V7eTi806/e9fepLeLv/TLsNJN6H81fU2RavdrfHgwA== X-Received: by 2002:a17:90b:3b49:b0:268:1be1:745a with SMTP id ot9-20020a17090b3b4900b002681be1745amr3422216pjb.29.1692262649679; Thu, 17 Aug 2023 01:57:29 -0700 (PDT) MIME-Version: 1.0 References: <169181859570.505132.10136520092011157898.stgit@devnote2> <169181860742.505132.14215380532909911090.stgit@devnote2> In-Reply-To: <169181860742.505132.14215380532909911090.stgit@devnote2> From: Florent Revest Date: Thu, 17 Aug 2023 10:57:18 +0200 Message-ID: Subject: Re: [PATCH v3 1/8] Documentation: probes: Add a new ret_ip callback parameter To: "Masami Hiramatsu (Google)" Cc: Alexei Starovoitov , Steven Rostedt , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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_NONE, 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 On Sat, Aug 12, 2023 at 7:36=E2=80=AFAM Masami Hiramatsu (Google) wrote: > > From: Masami Hiramatsu (Google) > > Add a new ret_ip callback parameter description. > > Fixes: cb16330d1274 ("fprobe: Pass return address to the handlers") > Signed-off-by: Masami Hiramatsu (Google) > --- > Documentation/trace/fprobe.rst | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/Documentation/trace/fprobe.rst b/Documentation/trace/fprobe.= rst > index 40dd2fbce861..a6d682478147 100644 > --- a/Documentation/trace/fprobe.rst > +++ b/Documentation/trace/fprobe.rst > @@ -91,9 +91,9 @@ The prototype of the entry/exit callback function are a= s follows: > > .. code-block:: c > > - int entry_callback(struct fprobe *fp, unsigned long entry_ip, struct pt= _regs *regs, void *entry_data); > + int entry_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, struct pt= _regs *regs, void *entry_data); > + void exit_callback(struct fprobe *fp, unsigned long entry_ip, unsigned = long ret_ip, struct pt_regs *regs, void *entry_data); > > Note that the @entry_ip is saved at function entry and passed to exit ha= ndler. > If the entry callback function returns !0, the corresponding exit callba= ck will be cancelled. > @@ -108,6 +108,10 @@ If the entry callback function returns !0, the corre= sponding exit callback will > Note that this may not be the actual entry address of the functi= on but > the address where the ftrace is instrumented. > > +@ret_ip > + This is the return address of the traced function. This can be u= sed > + at both entry and exit. Maybe that's just the lack of coffee but I had to think twice to understand what this paragraph meant :) On my first pass I thought this meant "the address of the return instruction", which made little sense since there can of course be multiple "ret"s in a function. I like the name in the fprobe code "parent_ip" because I find it conveys better that this is an address in the caller of the traced function. I'm also fine with this "ret_ip" but I propose we modify the paragraph a little bit to something like: This is the address that the traced function will return to, somewhere in its caller. This can be used at both entry and exit.