Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1046291lqa; Sun, 28 Apr 2024 16:26:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVGOgAizNCyTlQADrix8BI8826qlcq7Jo44T+uytQ6onrNIXz4v+XlXRW4tZT4jUQN9d2raTW1KnjmfQSEWpgfkH5Bl6LClcJsFiNijEg== X-Google-Smtp-Source: AGHT+IGJDXmprsosJITo1Idm8t55Zw+9xL9vWMZTpJA5X1MaAqqgndvMcU5+ZkbJKvyz6bT6JZxk X-Received: by 2002:a17:902:fc4d:b0:1eb:3e13:ca0b with SMTP id me13-20020a170902fc4d00b001eb3e13ca0bmr7093465plb.37.1714346761331; Sun, 28 Apr 2024 16:26:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714346761; cv=pass; d=google.com; s=arc-20160816; b=RrN1Drx24JapLkTvDbcvOBzpk69jkMSoePhj2OprY4vkrLTugItabg1U5XauNC8pme 6Iw7JHsJgnXdSzk7Ldft+ptNZSCLV8E964jKLtmONMIgRta7iZC8IlGp5VXPDdBWG+ie AM4wdeG+z+LYEfHucPN46l2UrEBb3RW8K5Wtq7jTEYsyKxcVEa7NK+kb3xWHkgvLWZG3 jdB6zw3Zffa3l5X6Nxz2EJw3PXZ87bwC/ztFktZww6L13Bh99GhIvAX+IDYXaA1SLWYg gZ/mildfdPDgT+ZvzOVC5A1YNel/b4k8wtMtkQauylR6w1dkPSLY2vKKq/yN9S5PNfjM 5RNg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=sNURVC608XhUMFFgNlBbUKB9Vk+auGsuKzMX0WGwT0U=; fh=GkjwkVQHCrZteQt60Nz6UortDGjwrhI/3TgLsIjJDOo=; b=JcAVam6p1w51OtPKZDZe5o4p0ZAaVYjP0keoUgiNMdMBAI8Ee0F4LwSvc1HEnQkdbq 3WhBdea8t+xiPTkmAkwIMUn+82ZWuh7nSYGfzMIUmKr+XbRrZiV8Q3BP+sA2sEFRnSkK jG5t2uvgRC4nuvwj1xI0Fbtu3YT3DiRSHO1p6X/agrU+cWGZ6dHnuWueU9uGhnqS+SZ9 vtIdFR3dK1OB5YGih+hZ7jODSxA5kr0GM16jIzRtXZQtmQGSXzqBECjXVtPyatuEruxB z7vH04sw0PuzWK2409SGY5p4nRlB1hX+w3UazXS6p5Xfh2E4TTjXmbmqfFhQRjSSlTNl JgpQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-161628-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161628-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g7-20020a1709026b4700b001eab1c688c3si7050645plt.431.2024.04.28.16.26.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Apr 2024 16:26:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161628-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-161628-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161628-linux.lists.archive=gmail.com@vger.kernel.org" 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id DE1E528111A for ; Sun, 28 Apr 2024 23:26:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE8521D6A8; Sun, 28 Apr 2024 23:25:53 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 597781426C; Sun, 28 Apr 2024 23:25:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714346753; cv=none; b=AkUgfGuCqCVwpxYYtBKlUxRHF0pBJ50FsNNOjnfBtEjCmX31PByKKnuu04IBVptMa0VTrdeNf3cUPdas3GK5ljgZCbB2zGP5VINUv+IIIyULr6mHTDZ0MFKN3ucz+ZudxsqsBQbEkA22V+2C7n8lgFizQjgloBLAVkiYMB1cZ0U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714346753; c=relaxed/simple; bh=yDrUOwB6HaFx72kB39jjAMjhpY5LUydTGFTQOH7bIO0=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ayaZCymykBgm/dSJ4Hyj0KTxKrFJ3Lo9j49hyOr+jrgdr75T7f7olGsVOg4w2xvcvo6E4ZTMqynE34V78HoePfh6+RLNhxCHbOi7E7LdxuCcadTY3fl3KMaRjDuqTtclrUJqb2dFXH82MhWDY9MxWSbcAZfJkwnKYBVNuvdqajY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FF42C113CC; Sun, 28 Apr 2024 23:25:51 +0000 (UTC) Date: Sun, 28 Apr 2024 19:25:49 -0400 From: Steven Rostedt To: Andrii Nakryiko Cc: "Masami Hiramatsu (Google)" , Alexei Starovoitov , 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 Subject: Re: [PATCH v9 00/36] tracing: fprobe: function_graph: Multi-function graph and fprobe on fgraph Message-ID: <20240428192549.7898bf6b@rorschach.local.home> In-Reply-To: References: <171318533841.254850.15841395205784342850.stgit@devnote2> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, 25 Apr 2024 13:31:53 -0700 Andrii Nakryiko wrote: I'm just coming back from Japan (work and then a vacation), and catching up on my email during the 6 hour layover in Detroit. > Hey Masami, >=20 > 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. >=20 > 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. >=20 > You should be already familiar with the bench tool we have in BPF > selftests (I used it on some other patches for your tree). I should get familiar with your tools too. >=20 > 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 >=20 > 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%) >=20 > These numbers are pretty stable and look to be more or less representativ= e. Thanks for running this. >=20 > As you can see, kprobes got a bit faster, kprobe-multi seems to be > about the same, though. >=20 > 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. >=20 > 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. >=20 > 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! My guess is that this patch set helps generic use cases for tracing the return of functions, but will likely add more overhead for single use cases. That is, kretprobe is made to be specific for a single function, but kretprobe-multi is more generic. Hence the generic version will improve at the sacrifice of the specific function. I did expect as much. That said, I think there's probably a lot of low hanging fruit that can be done to this series to help improve the kretprobe performance. I'm not sure we can get back to the baseline, but I'm hoping we can at least make it much better than that 10% slowdown. I'll be reviewing this patch set this week as I recover from jetlag. -- Steve