Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp287779rwd; Mon, 12 Jun 2023 13:36:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6ziolUjs0zOc345ZE5Kr7Nb8TzGTUWsyJQFzqFU0ZJOHi+t07DqdCLAZLK72gkzDdjKVro X-Received: by 2002:a17:90a:b290:b0:250:6c76:fd9b with SMTP id c16-20020a17090ab29000b002506c76fd9bmr9033420pjr.38.1686602179259; Mon, 12 Jun 2023 13:36:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686602179; cv=none; d=google.com; s=arc-20160816; b=bMauM1VYCB9EQHaytPrJ9lLwOlAfngPb8KN95qM1UWuXL1Wz0itcJfnoIeM1FiMmkg vbBovCyHEXcmvGqON3jSabZfTAbd620XtePRrW+Qwhew1IJBIxcbLMHQZOG0+vQXH65z sGMz3BLj8lzo49KBqVpEOaRum5ZB54Iej8ul/83/PUIXraclsbPX3+8KV5x7h517quEO nWGAHc1Wjr/6lf2UV8aAK8f5WVsO/HPmjRafkz9EZ+E6NBDCqzYUuHZHpU9IJ/1rBIQ9 EMVP3XeIGGeFwJ8nzI0TOLyXlziNRuQmRdr9r6aHaJ4+xTjIaYFBN18BZX2iGFYg0ELV +bzA== 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-disposition:mime-version :references:message-id:subject:cc:to:date:from:dkim-signature; bh=Vdv3vzNPkrrapPOhx9OkW0gebiaW56nR0p2AcI7Bl0s=; b=K9g7v+Yah8aoSe5E9E87K3H4/KgB7qHWKSoWUEFgjESVsNLzaVZfpc3WqCOI3hAHK4 JUE/XqzLlIPjwtmH430k+VPSV5L7OxFY3Jh8e4wddXLx+KG69hx648GSMPbzCqdhdiU7 VVAQxIIKP563c9i//aL8r+cODzHM9AJAA8dbn0X00mHMikQlOUepLq/HoIlcSt+ugB2T DQ1WP2PdO9uC92NILR+BsocnlLye+lEMezPDGfrccf9e4bDZnBG/JqewsVysleY+Dist asfZ/IdJSGXskui14oRAR2GsH/CVe7q4WpfwT1BJ3/1i0qc+i2nrA6Odj4PMMCVIeX5u RP8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=YtKUkr7a; 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 e64-20020a636943000000b00543ec36863asi7381611pgc.898.2023.06.12.13.36.07; Mon, 12 Jun 2023 13:36:19 -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=YtKUkr7a; 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 S237099AbjFLU0Q (ORCPT + 99 others); Mon, 12 Jun 2023 16:26:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236948AbjFLU0O (ORCPT ); Mon, 12 Jun 2023 16:26:14 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B135E19B; Mon, 12 Jun 2023 13:25:57 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-97881a996a0so847463366b.0; Mon, 12 Jun 2023 13:25:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686601556; x=1689193556; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=Vdv3vzNPkrrapPOhx9OkW0gebiaW56nR0p2AcI7Bl0s=; b=YtKUkr7aYmpsscebasGh8jqgUj5/RFK5S0z5Vojx92Ai+P7xlRaZJZZw08ZgOJaAh9 tYprzwpmWpRnaVbG5+ooVLNyL6fKx9LI46l6r/JZ7IrIUwgqjc6R4onX0se8NTB9XYva /YFRBczWG//nlp3Vw71eUQ01RVjG8xcrP305D6e2MJyt6nP6WoLY+u/AzPF9e3ZwrHh/ 0Q7k9wqT1FyfVOMfj5mD5WxppPbYiFp2j7gf85nDVb2DcYf+rDNKIN72McnVeSfu3hZY u5dVqvCwxgKgZ0sxbn+8TgjY1raC8UUQF/go2LnfZOkTkoCgwVXb7/V0IU88eq4LwdcA MDvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686601556; x=1689193556; h=in-reply-to: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=Vdv3vzNPkrrapPOhx9OkW0gebiaW56nR0p2AcI7Bl0s=; b=Pb8q7FOoOEMxYeAwugMbkllq8bzn3+GmLzGZlJJxG4tk7soQB3cXI1FHMIc6VckzLQ 4PCvJxVEuIilWoiBjTPQacD4b9Lqqi2ZxMPPYOMgoB/Y6U/KSKqseIxSzha3tPCCxfM9 EA0Tm2FXdNxfYyuU9WOL+peZiNydPGcxd23UoX3RexNcpJ+Z18VRgBGlMESfkRqiKx0e Zt1aeklECtgwks2l+h1eUmWuj/23LBFI4ocUKNenlRAxw3bfYdU8eFTV4m1vfzbHPEWJ RUcR3nQrhDBp5Q8XqdTaL1l/wqPlsWsAPJfRANWa+ne5CEQ0vnHNiiJRnwprk/W8nkX3 2Z3Q== X-Gm-Message-State: AC+VfDw7ewjLVM1gkP/JQLkwTTigWRqMQhaAC26BDELtYjk1npa/dz34 XmWb2ocvOa5gPN09+Z/umk0= X-Received: by 2002:a17:907:728b:b0:97d:a87a:f4db with SMTP id dt11-20020a170907728b00b0097da87af4dbmr8539757ejc.66.1686601555829; Mon, 12 Jun 2023 13:25:55 -0700 (PDT) Received: from krava ([83.240.63.222]) by smtp.gmail.com with ESMTPSA id sa1-20020a170906eda100b009745a6d1b37sm5574871ejb.202.2023.06.12.13.25.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jun 2023 13:25:55 -0700 (PDT) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Mon, 12 Jun 2023 22:25:52 +0200 To: Steven Rostedt Cc: Yonghong Song , Masami Hiramatsu , Mark Rutland , Andrii Nakryiko , lkml , linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org, Andrii Nakryiko , Jackie Liu Subject: Re: [PATCHv2] ftrace: Show all functions with addresses in available_filter_functions_addrs Message-ID: References: <20230611130029.1202298-1-jolsa@kernel.org> <53a11f31-256d-e7bc-eca5-597571076dc5@meta.com> <20230611225407.3e9b8ad2@gandalf.local.home> <20230611225754.01350a50@gandalf.local.home> <20230612110222.50c254f3@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230612110222.50c254f3@gandalf.local.home> 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 Mon, Jun 12, 2023 at 11:02:22AM -0400, Steven Rostedt wrote: > On Mon, 12 Jun 2023 07:49:53 -0700 > Yonghong Song wrote: > > > I am actually interested in how available_filter_functions_addrs > > will be used. For example, bpf_program__attach_kprobe_multi_opts() > > can already take addresses from kallsyms. How to use > > available_filter_functions_addrs to facilitate kprobe_multi? the problem is that we need to do 2 passes: - through available_filter_functions and find out if the function is traceable - through /proc/kallsyms to get the address for traceable function having available_filter_functions symbols together with addresses allow us to skip the kallsyms step and we are ok with the address in available_filter_functions_addr not being the function entry, because kprobe_multi uses fprobe and that handles both entry and patch-site address properly > > Do we need to change kernel APIs? It would be great at least we > > got a RFC patch to answer these questions. > > I agree, having that information would also be useful to me. > > Jiri? Andrii? so we have 2 interfaces how to create kprobe_multi link: a) passing symbols to kernel 1) user gathers symbols and need to ensure that they are trace-able -> pass through available_filter_functions file 2) kernel takes those symbols and translates them to addresses through kallsyms api 3) addresses are passed to fprobe/ftrace through: register_fprobe_ips -> ftrace_set_filter_ips b) passing addresses to kernel 1) user gathers symbols and needs to ensure that they are trace-able -> pass through available_filter_functions file 2) user takes those symbols and translates them to addresses through /proc/kallsyms 3) addresses are passed to the kernel and kernel calls: register_fprobe_ips -> ftrace_set_filter_ips The new available_filter_functions_addrs file helps us with option b), because we can make 'b 1' and 'b 2' in one step - while filtering traceable functions, we get the address directly. I tested the new available_filter_functions_addrs changes with some hacked selftest changes, you can check it in here [1]. I assume Jackie Liu will send new version of her patchset [2] based on this new available_filter_functions_addrs file. I think we should have these changes coming together and add some perf measurements from before and after to make the benefit apparent. jirka [1] https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git/commit/?h=bpf/avail_addrs&id=fecaeeaf40bae034715ab2e9a46ca1dc16371e8e [2] https://lore.kernel.org/bpf/20230526155026.1419390-1-liu.yun@linux.dev/#r