Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1384272rwd; Thu, 8 Jun 2023 17:37:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5qPJvRdYkYBXYYYea7FnulLzxSDhNmMfsAIvDtNHc1SsUQ0vST+/tEHJcX+H3BFJ9KVp6h X-Received: by 2002:a17:902:ecc2:b0:1b0:42d1:ecd0 with SMTP id a2-20020a170902ecc200b001b042d1ecd0mr12207666plh.66.1686271041600; Thu, 08 Jun 2023 17:37:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686271041; cv=none; d=google.com; s=arc-20160816; b=PBkrq4QKN2PbYuSedN76nYhP80BXDf2KYl3xjkhFsPHdp2CHbvLxlF7prng0lUC9jg eF5V2EGjUfhCO1W01hdkWLi+sCPVLVO63YeOv24Kmf4LtaMEzeswXONnML9s7z2+AljJ oYeOElSJqVyLVdE6H/XKVbYg8u7v1YOc7EF5IMmpwOcYa6y8YsUGxiS/FKKjFtPdwhZN l8ArWZP135ORt8DvZZL762RaHECCj2+m7JYCmC44i9OoR2vHvFlQgFm120tNR6X/+D19 9CcwzpdBSAIlkWnOlnlqtwwPVRfuqujPLJjjYDlGfaXK5ucs0r6ToV678X0ojBigAZld CV6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:date:from:dkim-signature; bh=TsTE3qmxIV7pG9azb/NVqbAFzY56xIALD3o7FLY1GW8=; b=YsIwIZt9COLXFHac1Lm0oUVDYmwG6RlToVWiAI7Y+94TuMfel+VRV1bp2i6kB78DDg 0B0dG6c2Fasw3EkUAt8rh+XFU7Uk0niJkTofKrkIigefH/023/x7rpiqzHtdBJX+3254 kcaGPVE1jLCJ89xB+khcQJ7xuotTCT2V149audMENFUZrjjWKm2oblhDm+QKyvdZWTpU XhLfzy9xU6tEygVDcHU9etyuX/0D7/iuCvUxulfTZw9B0tRGHpMCmCJYESdnXsp0HRHH kzVJcjKN/bWiJ4Is+MhqolG9sqCCOg0T6Z9TVRlA40wjUNs9u7uSEglfMMQaTEhp6c2W evLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=XjnlrHuV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c9-20020a170902d48900b001b075e2e994si1889147plg.575.2023.06.08.17.37.10; Thu, 08 Jun 2023 17:37:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=XjnlrHuV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236418AbjFIAOF (ORCPT + 99 others); Thu, 8 Jun 2023 20:14:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229981AbjFIAOD (ORCPT ); Thu, 8 Jun 2023 20:14:03 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A0362D68; Thu, 8 Jun 2023 17:14:02 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1b00ecabdf2so2698305ad.2; Thu, 08 Jun 2023 17:14:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686269641; x=1688861641; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from:from:to :cc:subject:date:message-id:reply-to; bh=TsTE3qmxIV7pG9azb/NVqbAFzY56xIALD3o7FLY1GW8=; b=XjnlrHuVLqvBaR6lTNTwM/UYSJ4Z0+uyzIaJixshSWSguI3Dx77ZE6c33YZVD7UB// yaXNDXgjPX+uIP8KPtW7Izj/t5NTp78Og9Jzt8TZlT6qjHgoMzxQXYw6U9D53Fr2WZfR w19lMJcknE4ScXne3h44D93yhSXgWfDTjlEiXiiW/qfLqEXxIa3bZ+AmO+mUa7JT/qZ2 yoHhYQsNTwgo1TdmJSKwI7vRgl1HpzrwAIFHFyQi518bu9t0L/wfPzfaZGSKCtB2c8P8 G8p1y9UQJ+8eBbCkRAiaY5xN5nsm7KuNge+qS186ModIPFBUk+/zfo4ci/2YXmKJBu3w WmIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686269641; x=1688861641; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TsTE3qmxIV7pG9azb/NVqbAFzY56xIALD3o7FLY1GW8=; b=LqApAMJrnsuIlg9HqBsLwNNL0ou1SbtjrIZuIj/tBKeAiz4QpozwMSJYSB5DV1pCF3 nJwC00fB4m5z+H60MoCF7yf6hkgc+rLB8GeZ1FhYlkXzmm80Wq+KNL3iMUMbCCYqpdT2 /C4t9UpR/o7T4UrEEj24m5PfW1GAvSq5uLvSvAFlsWHPZyl02Q1kVOqG4JGaqzFZKDct LLCp9J0XQxMfbOhgrmAk01MxsCOntJVSgXwtLn9HBBSt+VpoeXrxpb9AEn4bWd8L8BDH 1c2PXURXIU7yJNBLxnE+DQeVcfnc71vZWU4sO6T9Xk2T9P0Ns/CwbhqkPzL4s8URlZR2 pziQ== X-Gm-Message-State: AC+VfDw0SbXURzcQWP2lp0pqVJ9PKn1QuCg0C4q1j8S6dGLmrJW4bli2 Lk9wPlC2QoSRftlTaxWUi7c= X-Received: by 2002:a17:903:44c:b0:1b2:43a5:a5e5 with SMTP id iw12-20020a170903044c00b001b243a5a5e5mr7407916plb.34.1686269641307; Thu, 08 Jun 2023 17:14:01 -0700 (PDT) Received: from krava (c-67-160-222-115.hsd1.ca.comcast.net. [67.160.222.115]) by smtp.gmail.com with ESMTPSA id p5-20020a170902bd0500b00186a2274382sm1968478pls.76.2023.06.08.17.14.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 17:14:00 -0700 (PDT) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Thu, 8 Jun 2023 17:13:57 -0700 To: Andrii Nakryiko Cc: Steven Rostedt , Masami Hiramatsu , Mark Rutland , Andrii Nakryiko , lkml , linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org, Jackie Liu Subject: Re: [PATCH RFC] ftrace: Show all functions with addresses in available_filter_functions_addrs Message-ID: References: <20230608212613.424070-1-jolsa@kernel.org> <20230608192748.435a1dbf@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Thu, Jun 08, 2023 at 04:55:40PM -0700, Andrii Nakryiko wrote: > On Thu, Jun 8, 2023 at 4:27 PM Steven Rostedt wrote: > > > > On Thu, 8 Jun 2023 15:43:03 -0700 > > Andrii Nakryiko wrote: > > > > > On Thu, Jun 8, 2023 at 2:26 PM Jiri Olsa wrote: > > > > > > > > > > > > hi, > > > > when ftrace based tracers we need to cross check available_filter_functions > > > > with /proc/kallsyms. For example for kprobe_multi bpf link (based on fprobe) > > > > we need to make sure that symbol regex resolves to traceable symbols and > > > > that we get proper addresses for them. > > > > I forgot, what was the problem with doing the above? > > More code, more memory, more CPU to parse all the text files. Parsing > kallsyms is quite expensive, so avoiding this would be great. yes, reading both kallsyms and available_filter_functions parsing often shows up in perf profiles > > > > > > > > > > > Looks like on the last last LSF/MM/BPF there was an agreement to add new > > > > file that will have available_filter_functions symbols plus addresses. > > > > > > > > This RFC is to kick off the discussion, I'm not sure Steven wants to do > > > > that differently ;-) > > > > I'm not totally against this, but I'd like to know the full issue its > > solving. Perhaps I need to know more about what is being done, and what is > > needed too. > > There are BPF tools that allow user to specify regex/glob of kernel > functions to attach to. This regex/glob is checked against > available_filter_functions to check which functions are traceable. All > good. But then also it's important to have corresponding memory > addresses for selected functions (for many reasons, e.g., to have > non-ambiguous and fast attachment by address instead of by name, or > for some post-processing based on captured IP addresses, etc). And > that means that now we need to also parse /proc/kallsyms and > cross-join it with data fetched from available_filter_functions. > > All this is unnecessary if avalable_filter_functions would just > provide function address in the first place. It's a huge > simplification. And saves memory and CPU. > > > > > > > > > > > thanks, > > > > jirka > > > > > > > > > > > > --- > > > > Adding new available_filter_functions_addrs file that shows all available > > > > functions (same as available_filter_functions) together with addresses, > > > > like: > > > > > > > > # cat available_filter_functions_addrs | head > > > > > > nit: can we have some more succinct name, like "traceable_funcs" or > > > > > > It's to match avaliable_filter_functions > > it's minor, I'm fine with whatever name, I'm searching for it in my > history every single time anyways :) > > > > > Another way is to add a tracing option to make the address show up in the > > available_filter_functions file. That would be my preferred choice. > > > > echo 1 > options/available_filter_addrs > > > > Or something like that. > > This would modify behavior for entire system, right? I think this is > very bad. Just because one application is aware of this option and > wants to turn this on, doesn't mean that all other applications that > might also use available_filter_functions should immediately break on > that machine. > > Please, let's have a separate file. There is no downside to that. +1 for file, AFAIU the option would change that globaly so we could race with another app and break each other jirka