Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1605701lqa; Mon, 29 Apr 2024 13:25:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXOMSXqU2A1TCwV4fJBqCrgoHIxGMNEAKrNJ2x7fdkhQv8Zpp921P8pK4+wkGRnz+1xo+ZQS2qnfHPfJ8cxf0xIw8WtCy3lLe6bbJHceQ== X-Google-Smtp-Source: AGHT+IHDc2j08mFAgdH0+/+3eMbxL9VEdrq4D56bCS6naIvHRMHgdrdEdr1lJcHzEwrtJBxPkw8z X-Received: by 2002:a05:620a:460e:b0:790:e903:2b6a with SMTP id br14-20020a05620a460e00b00790e9032b6amr813969qkb.33.1714422329664; Mon, 29 Apr 2024 13:25:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714422329; cv=pass; d=google.com; s=arc-20160816; b=c+tDAWnfsxnzqoQJgX3s4ypqqcpJ0ySPC5S8G6oNJIYXwjVRyvjqDVL0ZzloLZjjXF gz+DH36fbXQErZvcIIITFZ786RQOLt9uVBzGIkaRLaIJolciKi8+KLe3m+lgTBOY7bnj 12WU/5E2RB+A5K+SDWS9FATXVak2Pry250m4eR1huwYcljpyskAhXJFu5pBTGJ5KjR8E wdrimOEatSXJcqRyrRWJCXSZIKmCguN9M3F9LThye4KF9ePGChhGMFctUoRCpEgSU4sx EOYzlwzkjaERukau4OJKk0cBRfSmxy5ICbCXKB34PoqQlU3Jz+osuJN5jDa3TDQD5Cef oVpg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=bhvp4E4fp/vgpdAzYCAoNC2wEtSAZOXyDAc7Z10R4aM=; fh=NVBlqa8rEZ9qXMrkE4yCJiAWxkQTDCtw+QUSE5UYr1w=; b=NxkD4IWVh5ZGB2qMFuA/91BwwnsXum89wfgebBiwEQj1yMXL5pChB5K6ZpwvEzmgUK hQAs8YkftrZybM7gByFqYlFoOovga+G+UIUs06s5Ded07RaPlLoNtWD/frv5S03MHpy3 ogRubfLnAsxYxIoGBzRL8LoaZXBxiIhg8RcYZODtQpTs1Jikt6t8BleJFsT0+PfRoWTw jV/pQ7ru5ljs6Tq+WfojYQ9v7R5Ij2AGsenhIlCfUQcIhAwpN4u+Pv8c8LN0NWJIwfW3 6RIJDK12vR3aH4/o0MjBN4YgrI1spw+JjSIi3JET9/Jes19u3r+CRP/mgAavpp/Jfcsi Zagw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=b4xufAP6; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-163014-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163014-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id o15-20020a05620a0d4f00b0078ef169494dsi26102796qkl.146.2024.04.29.13.25.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 13:25:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163014-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=b4xufAP6; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-163014-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163014-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 589641C21DE3 for ; Mon, 29 Apr 2024 20:25:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B76901422A6; Mon, 29 Apr 2024 20:25:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="b4xufAP6" Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6AE5E1411DD; Mon, 29 Apr 2024 20:25:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714422318; cv=none; b=kthEZgimGAtLjNhXbgVjR4e0dr3UIBYbMIn3w4o8b3Cfdi2p9KyVkLDwQg6iDzi25td84ccMZuix6cDuACwYgc/InzVY7w6h7Lz28wVoRdWesndUMDbr/jInRM5/DS6/ncwKpzIwiaBUXhNyGlr5GZWRQjEmwPQzXizsg+nA0M0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714422318; c=relaxed/simple; bh=pwghGgL6we/Ml2C/J3V6Adbah1A6tVb7wbS4TO2icFY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=qNKQz/QkHJYGXyeKKZYMOd7NXs4+TP2p5+2RCDzkAg4ECvnsPhd6xCl9cBfA+kqPkinpKX03osu5gUxGFJ98O54pFAv4PfCA1GEO+/TKJCZXYWekmp5xTnNA1grgmfzX1NOEiw8Hl2g5L4OoRY7ODVMXX3hMENYIb5pl7Svq/y0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=b4xufAP6; arc=none smtp.client-ip=209.85.215.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-53fbf2c42bfso3502489a12.3; Mon, 29 Apr 2024 13:25:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714422317; x=1715027117; darn=vger.kernel.org; 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=bhvp4E4fp/vgpdAzYCAoNC2wEtSAZOXyDAc7Z10R4aM=; b=b4xufAP6dL23XCJR9UBGVTYH4YoBExeL8FiFrcOizSZOEGLT4cOYeWRkgKh2nq9mSA l2uq69OsZxATFdJeDuEN5TayfarL4eclLRZz/O9+ZMltYD433wBO11DV9Y93LXvDPQWd CSPb8vq02ERAkFZ7WDcbn8L8TqRZ+4ibII3X2ikP6AbSp4CK0HEpbkBMzNwv8mOJ4U/N K6wNyFu8doFJ2wmFtWLziOVSH+HsQF/4OC1uA1xpRsr8mELChzmLjLbIbL58ANcmIHUg c+YEPp0Om0ousm9OJM0t/bxHDffTuC1+JDfsHObefTEpABg/RwfspG/OusA9TnKry8Fa wRfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714422317; x=1715027117; 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=bhvp4E4fp/vgpdAzYCAoNC2wEtSAZOXyDAc7Z10R4aM=; b=fPtnjz/9lga3YyhPs2YFUwrNibJvME1Bxr7AlPswWwuw2YG+8XHA075xrBPNBHpBOk RU7Kzo4AFDULLqyx5fZzeRIo5dqfT30gPliI+1VOxBsNiSRcT5lMV5jhBEIklXrbADvD 4qJkKFGBz+YwHSAc1i+sRbY0KZ2fFwOajIomxKZRkRHZ9axYmPpE7PpgZlFwa23m6wd5 fwMvhyXn1fVYcKHBUAdEgwcXKGyBYJZA5ZSQRJzax5Lgjpi2uDGxLYYXT4sIawG/b2dy LHOPsa2uJ18Muin+c8PwrZ4amp60YgEJTZnWrjp663y0HRNdYAXOapOv6xSkzUYs16XU Q68g== X-Forwarded-Encrypted: i=1; AJvYcCU43OM7GzWZbwt2lNVWU5vRJBkOEPldSNce06eVK1kTeaM1ukjVydb03i24UIgcuJ/ZeKm9QG9EbeKuChbpn8d7gP71/iMUFkzAkTggZ4z1by5GVQNk0y5HFkIP/TnS6KaRYLuoDncp2Lk7FDP2M1n5rpxIKC9hJYy+fde282cSzpbqf3yU X-Gm-Message-State: AOJu0YzIiZmV8e8Id2HnCble6rak1Q+GTjsYgYGAYVItWH+IHjY7JMqz iQyPW468bZgqvAWZSavjk/p94zm5wbWNC4Qc9LX6xguRyjFUcNQyCPnwmmEXCGuHm/pWpkb8rmd CKSprMBDv//LSGThvuGnwDunmprw= X-Received: by 2002:a17:90a:4dc7:b0:2b1:782:8827 with SMTP id r7-20020a17090a4dc700b002b107828827mr729722pjl.20.1714422316584; Mon, 29 Apr 2024 13:25:16 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <171318533841.254850.15841395205784342850.stgit@devnote2> <20240429225119.410833c12d9f6fbcce0a58db@kernel.org> In-Reply-To: <20240429225119.410833c12d9f6fbcce0a58db@kernel.org> From: Andrii Nakryiko Date: Mon, 29 Apr 2024 13:25:04 -0700 Message-ID: Subject: Re: [PATCH v9 00/36] tracing: fprobe: function_graph: Multi-function graph and fprobe on fgraph To: Masami Hiramatsu Cc: Alexei Starovoitov , Steven Rostedt , Florent Revest , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Apr 29, 2024 at 6:51=E2=80=AFAM Masami Hiramatsu wrote: > > Hi Andrii, > > On Thu, 25 Apr 2024 13:31:53 -0700 > Andrii Nakryiko wrote: > > > Hey Masami, > > > > I can't really review most of that code as I'm completely unfamiliar > > with all those inner workings of fprobe/ftrace/function_graph. I left > > a few comments where there were somewhat more obvious BPF-related > > pieces. > > > > But I also did run our BPF benchmarks on probes/for-next as a baseline > > and then with your series applied on top. Just to see if there are any > > regressions. I think it will be a useful data point for you. > > Thanks for testing! > > > > > You should be already familiar with the bench tool we have in BPF > > selftests (I used it on some other patches for your tree). > > What patches we need? > You mean for this `bench` tool? They are part of BPF selftests (under tools/testing/selftests/bpf), you can build them by running: $ make RELEASE=3D1 -j$(nproc) bench After that you'll get a self-container `bench` binary, which has all the self-contained benchmarks. You might also find a small script (benchs/run_bench_trigger.sh inside BPF selftests directory) helpful, it collects final summary of the benchmark run and optionally accepts a specific set of benchmarks. So you can use it like this: $ benchs/run_bench_trigger.sh kprobe kprobe-multi kprobe : 18.731 =C2=B1 0.639M/s kprobe-multi : 23.938 =C2=B1 0.612M/s By default it will run a wider set of benchmarks (no uprobes, but a bunch of extra fentry/fexit tests and stuff like this). > > > > BASELINE > > =3D=3D=3D=3D=3D=3D=3D=3D > > kprobe : 24.634 =C2=B1 0.205M/s > > kprobe-multi : 28.898 =C2=B1 0.531M/s > > kretprobe : 10.478 =C2=B1 0.015M/s > > kretprobe-multi: 11.012 =C2=B1 0.063M/s > > > > THIS PATCH SET ON TOP > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > kprobe : 25.144 =C2=B1 0.027M/s (+2%) > > kprobe-multi : 28.909 =C2=B1 0.074M/s > > kretprobe : 9.482 =C2=B1 0.008M/s (-9.5%) > > kretprobe-multi: 13.688 =C2=B1 0.027M/s (+24%) > > This looks good. Kretprobe should also use kretprobe-multi (fprobe) > eventually because it should be a single callback version of > kretprobe-multi. > > > > > These numbers are pretty stable and look to be more or less representat= ive. > > > > As you can see, kprobes got a bit faster, kprobe-multi seems to be > > about the same, though. > > > > Then (I suppose they are "legacy") kretprobes got quite noticeably > > slower, almost by 10%. Not sure why, but looks real after re-running > > benchmarks a bunch of times and getting stable results. > > Hmm, kretprobe on x86 should use ftrace + rethook even with my series. > So nothing should be changed. Maybe cache access pattern has been > changed? > I'll check it with tracefs (to remove the effect from bpf related changes= ) > > > > > On the other hand, multi-kretprobes got significantly faster (+24%!). > > Again, I don't know if it is expected or not, but it's a nice > > improvement. > > Thanks! > > > > > If you have any idea why kretprobes would get so much slower, it would > > be nice to look into that and see if you can mitigate the regression > > somehow. Thanks! > > OK, let me check it. > > Thank you! > > > > > > > > 51 files changed, 2325 insertions(+), 882 deletions(-) > > > create mode 100644 tools/testing/selftests/ftrace/test.d/dynevent/ad= d_remove_fprobe_repeat.tc > > > > > > -- > > > Masami Hiramatsu (Google) > > > > > > -- > Masami Hiramatsu (Google)