lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-c4ac732a0377d1544a8385393a9877b693ff0652@git.kernel.org>
Date:	Thu, 2 Apr 2015 22:09:14 -0700
From:	tip-bot for Yunlong Song <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	yunlong.song@...wei.com, wangnan0@...wei.com,
	linux-kernel@...r.kernel.org, hpa@...or.com, acme@...hat.com,
	paulus@...ba.org, mingo@...nel.org, a.p.zijlstra@...llo.nl,
	tglx@...utronix.de
Subject: [tip:perf/core] perf lock:
  Support using -f to override perf.data file ownership

Commit-ID:  c4ac732a0377d1544a8385393a9877b693ff0652
Gitweb:     http://git.kernel.org/tip/c4ac732a0377d1544a8385393a9877b693ff0652
Author:     Yunlong Song <yunlong.song@...wei.com>
AuthorDate: Thu, 2 Apr 2015 21:47:14 +0800
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Thu, 2 Apr 2015 13:18:48 -0300

perf lock: Support using -f to override perf.data file ownership

Enable perf lock to use perf.data when it is not owned by current user
or root.

Example:

 # perf lock record ls
 # chown Yunlong.Song:Yunlong.Song perf.data
 # ls -al perf.data
 -rw------- 1 Yunlong.Song Yunlong.Song 4880686 Apr  2 14:14 perf.data
 # id
 uid=0(root) gid=0(root) groups=0(root),64(pkcs11)

Before this patch:

 # perf lock report
 File perf.data not owned by current user or root (use -f to override)
 Initializing perf session failed
 # perf lock report -f
   Error: unknown switch `f'

  usage: perf lock report [<options>]

     -k, --key <acquired>  key for sorting (acquired / contended /
     avg_wait / wait_total / wait_max / wait_min)

As shown above, the -f option does not work at all.

After this patch:

 # perf lock report
 File perf.data not owned by current user or root (use -f to override)
 Initializing perf session failed
 # perf lock report -f
                Name   acquired  contended   avg wait (ns) total wait (ns) ...

 &ldata->output_l...        128          0               0               0 ...
          &ctx->lock        114          0               0               0 ...
         &p->pi_lock        112          0               0               0 ...
 &(&pool->lock)->...        112          0               0               0 ...
 &(&dentry->d_loc...         70          0               0               0 ...
 &(&newf->file_lo...         62          0               0               0 ...
 &(&fs->lock)->rl...         43          0               0               0 ...
 ...

As shown above, the -f option really works now.

Signed-off-by: Yunlong Song <yunlong.song@...wei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Wang Nan <wangnan0@...wei.com>
Link: http://lkml.kernel.org/r/1427982439-27388-6-git-send-email-yunlong.song@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/builtin-lock.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index 7893a9b..d49c2ab 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -846,6 +846,8 @@ static const struct perf_evsel_str_handler lock_tracepoints[] = {
 	{ "lock:lock_release",	 perf_evsel__process_lock_release,   }, /* CONFIG_LOCKDEP */
 };
 
+static bool force;
+
 static int __cmd_report(bool display_info)
 {
 	int err = -EINVAL;
@@ -857,6 +859,7 @@ static int __cmd_report(bool display_info)
 	struct perf_data_file file = {
 		.path = input_name,
 		.mode = PERF_DATA_MODE_READ,
+		.force = force,
 	};
 
 	session = perf_session__new(&file, false, &eops);
@@ -945,6 +948,7 @@ int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused)
 		    "dump thread list in perf.data"),
 	OPT_BOOLEAN('m', "map", &info_map,
 		    "map of lock instances (address:name table)"),
+	OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
 	OPT_END()
 	};
 	const struct option lock_options[] = {
@@ -956,6 +960,7 @@ int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused)
 	const struct option report_options[] = {
 	OPT_STRING('k', "key", &sort_key, "acquired",
 		    "key for sorting (acquired / contended / avg_wait / wait_total / wait_max / wait_min)"),
+	OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
 	/* TODO: type */
 	OPT_END()
 	};
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ