Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5335EC433FE for ; Fri, 7 Jan 2022 12:55:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347323AbiAGMzR (ORCPT ); Fri, 7 Jan 2022 07:55:17 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:38304 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231207AbiAGMzP (ORCPT ); Fri, 7 Jan 2022 07:55:15 -0500 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 dfw.source.kernel.org (Postfix) with ESMTPS id DEAAA60AAF; Fri, 7 Jan 2022 12:55:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91584C36AE5; Fri, 7 Jan 2022 12:55:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641560114; bh=JsU2qs9kcOP11xgLqJB4Eq2GZtGGt42uQoq8yv8fZVM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QEVI3shOr9SR1meDkjYxcklM/V/6xbAbo5TK3ThOsPiZV/MHKPGfXtOQZnos0jlre XcwqQapC6J9BH3/rq0zh9cC5YEGqtHBcdIEFa42P4mXdCpwis16rwYrFZfEl8o1uFJ Ip2fEa1p0dcK99KBgG4rsKwoem0H17SS17/VA6KnsVpoQnThC6YmuWWbJWb04Xsc8f ZsRCgCoy7akLsCEhiUuV6TR0XbY+P4HrWVLlC7p3nyIUb0AOLNV9QwWPOmEB1kMylm VxRMVbKN+eF/nqxBtfgLsNKlRnI/XqKzKxlasvbBEZ7Najunn2/bbk1/ndfhSPxfz1 15dkwWmvgfdZw== Date: Fri, 7 Jan 2022 21:55:08 +0900 From: Masami Hiramatsu To: Alexei Starovoitov Cc: Jiri Olsa , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Network Development , bpf , lkml , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Steven Rostedt , "Naveen N. Rao" , Anil S Keshavamurthy , "David S. Miller" Subject: Re: [RFC 00/13] kprobe/bpf: Add support to attach multiple kprobes Message-Id: <20220107215508.eaac4e225add48b0705f5f14@kernel.org> In-Reply-To: References: <20220104080943.113249-1-jolsa@kernel.org> <20220106002435.d73e4010c93462fbee9ef074@kernel.org> <20220106225943.87701fcc674202dc3e172289@kernel.org> <20220107085203.14f9c06e0537ea6b00779842@kernel.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 6 Jan 2022 16:20:05 -0800 Alexei Starovoitov wrote: > On Thu, Jan 6, 2022 at 3:52 PM Masami Hiramatsu wrote: > > > > On Thu, 6 Jan 2022 09:40:17 -0800 > > Alexei Starovoitov wrote: > > > > > On Thu, Jan 6, 2022 at 5:59 AM Masami Hiramatsu wrote: > > > > > > > > That seems to bind your mind. The program type is just a programing > > > > 'model' of the bpf. You can choose the best implementation to provide > > > > equal functionality. 'kprobe' in bpf is just a name that you call some > > > > instrumentations which can probe kernel code. > > > > > > No. We're not going to call it "fprobe" or any other name. > > > From bpf user's pov it's going to be "multi attach kprobe", > > > because this is how everyone got to know kprobes. > > > The 99% usage is at the beginning of the funcs. > > > When users say "kprobe" they don't care how kernel attaches it. > > > The func entry limitation for "multi attach kprobe" is a no-brainer. > > > > Agreed. I think I might mislead you. From the bpf user pov, it always be > > shown as 'multi attached kprobes (but only for the function entry)' > > the 'fprobe' is kernel internal API name. > > > > > And we need both "multi attach kprobe" and "multi attach kretprobe" > > > at the same time. It's no go to implement one first and the other > > > some time later. > > > > You can provide the interface to user space, but the kernel implementation > > is optimized step by step. We can start it with using real multiple > > kretprobes, and then, switch to 'fprobe' after integrating fgraph > > callback. :) > > Sounds good to me. > My point was that users often want to say: > "profile speed of all foo* functions". > To perform such a command a tracer would need to > attach kprobes and kretprobes to all such functions. Yeah, I know. That is more than 10 years issue since systemtap. :) > The speed of attach/detach has to be fast. Yes, that's why I provided register/unregister_kprobes() but it sounds not enough (and maybe not optimized enough because all handlers are same) > Currently tracers artificially limit the regex just because > attach/detach is so slow that the user will likely Ctrl-C > instead of waiting for many seconds. Ah, OK. Anyway I also would like to fix that issue. If user wants only function entry/exit, it should be done by ftrace. But since the syntax (and user's mind model) it should be done via 'kprobe', so transparently converting such request to ftrace is needed. Thank you, -- Masami Hiramatsu