Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1224261pxu; Mon, 23 Nov 2020 15:10:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJz3kEtlHz2wufA7KK2THFOm3XDkRXig7qb9blcPoMoHZPvNqak4iXiyHZvDmz7qZ+W+dikw X-Received: by 2002:a17:906:e082:: with SMTP id gh2mr1739754ejb.406.1606173055035; Mon, 23 Nov 2020 15:10:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606173055; cv=none; d=google.com; s=arc-20160816; b=KLzuCFJKMm3044aiSyvIsPaQclpkLQfzYL2Zwu9prlq3Vtd5ZjYxq8yAEdC/O7JyTJ 2CqqFOMFJqj+ok15DckPo9G/74Pkzk3B0c6g0IldJf4yk18ri1P7fGjZN+Lv2aZhEfV8 1W6h/ZJXdDfFYEsDWpi38i7Qbs9/YvZb5k1rfujjGEMZ8M7gXuOp/dFXTGVF6ze5htFd t4kG9QZac/+/UM7fx3/gHECXKzda83Bt5KayjK/4KYa1e0sXT6+yeawRkjoEcK6n/W4Y KTC7nnEUOT2UVlooHIv7rT0E5TgEBpEbZoQrHKFocsChm/qijjOzEtvZRMyB60iV/WhK t29A== 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:date:subject:cc:to:from; bh=sT0QXhCsfJBkLXn5p+og4vXGodRWSExvsTJzTJJ2/GI=; b=Qnb46LZKU6lHdkAZmDnX8VZD2nRwnMDGkUVHxYGO82TJ41JGbOuy7czwBJsKNDdS1T wqz2j0BM2PCUdEmswF2Mx5OyWkSdBsP6rZu+NJBkrRBdExWNkxwf6Op90FOH0AEr08I9 i0LnNd7hZRtsKNoN6bGgdHpqIFrFvrZq4T1qnQfO+ipNV17SwKuaTI+BCCHwH+ZKiw6a uIBuHZkit8ubvxnsM0xTCMEma1eSqMGSFndxFYau8MX8zgQPedqTDqyeJu2aPUs3Jxru YYvtS9/kNha4OjQBJbu3g7SBktMocbWk2edM6RS8Sv5HYrm2v/u5lEgkeB22u6iuYVej JX0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr6si1458724ejc.319.2020.11.23.15.10.31; Mon, 23 Nov 2020 15:10:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388340AbgKWXHZ convert rfc822-to-8bit (ORCPT + 99 others); Mon, 23 Nov 2020 18:07:25 -0500 Received: from us-smtp-delivery-44.mimecast.com ([205.139.111.44]:47797 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387598AbgKWXGz (ORCPT ); Mon, 23 Nov 2020 18:06:55 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-464-avKAqA9xOSiZ6G0kiN7zSQ-1; Mon, 23 Nov 2020 18:06:46 -0500 X-MC-Unique: avKAqA9xOSiZ6G0kiN7zSQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F17A7802B6D; Mon, 23 Nov 2020 23:06:44 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.195.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF2A25D9CA; Mon, 23 Nov 2020 23:06:41 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Ian Rogers , lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Michael Petlan , Song Liu , Stephane Eranian , Alexey Budankov , Andi Kleen , Adrian Hunter Subject: [PATCH 23/25] perf buildid-cache: Add --debuginfod option Date: Tue, 24 Nov 2020 00:05:10 +0100 Message-Id: <20201123230512.2097312-24-jolsa@kernel.org> In-Reply-To: <20201123230512.2097312-1-jolsa@kernel.org> References: <20201123230512.2097312-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jolsa@kernel.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset=WINDOWS-1252 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding --debuginfod option to specify debuginfod url and support to do that through config file as well. Use following in ~/.perfconfig file: [buildid-cache] debuginfod=http://192.168.122.174:8002 Acked-by: Ian Rogers Signed-off-by: Jiri Olsa --- .../perf/Documentation/perf-buildid-cache.txt | 6 ++++ tools/perf/Documentation/perf-config.txt | 7 +++++ tools/perf/builtin-buildid-cache.c | 28 +++++++++++++++++-- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/tools/perf/Documentation/perf-buildid-cache.txt b/tools/perf/Documentation/perf-buildid-cache.txt index b77da5138bca..b9987d1399ca 100644 --- a/tools/perf/Documentation/perf-buildid-cache.txt +++ b/tools/perf/Documentation/perf-buildid-cache.txt @@ -84,6 +84,12 @@ OPTIONS used when creating a uprobe for a process that resides in a different mount namespace from the perf(1) utility. +--debuginfod=URLs:: + Specify debuginfod URL to be used when retrieving perf.data binaries, + it follows the same syntax as the DEBUGINFOD_URLS variable, like: + + buildid-cache.debuginfod=http://192.168.122.174:8002 + SEE ALSO -------- linkperf:perf-record[1], linkperf:perf-report[1], linkperf:perf-buildid-list[1] diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt index 31069d8a5304..e3672c5d801b 100644 --- a/tools/perf/Documentation/perf-config.txt +++ b/tools/perf/Documentation/perf-config.txt @@ -238,6 +238,13 @@ buildid.*:: cache location, or to disable it altogether. If you want to disable it, set buildid.dir to /dev/null. The default is $HOME/.debug +buildid-cache.*:: + buildid-cache.debuginfod=URLs + Specify debuginfod URLs to be used when retrieving perf.data binaries, + it follows the same syntax as the DEBUGINFOD_URLS variable, like: + + buildid-cache.debuginfod=http://192.168.122.174:8002 + annotate.*:: These are in control of addresses, jump function, source code in lines of assembly code from a specific program. diff --git a/tools/perf/builtin-buildid-cache.c b/tools/perf/builtin-buildid-cache.c index 0bfb54ee1e5e..fc03de7d2a28 100644 --- a/tools/perf/builtin-buildid-cache.c +++ b/tools/perf/builtin-buildid-cache.c @@ -27,6 +27,7 @@ #include "util/time-utils.h" #include "util/util.h" #include "util/probe-file.h" +#include "util/config.h" #include #include #include @@ -552,12 +553,21 @@ build_id_cache__add_perf_data(const char *path, bool all) return err; } +static int perf_buildid_cache_config(const char *var, const char *value, void *cb) +{ + const char **debuginfod = cb; + + if (!strcmp(var, "buildid-cache.debuginfod")) + *debuginfod = strdup(value); + + return 0; +} + int cmd_buildid_cache(int argc, const char **argv) { struct strlist *list; struct str_node *pos; - int ret = 0; - int ns_id = -1; + int ret, ns_id = -1; bool force = false; bool list_files = false; bool opts_flag = false; @@ -567,7 +577,8 @@ int cmd_buildid_cache(int argc, const char **argv) *purge_name_list_str = NULL, *missing_filename = NULL, *update_name_list_str = NULL, - *kcore_filename = NULL; + *kcore_filename = NULL, + *debuginfod = NULL; char sbuf[STRERR_BUFSIZE]; struct perf_data data = { @@ -592,6 +603,8 @@ int cmd_buildid_cache(int argc, const char **argv) OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), OPT_STRING('u', "update", &update_name_list_str, "file list", "file(s) to update"), + OPT_STRING(0, "debuginfod", &debuginfod, "debuginfod url", + "set debuginfod url"), OPT_INCR('v', "verbose", &verbose, "be more verbose"), OPT_INTEGER(0, "target-ns", &ns_id, "target pid for namespace context"), OPT_END() @@ -601,6 +614,10 @@ int cmd_buildid_cache(int argc, const char **argv) NULL }; + ret = perf_config(perf_buildid_cache_config, &debuginfod); + if (ret) + return ret; + argc = parse_options(argc, argv, buildid_cache_options, buildid_cache_usage, 0); @@ -612,6 +629,11 @@ int cmd_buildid_cache(int argc, const char **argv) if (argc || !(list_files || opts_flag)) usage_with_options(buildid_cache_usage, buildid_cache_options); + if (debuginfod) { + pr_debug("DEBUGINFOD_URLS=%s\n", debuginfod); + setenv("DEBUGINFOD_URLS", debuginfod, 1); + } + /* -l is exclusive. It can not be used with other options. */ if (list_files && opts_flag) { usage_with_options_msg(buildid_cache_usage, -- 2.26.2