From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, Joerg Roedel <joerg.roedel@amd.com>,
David Ahern <dsahern@gmail.com>, Jason Wang <jasowang@redhat.com>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 06/16] perf top: Don't process samples with no valid machine object
Date: Mon, 13 Feb 2012 23:52:45 -0200 [thread overview]
Message-ID: <1329184375-27911-7-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1329184375-27911-1-git-send-email-acme@infradead.org>
From: Joerg Roedel <joerg.roedel@amd.com>
The perf sample processing code relies on a valid machine object. Make
sure that this path is only entered when such a object exists.
A counter for samples where no machine object exits is also introduced
to give the user a message about these samples.
Reported-by: David Ahern <dsahern@gmail.com>
Reported-by: Jason Wang <jasowang@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1328893505-4115-2-git-send-email-joerg.roedel@amd.com
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-top.c | 6 ++++++
tools/perf/util/hist.h | 1 +
tools/perf/util/session.c | 10 ++++++++++
3 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 94d55cb..5a88c0d 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -677,6 +677,12 @@ static void perf_event__process_sample(struct perf_tool *tool,
return;
}
+ if (!machine) {
+ pr_err("%u unprocessable samples recorded.",
+ top->session->hists.stats.nr_unprocessable_samples++);
+ return;
+ }
+
if (event->header.misc & PERF_RECORD_MISC_EXACT_IP)
top->exact_samples++;
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 0d48613..48e5acd 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -32,6 +32,7 @@ struct events_stats {
u32 nr_unknown_events;
u32 nr_invalid_chains;
u32 nr_unknown_id;
+ u32 nr_unprocessable_samples;
};
enum hist_column {
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 552c1c5..9f833cf 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -796,6 +796,10 @@ static int perf_session_deliver_event(struct perf_session *session,
++session->hists.stats.nr_unknown_id;
return -1;
}
+ if (machine == NULL) {
+ ++session->hists.stats.nr_unprocessable_samples;
+ return -1;
+ }
return tool->sample(tool, event, sample, evsel, machine);
case PERF_RECORD_MMAP:
return tool->mmap(tool, event, sample, machine);
@@ -964,6 +968,12 @@ static void perf_session__warn_about_errors(const struct perf_session *session,
session->hists.stats.nr_invalid_chains,
session->hists.stats.nr_events[PERF_RECORD_SAMPLE]);
}
+
+ if (session->hists.stats.nr_unprocessable_samples != 0) {
+ ui__warning("%u unprocessable samples recorded.\n"
+ "Do you have a KVM guest running and not using 'perf kvm'?\n",
+ session->hists.stats.nr_unprocessable_samples);
+ }
}
#define session_done() (*(volatile int *)(&session_done))
--
1.7.9.123.g65da0
next prev parent reply other threads:[~2012-02-14 1:54 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-14 1:52 [GIT PULL 00/16] perf/core improvements and fixes Arnaldo Carvalho de Melo
2012-02-14 1:52 ` [PATCH 01/16] perf tools: fix endianness detection in perf.data Arnaldo Carvalho de Melo
2012-02-14 1:52 ` [PATCH 02/16] perf record: No build id option fails Arnaldo Carvalho de Melo
2012-02-14 1:52 ` [PATCH 03/16] perf tools: Fix build dependency of perf python extension Arnaldo Carvalho de Melo
2012-02-14 1:52 ` [PATCH 04/16] perf tools: Fix out of tree compiles Arnaldo Carvalho de Melo
2012-02-14 1:52 ` [PATCH 05/16] perf tools: Allow multiple threads or processes in record, stat, top Arnaldo Carvalho de Melo
2012-02-14 1:52 ` Arnaldo Carvalho de Melo [this message]
2012-02-14 1:52 ` [PATCH 07/16] perf tools: Change perf_guest default back to false Arnaldo Carvalho de Melo
2012-02-14 1:52 ` [PATCH 08/16] perf tools: Implement islower/isupper macro into util.h Arnaldo Carvalho de Melo
2012-02-14 1:52 ` [PATCH 09/16] perf tools: ctype.c only wants util.h Arnaldo Carvalho de Melo
2012-02-14 1:52 ` [PATCH 10/16] perf tools: Get rid of ctype.h in symbol.c Arnaldo Carvalho de Melo
2012-02-14 1:52 ` [PATCH 11/16] perf tools: Remove unused functions from debugfs object Arnaldo Carvalho de Melo
2012-02-14 1:52 ` [PATCH 12/16] perf tools: Add sysfs mountpoint interface Arnaldo Carvalho de Melo
2012-02-14 1:52 ` [PATCH 13/16] perf tools: Add bitmap_or function into bitmap object Arnaldo Carvalho de Melo
2012-02-14 1:52 ` [PATCH 14/16] perf tools: Moving code in header.c Arnaldo Carvalho de Melo
2012-02-14 1:52 ` [PATCH 15/16] perf tools: Factor out feature op to process header sections Arnaldo Carvalho de Melo
2012-02-14 1:52 ` [PATCH 16/16] perf tools: cleanup initialization of attr->size Arnaldo Carvalho de Melo
2012-02-14 2:50 ` [GIT PULL 00/16] perf/core improvements and fixes Namhyung Kim
2012-02-14 3:07 ` Namhyung Kim
2012-02-14 5:10 ` Namhyung Kim
2012-02-14 5:23 ` David Ahern
2012-02-14 5:48 ` Namhyung Kim
2012-02-14 5:52 ` David Ahern
2012-02-14 5:58 ` Namhyung Kim
2012-02-14 10:50 ` Joerg Roedel
2012-02-14 13:10 ` Arnaldo Carvalho de Melo
2012-02-14 14:38 ` Arnaldo Carvalho de Melo
2012-02-14 15:10 ` Joerg Roedel
2012-02-14 16:11 ` Arnaldo Carvalho de Melo
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=1329184375-27911-7-git-send-email-acme@infradead.org \
--to=acme@infradead.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=dsahern@gmail.com \
--cc=jasowang@redhat.com \
--cc=joerg.roedel@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®