Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2378746rwd; Fri, 9 Jun 2023 10:15:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7x4vkY0CtoGJbKraNAybSolmGERWyo/eJptaUE9aYyFfQ+o/80FGcswLHHXUmT0vr18o1X X-Received: by 2002:a05:6358:ba83:b0:129:cfc8:5fe2 with SMTP id dg3-20020a056358ba8300b00129cfc85fe2mr1254157rwb.29.1686330904456; Fri, 09 Jun 2023 10:15:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686330904; cv=none; d=google.com; s=arc-20160816; b=qGQHwBXUoYGct07S5lf0tvJr/VC9Bv3A67H4ydKFL99KAEY6RJAseHEwAnzWsfyuEB Y6xEyHirEtWNiztG+IqkEgGvVg0c1kjbYCu5kIJyC0N/AVMl27GD0wjzY1BKtBw52km7 nV3Q9vqy7nGkKeP5Arh9xPYYTza1MdCO6IK3zA5A5tpMBdLUM4MWFmNUB+4MypovAXFA fuMJRVNLl83ysRmXr1/aTGk6TnFSaDtqNJxQCh6fm0gQoPr2zESBAk9U4QnH9XB0vkGR NmCdzP1VGmgZW/c83TnhIIof2S9G7Rbt4Hmf2tVdODWEYh7iJPId6BAIKHTZ5owVykki L5vg== 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; bh=ULu2UJDVtfY4F6K0UzodD85mvD/b5mnKyfgOxvoqYz8=; b=zjcPtNJpze7vtqf5pz/gpCX5KHkvcppEfiu0JdhHUxXADA1d6RM9cxis55ENyGS+o0 o2wGdI1JyDXLGzPsNGvC7VIgU3KtkdxCHfzZXIs35UziRmN5Z0pUZQB94jLJWfbit9L7 ab+XSV91r2OL75M+QKU4h+HKbUkAzhec9OX60V+G6fQTyFyfuqFVti03WeJPTCkUtRlB CqKjwngQnYZ7Au0mZuXBqarMCubZdoxLvHF5grNNHQJ0FWB34WTKN/U6gQf2csQd0CQA H7xuPWIWTdkraaGQuvPWDbB0mDS0bUyTgiVmG1VtdvGbwyBWB9Qd5dOxEiQslrFiUs3O yJ+w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j6-20020a637a46000000b0050beb3fe627si2791438pgn.459.2023.06.09.10.14.52; Fri, 09 Jun 2023 10:15:04 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230219AbjFIRNE (ORCPT + 99 others); Fri, 9 Jun 2023 13:13:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229773AbjFIRNC (ORCPT ); Fri, 9 Jun 2023 13:13:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EE6C3C00; Fri, 9 Jun 2023 10:12:57 -0700 (PDT) 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 BAC9265A37; Fri, 9 Jun 2023 17:12:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 184B2C433EF; Fri, 9 Jun 2023 17:12:54 +0000 (UTC) Date: Fri, 9 Jun 2023 13:12:53 -0400 From: Steven Rostedt To: Jiri Olsa Cc: Mark Rutland , Andrii Nakryiko , Masami Hiramatsu , 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: <20230609131253.0d67e746@gandalf.local.home> In-Reply-To: References: <20230608212613.424070-1-jolsa@kernel.org> <20230608192748.435a1dbf@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,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 Fri, 9 Jun 2023 09:44:36 -0700 Jiri Olsa wrote: > On Fri, Jun 09, 2023 at 09:24:10AM +0100, Mark Rutland wrote: > > > > Do you need the address of the function entry-point or the address of the > > patch-site within the function? Those can differ, and the rec->ip address won't > > necessarily equal the address in /proc/kallsyms, so the pointer in > > /proc/kallsyms won't (always) match the address we could print for the ftrace site. > > > > On arm64, today we can have offsets of +0, +4, and +8, and within a single > > kernel image different functions can have different offsets. I suspect in > > future that we may have more potential offsets (e.g. due to changes for HW/SW > > CFI). > > so we need that for kprobe_multi bpf link, which is based on fprobe, > and that uses ftrace_set_filter_ips to setup the ftrace_ops filter > > and ftrace_set_filter_ips works fine with ip address being the address > of the patched instruction (it's matched in ftrace_location) Yes, exactly. And it's off with the old "mcount" way of doing things too. > > but right, I did not realize this.. it might cause confusion if people > don't know it's patch-side addresses.. not sure if there's easy way to > get real function address out of rec->ip, but it will also get more > complicated on x86 when IBT is enabled, will check > > or we could just use patch-side addresses and reflect that in the file's > name like 'available_filter_functions_patch_addrs' .. it's already long > name ;-) No! "available_filter_function_addrs" is enough to know that it's not kallsyms. It's the filtered function address, which is enough description. If people don't RTFM, then too bad ;-) You can use ftrace_location() that takes an instruction pointer, and will return the rec->ip of that function as long as it lands in between the function's kallsyms start and end values. -- Steve