Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4980274rwd; Sun, 11 Jun 2023 20:16:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6rF755jesdZjMBX+UW7qe2eat1CxmHPkLecetHmfKDZZ1rm3UAZMimUfhsc6Qn7Tbm20rA X-Received: by 2002:a05:6a00:24cb:b0:658:6252:fe57 with SMTP id d11-20020a056a0024cb00b006586252fe57mr10354927pfv.24.1686539803052; Sun, 11 Jun 2023 20:16:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686539803; cv=none; d=google.com; s=arc-20160816; b=0IM+5qDE3qwi+X9Vbzxv4YycvsbOvCVCQg2cY3vsiRBtDFhIG5aUyhbKESaerfvAQd v/Wz3X2xQLsdwwih4M4llGK9fE3JfG6nlek0+Xq3uVf/7zQDU1oG7HrTg1RqYUl+Yz1s DlalHFvCBc6iOl84KlNoQt9nUgBbdLBs9Ey5ldyL+/82eCc5E+x0VNwROO5eJOSJxCFF 9Ob0Cyilsbz2rOWRuvj5Xxgk3xfh7RKS4/JSm3mnua3RWa1LGW4b3q+STNn5+Sb7k2yY 61C5QRCEi89ZdyVvaQ4iQGbdTkOB2isliT7DH7BQEygx5uG1WUwNaY5FFAoHL0+JeN2w ZT8Q== 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=Cob64SbLNPFuJv+jvgjFGafEawi4prZbe1DfX3TfHq0=; b=uOdag/s6N5bZ5GeGeUbNmhZ3od9gJQH01UZXxNjMnLUcnCDvgOOAxgRrTFzRcvu/lu k83BWyM9M1thvKA8tP/vERKq7wzcKPGHyRbfFPxxDvLwya2En917gxUbbvCQegkoM0Uv 1V7w7gZNt24iRqec2T/eLKDovIl+OiD6djr1hDu/bAq6aq3fFWCC0Rg54Qdbj4aXrEnX 8LwC65ryNJzap7hgmwwNZ7ahzPkKfC3SYd9O9F/BTmuLmRWs2tBVi4HlZD7jiqFJfP05 pLHWFqTeFQC7NMjd0s1MllwCA1OFLNzFJMJ7WJ3Y3wwkjCFQ9tzpw8pf0PiKMEmbR8Yx UtZg== 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 y77-20020a626450000000b0063afb349e8fsi6227482pfb.141.2023.06.11.20.16.31; Sun, 11 Jun 2023 20:16:43 -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 S234013AbjFLCyW (ORCPT + 99 others); Sun, 11 Jun 2023 22:54:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233956AbjFLCyP (ORCPT ); Sun, 11 Jun 2023 22:54:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E59CFE48; Sun, 11 Jun 2023 19:54:10 -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 8268361D94; Mon, 12 Jun 2023 02:54:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBD9DC4339B; Mon, 12 Jun 2023 02:54:08 +0000 (UTC) Date: Sun, 11 Jun 2023 22:54:07 -0400 From: Steven Rostedt To: Yonghong Song Cc: Jiri Olsa , 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: <20230611225407.3e9b8ad2@gandalf.local.home> In-Reply-To: <53a11f31-256d-e7bc-eca5-597571076dc5@meta.com> References: <20230611130029.1202298-1-jolsa@kernel.org> <53a11f31-256d-e7bc-eca5-597571076dc5@meta.com> 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=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,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 Sun, 11 Jun 2023 17:22:29 -0700 Yonghong Song wrote: > > Note displayed address is the patch-site address and can differ from > > /proc/kallsyms address. > > Could you explain how these addresses will be used in kernel, esp. > since these addresses are different from kallsyms addresses? These are the addresses that will be patched by the ftrace infrastructure. It's more efficient to use these addresses when setting a function filter with ftrace_set_filter_ip(), as it doesn't need to call into the kallsyms infrastructure to look to see if the passed in ip lands on a function. That is, if rec->ip matches the ip, it uses it. If you look at ftrace_location() (which is used to find the record to be patched), it first does a search of these addresses. If it doesn't find it, it then has to call into kallsyms to find the start and end of the function, and do another search into that range. > > Also, if there are multiple same static functions with > different addresses, user space might need to check dwarf or > proposed BTF_KIND_KFUNC (which encode kallsyms addresses) > to find whether entry in available_filter_functions_addrs > to be used. But addresses may not match. How this issue could > be resolved? Easy, you use the address between two other addresses in kallsyms. The address is still in the function. The addresses in kallsyms is the starting address, but there's cases that the patch location is not at the start. -- Steve