Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1415502rdb; Mon, 2 Oct 2023 08:53:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHDaKfKOOBjQlb8Il+h/jVXPUq/41kHMZXOLVEHqy97FVxBtDFgSDKYZraG3LwD+PLHgSG X-Received: by 2002:a05:6a20:96d3:b0:14d:abc:73dc with SMTP id hq19-20020a056a2096d300b0014d0abc73dcmr8812380pzc.32.1696261984690; Mon, 02 Oct 2023 08:53:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696261984; cv=none; d=google.com; s=arc-20160816; b=N8VultgeSIVNVYmXwjpjDBc1DJRB31fmI3Vkg3AVas1PAt961buyCyMS6k3rhuenZw fy+5N45TvNY8EUrjjXgtsxfiYYrFFwwxBR5MRP2L1NYKjK1SuRfV0x1m9JNhGloK4o45 ZeNvR47FFloi6uvRlVcJNEAM5LWJGLPnx46iNYUgtE1Jcd6LT3fQAvzlXz5gWGNRFrg/ AN7opupdmxwxWck5cYrThMa5KVHLuY6VoEdQQiUOcJNbYyTkvNpxIYIEaSPeusf73nbh 68iurE9XaeYCm2ANxlW5+HhIT//GtBxlP8e5Va6Lnvr+AFoovh0vFNujg52XvS/h4lyT 63qg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=heojWX4gugI2QO1+4MY/XYutS6ZnX8rEDmf3QrCrlSY=; fh=UFtuwsnsPKHLPj4aHELek4HMMmRE2f+gsg1yGDAT5ZA=; b=o7eCPXBru7DYWRnwfQie782BINJFnu1FVdKp+KlRfSfGhDS24J8Iu0Fi/S3Ip7R9k+ EK3D0pI/SFLFbufn/SIn+9t78zu9MO43uAYhDfHp2gKm3yJpXchNf2so2EXz2pauvm3m Nj+tU2yE6rKnkRaGchYcb0kg1GlQU/rTCs/5GNKQjN0VMopfM0YUadYJZAuc7eoRexsR OXkx6FDKhWwwcBblKuZkZ7CoaRwCTy4RbuxaYxVUX5dWzVxF2rtO88I13M4T0fS5dri9 99E3FW2fe1vTN1SLzs2ba9E7N4o75ndbNqQgVhPNXg63G1XPnbOfvJlplebOQrcPpeSY Sk8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mw2vG8+9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id bw15-20020a056a00408f00b0068e3f550763si27534231pfb.101.2023.10.02.08.53.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 08:53:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mw2vG8+9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id E1C1E8051A2D; Mon, 2 Oct 2023 08:39:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237903AbjJBPjb (ORCPT + 99 others); Mon, 2 Oct 2023 11:39:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236385AbjJBPja (ORCPT ); Mon, 2 Oct 2023 11:39:30 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32D3CAC for ; Mon, 2 Oct 2023 08:39:28 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 032E5C433C8; Mon, 2 Oct 2023 15:39:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696261167; bh=lIapOgfdyVZYY4MQoc1rwfoDgxd/SzgEEbdHP2GxuT4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=mw2vG8+9aLErpB3lcMeUV0ZuVK8bCXnJPieMZLaXeYZt1ieRZmqPzuPRDjA2YiHhl WW6OPS/RkAm64WAYBD01xAWsAaBumM2s3ZzQXLz/wd46ysKYx6CYR6ZMKGJmYlnwu+ LM0UIDJtUknjTu0B0aBGF61JNWp1OIHgxsgz8rxXskYILfr8INlRPeB7cuvpunmcUT ngzPCBGD5JW5AYq2lRiMGOB4OpJzYC2JLjcbmOiAbdsAObNmiHcI6raT+SEIT1XbFI DttuqXisWPFg1yPHYzj5a4Fxa0UC9jDsZM2Nsn52RD4D0jmVbjby6PIaRDwgPNvD8Y tcm7QK4Jaw7Zw== Date: Tue, 3 Oct 2023 00:39:23 +0900 From: Masami Hiramatsu (Google) To: Masami Hiramatsu (Google) 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 , wuqiang Subject: Re: [PATCH v5 00/12] tracing: fprobe: rethook: Use ftrace_regs instead of pt_regs Message-Id: <20231003003923.eabc33bb3f4ffb8eac71f2af@kernel.org> In-Reply-To: <20230930181435.6663ef5a6ad718548a1e414a@kernel.org> References: <169556254640.146934.5654329452696494756.stgit@devnote2> <20230929102115.09c015b9af03e188f1fbb25c@kernel.org> <20230930181435.6663ef5a6ad718548a1e414a@kernel.org> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, 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 groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 02 Oct 2023 08:39:40 -0700 (PDT) On Sat, 30 Sep 2023 18:14:35 +0900 Masami Hiramatsu (Google) wrote: > On Fri, 29 Sep 2023 17:12:07 -0700 > Alexei Starovoitov wrote: > > > On Thu, Sep 28, 2023 at 6:21 PM Masami Hiramatsu wrote: > > > > > > > > > Thus, what I need is to make fprobe to use function-graph tracer's shadow > > > stack and trampoline instead of rethook. This may need to generalize its > > > interface so that we can share it between fprobe and function-graph tracer, > > > but we don't need to involve rethook and kretprobes anymore. > > > > ... > > > > > And need to add patches > > > > > > - Introduce a generized function exit hook interface for ftrace. > > > - Replace rethook in fprobe with the function exit hook interface. > > > > you mean that rethook will be removed after that? > > No, it is too late. rethook is deeply integrated with kretprobe. > So when we remove the kretprobe, rethook will be removed too. > (fprobe and kretprobe provides similar functionality, so we can > move to fprobe) > > Even though, objpool(*) itself might be kept for some other use > cases. As far as I can see, ftrace_ret_stack can not provide a context > local storage between entry -> exit callbacks. (so this feature must > be dropped from fprobe) > > (*) https://lore.kernel.org/all/20230905015255.81545-1-wuqiang.matt@bytedance.com/ Oops, I rechecked the performance of objpool with prctl loop by perf stat -a -I 10000 --interval-count 4 -e syscalls:sys_enter_prctl And I found that with objpool, fprobe performance is the same as function-graph! noprobe kretprobe fprobe function-graph T1 10706762 8506402 10475887 11249096 T2 28698960 20972543 22567923 22586848 T4 56634397 41500675 45042714 44932685 T8 114910972 85211522 91560078 90068034 T16 228519966 169212249 181582171 181181211 T32 448049923 330408645 361074536 356221873 T64 623779515 450932779 499909030 495516920 objpool consumes more memory than current freelist (because it is just a list with counter) but that is limited. Usual use-case (per-probe node size is 128, # of cpu: 8) one probe will allocate 22KB. (100 probes will need 2.2MB) This is comparable to function graph ret-stack. So now I'm reconsidering the strategy. I might better to keep using rethook, but without ugly pt_regs casts. (e.g. use different trampoline if rethook user requires ftrace_regs) Sorry for confusing the direction. Thank you, -- Masami Hiramatsu (Google)