All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>, Thomas Gleixner <tglx@linutronix.de>
Cc: Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Clark Williams <williams@redhat.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Ravi Bangoria <ravi.bangoria@linux.ibm.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Andi Kleen <ak@linux.intel.com>,
	Jin Yao <yao.jin@linux.intel.com>,
	Kan Liang <kan.liang@linux.intel.com>,
	Mark Rutland <mark.rutland@arm.com>
Subject: [PATCH 3/6] perf report: Bail out --mem-mode if mem info is not available
Date: Thu,  5 Dec 2019 16:32:21 -0300	[thread overview]
Message-ID: <20191205193224.24629-4-acme@kernel.org> (raw)
In-Reply-To: <20191205193224.24629-1-acme@kernel.org>

From: Ravi Bangoria <ravi.bangoria@linux.ibm.com>

If perf.data is recorded without -d, don't allow user to use --mem-mode
with 'perf report'. symbol_daddr and phys_daddr can be recorded
separately and may be present in the perf.data but at the report time
they are associated with mem-mode fields and thus this restriction
applies to them as well.

Before:
  $ perf record ls
  $ perf report --mem-mode --stdio
  # Overhead  Local Weight  Memory access  Symbol
  # ........  ............  .............  .......................
      55.56%  0             N/A            [k] 0xffffffff81a00ae7

After:
  $ perf report --mem-mode --stdio
  Error:
  Selected --mem-mode but no mem data. Did you call perf record without -d?

Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lore.kernel.org/lkml/20191114132213.5419-4-ravi.bangoria@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-report.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 830d563de889..387311c67264 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -388,6 +388,14 @@ static int report__setup_sample_type(struct report *rep)
 		}
 	}
 
+	if (sort__mode == SORT_MODE__MEMORY) {
+		if (!is_pipe && !(sample_type & PERF_SAMPLE_DATA_SRC)) {
+			ui__error("Selected --mem-mode but no mem data. "
+				  "Did you call perf record without -d?\n");
+			return -1;
+		}
+	}
+
 	if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain) {
 		if ((sample_type & PERF_SAMPLE_REGS_USER) &&
 		    (sample_type & PERF_SAMPLE_STACK_USER)) {
-- 
2.21.0


  parent reply	other threads:[~2019-12-05 19:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-05 19:32 [GIT PULL 0/6] perf/urgent fixes Arnaldo Carvalho de Melo
2019-12-05 19:32 ` [PATCH 1/6] perf report/top TUI: Replace pr_err() with ui__error() Arnaldo Carvalho de Melo
2019-12-05 19:32 ` [PATCH 2/6] perf report: Make -F more strict like -s Arnaldo Carvalho de Melo
2019-12-05 19:32 ` Arnaldo Carvalho de Melo [this message]
2019-12-05 19:32 ` [PATCH 4/6] perf inject: Fix processing of ID index for injected instruction tracing Arnaldo Carvalho de Melo
2019-12-05 19:32 ` [PATCH 5/6] tools headers UAPI: Sync drm/i915_drm.h with the kernel sources Arnaldo Carvalho de Melo
2019-12-05 19:32 ` [PATCH 6/6] tools headers UAPI: Update tools's copy of drm.h headers Arnaldo Carvalho de Melo
2019-12-06  7:57 ` [GIT PULL 0/6] perf/urgent fixes Ingo Molnar
2019-12-06 14:24   ` Arnaldo Carvalho de Melo
2019-12-06 14:25   ` Jiri Olsa
2019-12-06 14:43     ` Arnaldo Carvalho de Melo
2019-12-06 15:04       ` Jiri Olsa
2019-12-06 15:35         ` Arnaldo Carvalho de Melo
2020-01-12 19:22           ` [PATCH] perf tools: Use %define api.pure full instead of %pure-parser Jiri Olsa
2020-01-20  8:27             ` [tip: perf/core] " tip-bot2 for Jiri Olsa
2020-01-13  8:28 ` [GIT PULL 0/6] perf/urgent fixes Ravi Bangoria
2020-01-13  9:25   ` Jiri Olsa
2020-01-13  9:44     ` Ravi Bangoria

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191205193224.24629-4-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=ravi.bangoria@linux.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=williams@redhat.com \
    --cc=yao.jin@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.