Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1767534rwd; Fri, 9 Jun 2023 01:40:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7c8nscCgCLricSwHxxSJHeQGRGniDVMLftktnhoRB/tiGVcnMrPvq2cjJa2Y7mXzWbXNmz X-Received: by 2002:a05:6358:ecf:b0:129:c18a:6331 with SMTP id 15-20020a0563580ecf00b00129c18a6331mr345306rwh.13.1686300039293; Fri, 09 Jun 2023 01:40:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686300039; cv=none; d=google.com; s=arc-20160816; b=C67dPfysWQmQvbWSY1RnnwXRqQOFXl9jc6jLCJ4fm2xFGxk3PLc8xXFTyrO+D9m+C2 fma6bDyrk0wlDoeJ3Hj8534yKd23ipJRKCF2BB2guztQUjvg5bNx2O2dAv4eDliArJvZ HmP39u3E9f0hlcbHr2HlNnh63ECAzEuVQIwFs7dvk77NdOnIzLRSjB4m/fcfvknPw5il EDZNNoo6+yXgJ3OYpsMLoq/4cX1dyp6CRxrBZK/7YJgtOXukSreOfnx/jHHfqCJdfP0d 69sauCbP6kNXJDn5hI6GM/emYE6Ybl0dZBo7Fu9H1whrojmvs6KyoHAXZsC4aNkC5WYl RhDA== 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:from:date; bh=7solCuBZ9zuAixIWZmucasazw6eIQz5kORszjoWlf+0=; b=plx39nnxdFvBvAY0Ggz16q3pyj7NrjDUJAqFfcT63XvbZ7IutCizEqDgxQmy/SrcOU KMX2PesqQu9efZczBJ6LnzlZghY3sRrnXrQnVHhuEr58ZpujW1dNSWs0o/b4GfgnuPqO fARnK9dCVKdy75pYAEItXow3KQukLKXvvxcT2flfNO7VzSf4W65LhmC+JJ1/dhZwQC2l F/bEbQDXuUtdkKFUc1YlKDBZCtj8T6vkpFuHwiYYosXkyLiDG9/lUwS3SsV/z8jkAY+H j9OJ3p84ZYHwrusY+yE5BbTqHr3GQcx6geKRaXUKL1iztZxwZ3t039FjFDX+MR6KH891 CHJg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l72-20020a63914b000000b0053ef518d7ffsi2386774pge.303.2023.06.09.01.40.26; Fri, 09 Jun 2023 01:40:39 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240842AbjFII07 (ORCPT + 99 others); Fri, 9 Jun 2023 04:26:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241320AbjFIIZo (ORCPT ); Fri, 9 Jun 2023 04:25:44 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2E3F449E6; Fri, 9 Jun 2023 01:24:37 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 76E2DAB6; Fri, 9 Jun 2023 01:24:59 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.25.215]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A6E033F71E; Fri, 9 Jun 2023 01:24:12 -0700 (PDT) Date: Fri, 9 Jun 2023 09:24:10 +0100 From: Mark Rutland To: Andrii Nakryiko Cc: Steven Rostedt , Jiri Olsa , 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: 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=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,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: > 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. 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). Thanks, Mark.