linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: Clark Williams <williams@redhat.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Jiri Olsa <jolsa@redhat.com>, Jiri Olsa <jolsa@kernel.org>,
	Jin Yao <yao.jin@linux.intel.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 11/12] perf c2c: Keep struct hist_entry at the end of struct c2c_hist_entry
Date: Mon, 11 Jun 2018 14:48:09 -0300	[thread overview]
Message-ID: <20180611174810.14815-12-acme@kernel.org> (raw)
In-Reply-To: <20180611174810.14815-1-acme@kernel.org>

From: Jiri Olsa <jolsa@redhat.com>

Exactly as the comment just before 'struct c2c_hist_entry" says, i.e.
the last entry in struct hist_entry is a zero length array, that when
allocating space for hist_entry gets extra space if callchains are in
use, which, if hist_entry is not at the end of c2c_hist_entry, the
members after it gets corrupted when callchains get added to the rb
trees collecting them, etc.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jin Yao <yao.jin@linux.intel.com>
Fixes: 7f834c2e84bb ("perf c2c report: Display node for cacheline address")
Link: http://lkml.kernel.org/n/tip-bh0ke4fh2ygpj3yowna7o1di@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-c2c.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 307b3594525f..6a8738f7ead3 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -56,16 +56,16 @@ struct c2c_hist_entry {
 
 	struct compute_stats	 cstats;
 
+	unsigned long		 paddr;
+	unsigned long		 paddr_cnt;
+	bool			 paddr_zero;
+	char			*nodestr;
+
 	/*
 	 * must be at the end,
 	 * because of its callchain dynamic entry
 	 */
 	struct hist_entry	he;
-
-	unsigned long		 paddr;
-	unsigned long		 paddr_cnt;
-	bool			 paddr_zero;
-	char			*nodestr;
 };
 
 static char const *coalesce_default = "pid,iaddr";
-- 
2.14.3

  parent reply	other threads:[~2018-06-11 17:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-11 17:47 [GIT PULL 00/12] perf/urgent fixes and improvements Arnaldo Carvalho de Melo
2018-06-11 17:47 ` [PATCH 01/12] perf hists: Save the callchain_size in struct hist_entry Arnaldo Carvalho de Melo
2018-06-11 17:48 ` [PATCH 02/12] perf hists: Make hist_entry__has_callchains() work with 'perf c2c' Arnaldo Carvalho de Melo
2018-06-11 17:48 ` [PATCH 03/12] perf hists browser gtk: Use hist_entry__has_callchains() Arnaldo Carvalho de Melo
2018-06-11 17:48 ` [PATCH 04/12] perf hists: Reimplement hists__has_callchains() Arnaldo Carvalho de Melo
2018-06-11 17:48 ` [PATCH 05/12] perf tools: Fix error index for pmu event parser Arnaldo Carvalho de Melo
2018-06-11 17:48 ` [PATCH 06/12] perf stat: Add --interval-clear option Arnaldo Carvalho de Melo
2018-06-11 17:48 ` [PATCH 07/12] perf stat: Use only color_fprintf call in print_metric_only Arnaldo Carvalho de Melo
2018-06-11 17:48 ` [PATCH 08/12] perf stat: Fix metric column header display alignment Arnaldo Carvalho de Melo
2018-06-11 17:48 ` [PATCH 09/12] perf stat: Allow to specify specific metric column len Arnaldo Carvalho de Melo
2018-06-11 17:48 ` [PATCH 10/12] perf stat: Add event parsing error handling to add_default_attributes Arnaldo Carvalho de Melo
2018-06-11 17:48 ` Arnaldo Carvalho de Melo [this message]
2018-06-11 17:48 ` [PATCH 12/12] perf script: Show hw-cache events Arnaldo Carvalho de Melo
2018-06-14  6:13 ` [GIT PULL 00/12] perf/urgent fixes and improvements Ingo Molnar

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=20180611174810.14815-12-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=jolsa@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).