mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joerg Roedel <joerg.roedel@amd.com>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	Ingo Molnar <mingo@elte.hu>, Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: <linux-kernel@vger.kernel.org>, David Ahern <dsahern@gmail.com>,
	Jason Wang <jasowang@redhat.com>,
	Joerg Roedel <joerg.roedel@amd.com>
Subject: [PATCH 1/2] perf-tool: Don't process samples with no valid machine object
Date: Thu, 9 Feb 2012 17:07:38 +0100	[thread overview]
Message-ID: <1328803659-30449-2-git-send-email-joerg.roedel@amd.com> (raw)
In-Reply-To: <1328803659-30449-1-git-send-email-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.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 tools/perf/builtin-top.c  |    2 +-
 tools/perf/util/session.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index dd162aa..7c81d1d 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -805,7 +805,7 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx)
 		}
 
 
-		if (event->header.type == PERF_RECORD_SAMPLE) {
+		if (event->header.type == PERF_RECORD_SAMPLE && machine != NULL) {
 			perf_event__process_sample(&top->tool, event, evsel,
 						   &sample, machine);
 		} else if (event->header.type < PERF_RECORD_MAX) {
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index b5ca2558..c9593c7 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -792,7 +792,7 @@ static int perf_session_deliver_event(struct perf_session *session,
 	switch (event->header.type) {
 	case PERF_RECORD_SAMPLE:
 		dump_sample(session, event, sample);
-		if (evsel == NULL) {
+		if (evsel == NULL || machine == NULL) {
 			++session->hists.stats.nr_unknown_id;
 			return -1;
 		}
-- 
1.7.5.4



  reply	other threads:[~2012-02-09 16:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-09 16:07 [PATCH 0/2] Fix perf-tool crashes when kvm guest is running Joerg Roedel
2012-02-09 16:07 ` Joerg Roedel [this message]
2012-02-09 16:34   ` [PATCH 1/2] perf-tool: Don't process samples with no valid machine object Arnaldo Carvalho de Melo
2012-02-09 17:13     ` Joerg Roedel
2012-02-10 13:31       ` Arnaldo Carvalho de Melo
2012-02-09 16:07 ` [PATCH 2/2] perf-tool: Change perf_guest default back to false Joerg Roedel
2012-02-10 17:05 [PATCH 0/2 v2] Fix perf-tool crashes when kvm guest is running Joerg Roedel
2012-02-10 17:05 ` [PATCH 1/2] perf-tool: Don't process samples with no valid machine object Joerg Roedel

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=1328803659-30449-2-git-send-email-joerg.roedel@amd.com \
    --to=joerg.roedel@amd.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=dsahern@gmail.com \
    --cc=jasowang@redhat.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

Powered by JetHome