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-0c5824498e8bd5b7d30dc03448cd89efaee4bead@git.kernel.org>
Date:   Thu, 12 Jan 2017 00:33:40 -0800
From:   tip-bot for Jiri Olsa <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     wangnan0@...wei.com, dsahern@...il.com, tglx@...utronix.de,
        linux-kernel@...r.kernel.org, mingo@...nel.org, acme@...hat.com,
        hpa@...or.com, namhyung@...nel.org, a.p.zijlstra@...llo.nl,
        jolsa@...nel.org
Subject: [tip:perf/core] perf record: Add switch-output size warning

Commit-ID:  0c5824498e8bd5b7d30dc03448cd89efaee4bead
Gitweb:     http://git.kernel.org/tip/0c5824498e8bd5b7d30dc03448cd89efaee4bead
Author:     Jiri Olsa <jolsa@...nel.org>
AuthorDate: Mon, 9 Jan 2017 10:51:59 +0100
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Wed, 11 Jan 2017 16:48:02 -0300

perf record: Add switch-output size warning

Adding switch-output size warning if the requested
size of lower than the wakeup ring buffer size.

  $ perf record --switch-output=1K ls
  WARNING: switch-output data size lower than wakeup kernel buffer size (258K) expect bigger perf.data sizes
  ...

Signed-off-by: Jiri Olsa <jolsa@...nel.org>
Suggested-and-Tested-by: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: David Ahern <dsahern@...il.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Wang Nan <wangnan0@...wei.com>
Link: http://lkml.kernel.org/r/1483955520-29063-6-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/builtin-record.c | 21 +++++++++++++++++++++
 tools/perf/util/evlist.c    |  2 +-
 tools/perf/util/evlist.h    |  2 ++
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 3fa6449..93319e1 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1377,6 +1377,23 @@ out_free:
 	return ret;
 }
 
+static void switch_output_size_warn(struct record *rec)
+{
+	u64 wakeup_size = perf_evlist__mmap_size(rec->opts.mmap_pages);
+	struct switch_output *s = &rec->switch_output;
+
+	wakeup_size /= 2;
+
+	if (s->size < wakeup_size) {
+		char buf[100];
+
+		unit_number__scnprintf(buf, sizeof(buf), wakeup_size);
+		pr_warning("WARNING: switch-output data size lower than "
+			   "wakeup kernel buffer size (%s) "
+			   "expect bigger perf.data sizes\n", buf);
+	}
+}
+
 static int switch_output_setup(struct record *rec)
 {
 	struct switch_output *s = &rec->switch_output;
@@ -1410,6 +1427,10 @@ static int switch_output_setup(struct record *rec)
 enabled:
 	rec->timestamp_filename = true;
 	s->enabled              = true;
+
+	if (s->size && !rec->opts.no_buffering)
+		switch_output_size_warn(rec);
+
 	return 0;
 }
 
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index dc4df3d..b601f28 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1184,7 +1184,7 @@ unsigned long perf_event_mlock_kb_in_pages(void)
 	return pages;
 }
 
-static size_t perf_evlist__mmap_size(unsigned long pages)
+size_t perf_evlist__mmap_size(unsigned long pages)
 {
 	if (pages == UINT_MAX)
 		pages = perf_event_mlock_kb_in_pages();
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 4fd034f..389b9cc 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -218,6 +218,8 @@ int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages,
 		      bool overwrite);
 void perf_evlist__munmap(struct perf_evlist *evlist);
 
+size_t perf_evlist__mmap_size(unsigned long pages);
+
 void perf_evlist__disable(struct perf_evlist *evlist);
 void perf_evlist__enable(struct perf_evlist *evlist);
 void perf_evlist__toggle_enable(struct perf_evlist *evlist);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ