Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752838AbbDCFIp (ORCPT ); Fri, 3 Apr 2015 01:08:45 -0400 Received: from terminus.zytor.com ([198.137.202.10]:43008 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750922AbbDCFIl (ORCPT ); Fri, 3 Apr 2015 01:08:41 -0400 Date: Thu, 2 Apr 2015 22:08:23 -0700 From: tip-bot for Yunlong Song Message-ID: Cc: acme@redhat.com, hpa@zytor.com, tglx@linutronix.de, mingo@kernel.org, paulus@samba.org, yunlong.song@huawei.com, linux-kernel@vger.kernel.org, wangnan0@huawei.com, a.p.zijlstra@chello.nl Reply-To: tglx@linutronix.de, mingo@kernel.org, paulus@samba.org, acme@redhat.com, hpa@zytor.com, wangnan0@huawei.com, a.p.zijlstra@chello.nl, linux-kernel@vger.kernel.org, yunlong.song@huawei.com In-Reply-To: <1427982439-27388-3-git-send-email-yunlong.song@huawei.com> References: <1427982439-27388-3-git-send-email-yunlong.song@huawei.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf inject: Support using -f to override perf.data file ownership Git-Commit-ID: ccaa474c8a0983d26ecb3eac755672b546b997c3 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3137 Lines: 83 Commit-ID: ccaa474c8a0983d26ecb3eac755672b546b997c3 Gitweb: http://git.kernel.org/tip/ccaa474c8a0983d26ecb3eac755672b546b997c3 Author: Yunlong Song AuthorDate: Thu, 2 Apr 2015 21:47:11 +0800 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 2 Apr 2015 13:18:45 -0300 perf inject: Support using -f to override perf.data file ownership Enable perf inject to use perf.data when it is not owned by current user or root. Example: # perf record ls # chown Yunlong.Song:Yunlong.Song perf.data # ls -al perf.data -rw------- 1 Yunlong.Song Yunlong.Song 28260 Apr 2 10:37 perf.data # id uid=0(root) gid=0(root) groups=0(root),64(pkcs11) Before this patch: # perf inject -v -b -i perf.data -o perf.data.new File perf.data not owned by current user or root (use -f to override) # perf inject -v -b -i perf.data -o perf.data.new -f Error: unknown switch `f' usage: perf inject [] -b, --build-ids Inject build-ids into the output stream -i, --input input file name -o, --output output file name -s, --sched-stat Merge sched-stat and sched-switch for getting events where and how long tasks slept -v, --verbose be more verbose (show build ids, etc) --kallsyms kallsyms pathname As shown above, the -f option does not work at all. After this patch: # perf inject -v -b -i perf.data -o perf.data.new File perf.data not owned by current user or root (use -f to override) # perf inject -v -b -i perf.data -o perf.data.new -f build id event received for [kernel.kallsyms]: f6dcb66d8b98f1c0d9eb87bf043444b69f91d30c symsrc__init: cannot get elf header. Looking at the vmlinux_path (7 entries long) Using /proc/kcore for kernel object code Using /proc/kallsyms for symbols As shown above, the -f option really works now. Signed-off-by: Yunlong Song Tested-by: Arnaldo Carvalho de Melo Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Wang Nan Link: http://lkml.kernel.org/r/1427982439-27388-3-git-send-email-yunlong.song@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-inject.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index ea46df25..40a33d7 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c @@ -443,6 +443,7 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused) "be more verbose (show build ids, etc)"), OPT_STRING(0, "kallsyms", &symbol_conf.kallsyms_name, "file", "kallsyms pathname"), + OPT_BOOLEAN('f', "force", &file.force, "don't complain, do it"), OPT_END() }; const char * const inject_usage[] = { -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/