Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3536949pxb; Mon, 9 Nov 2020 14:00:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwm9p33B7WnEQmRGhQMJS/pQCUcJDPILeEbOJiQvPDAsgCyxjx9g/w7RJCbDuaxRU4pVCH7 X-Received: by 2002:a05:6402:a46:: with SMTP id bt6mr18129953edb.101.1604959220325; Mon, 09 Nov 2020 14:00:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604959220; cv=none; d=google.com; s=arc-20160816; b=gTAV/VaVrVVOuPK8xB2SVTU9EsLnQ1ah8BBtN71L6pOod0jshL90j7bUVcXi4gVozb 0EE/3OLevKVfLNQkVpONAyw2o783ywkcORpV/Q5mwz0UfcXyJffUbP2/MQ6Vla7MmI9y KfNkp+RB5gzWwW8PetlV0a7CDubha/D2QFY/YUHvtnAbQBtr5bPXvo6FTtbmZm0VZbBI kfTgy5araphUA0uAkTqK4lfIEgk805tDfaOCmbK4rj9rG7lZ16/xbuiGAhKA18w44s1w 0/naWNA8o6f2Gu0ItiIGvQ0jLOB3GUj1S4Va28UBwWN/LcWh9BvCMaQ4MVnibHeV7FA1 4KZQ== 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=8DoSxf8R1Q0L5OanejfLsgBhztIU0n5nshhaopPFcxo=; b=CZlwOzc+vJah3/yUOkN+65cAlSUZmK998WltrwjO2LCHdj9g6cXwGvDL/3GYmwgCEv IFVBYDkA67nq6UsD6RCSGIqzuUZPnRHAeEGoOXKKzvxW6YWBdEHhuYMpwDpvibi1lkuG LPcwo5rYe47mlRzc1hTbfv5eWicaOQX5S86DxuVDeCzjbnm3+ZZ4B1yNjeWutxmSBJY3 gjbCbBkL1n3b3GOjsAGQnQdQjfQ0/gprnv/Bd0cOecWkoS9hzgRauUeoKmSlgbhxTnpX UrK78K4QFXk4j4bgr/90CUBKFpnfGd1vn+cYU1ZgAn6VFWbiuqsbbU70Jf2HbDsZYtkx qoHw== 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 e4si8291260edr.585.2020.11.09.13.59.57; Mon, 09 Nov 2020 14:00:20 -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 S1731921AbgKIVzy convert rfc822-to-8bit (ORCPT + 99 others); Mon, 9 Nov 2020 16:55:54 -0500 Received: from us-smtp-delivery-44.mimecast.com ([205.139.111.44]:29003 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731702AbgKIVzu (ORCPT ); Mon, 9 Nov 2020 16:55:50 -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-228-EPbHPB3XNWK7uU4EEL3rvg-1; Mon, 09 Nov 2020 16:55:43 -0500 X-MC-Unique: EPbHPB3XNWK7uU4EEL3rvg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3FD7F802B6C; Mon, 9 Nov 2020 21:55:41 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 18CB06EF46; Mon, 9 Nov 2020 21:55:37 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Michael Petlan , Song Liu , Ian Rogers , Stephane Eranian , Alexey Budankov , Andi Kleen , Adrian Hunter Subject: [PATCH 22/24] perf buildid-cache: Add --debuginfod option Date: Mon, 9 Nov 2020 22:54:13 +0100 Message-Id: <20201109215415.400153-23-jolsa@kernel.org> In-Reply-To: <20201109215415.400153-1-jolsa@kernel.org> References: <20201109215415.400153-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 Signed-off-by: Jiri Olsa --- .../perf/Documentation/perf-buildid-cache.txt | 4 +++ tools/perf/builtin-buildid-cache.c | 28 +++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/tools/perf/Documentation/perf-buildid-cache.txt b/tools/perf/Documentation/perf-buildid-cache.txt index b77da5138bca..0152d8b5cfbe 100644 --- a/tools/perf/Documentation/perf-buildid-cache.txt +++ b/tools/perf/Documentation/perf-buildid-cache.txt @@ -84,6 +84,10 @@ OPTIONS used when creating a uprobe for a process that resides in a different mount namespace from the perf(1) utility. +--debuginfod=URL:: + Specify debuginfod URL to be used when retrieving perf.data binaries, + it follows the same syntax as the DEBUGINFOD_URLS variable. + SEE ALSO -------- linkperf:perf-record[1], linkperf:perf-report[1], linkperf:perf-buildid-list[1] diff --git a/tools/perf/builtin-buildid-cache.c b/tools/perf/builtin-buildid-cache.c index e4a42aa2b497..59cb5fb85109 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 @@ -545,12 +546,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; @@ -560,7 +570,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 = { @@ -585,6 +596,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() @@ -594,6 +607,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); @@ -605,6 +622,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