linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] perf tools: Various fixes
@ 2015-12-17 20:26 Jiri Olsa
  2015-12-17 20:26 ` [PATCH 1/6] perf tools: Remove perf_evlist__(enable|disable)_event functions Jiri Olsa
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Jiri Olsa @ 2015-12-17 20:26 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra,
	Noel Grandin

hi,
sending several changes together:
  - leftover for the stat enable/disable changes with Adrian's patch
  - fixes for issues Noel found with DWARF unwind

Noel, could you please rerun your test on this?

Also available in:
  git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
  perf/fixes

thanks,
jirka


---
Adrian Hunter (1):
      perf tools: Make perf_evlist__open() open evsels with their cpus and threads (like perf record does)

Jiri Olsa (5):
      perf tools: Remove perf_evlist__(enable|disable)_event functions
      perf tools: Use find_map function in access_dso_mem
      perf tools libunwind: Check for mmaps also in MAP__VARIABLE tree
      perf tools libdw: Check for mmaps also in MAP__VARIABLE tree
      perf record: Always store data mmaps

 tools/perf/arch/x86/util/intel-bts.c  |  4 ++--
 tools/perf/arch/x86/util/intel-pt.c   |  4 ++--
 tools/perf/builtin-kvm.c              |  2 +-
 tools/perf/builtin-record.c           |  2 +-
 tools/perf/builtin-top.c              |  2 +-
 tools/perf/builtin-trace.c            |  2 +-
 tools/perf/tests/code-reading.c       |  2 +-
 tools/perf/tests/dwarf-unwind.c       |  2 +-
 tools/perf/tests/keep-tracking.c      |  2 +-
 tools/perf/tests/mmap-thread-lookup.c |  4 ++--
 tools/perf/tests/switch-tracking.c    |  6 +++---
 tools/perf/util/event.c               | 16 ++++++----------
 tools/perf/util/event.h               |  5 ++---
 tools/perf/util/evlist.c              | 44 +-------------------------------------------
 tools/perf/util/evlist.h              |  4 ----
 tools/perf/util/machine.c             |  6 +++---
 tools/perf/util/machine.h             |  6 +++---
 tools/perf/util/unwind-libdw.c        | 10 ++++++++++
 tools/perf/util/unwind-libunwind.c    | 20 ++++++++++++++------
 19 files changed, 55 insertions(+), 88 deletions(-)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/6] perf tools: Remove perf_evlist__(enable|disable)_event functions
  2015-12-17 20:26 [PATCH 0/6] perf tools: Various fixes Jiri Olsa
@ 2015-12-17 20:26 ` Jiri Olsa
  2015-12-17 20:26 ` [PATCH 2/6] perf tools: Make perf_evlist__open() open evsels with their cpus and threads (like perf record does) Jiri Olsa
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Jiri Olsa @ 2015-12-17 20:26 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra,
	Noel Grandin

Replacing them with perf_evsel__(enable|disable).

Link: http://lkml.kernel.org/n/tip-bbyjpha9wc4ifn0ebfkm0mnl@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/arch/x86/util/intel-bts.c |  4 ++--
 tools/perf/arch/x86/util/intel-pt.c  |  4 ++--
 tools/perf/tests/keep-tracking.c     |  2 +-
 tools/perf/tests/switch-tracking.c   |  6 +++---
 tools/perf/util/evlist.c             | 42 ------------------------------------
 tools/perf/util/evlist.h             |  4 ----
 6 files changed, 8 insertions(+), 54 deletions(-)

diff --git a/tools/perf/arch/x86/util/intel-bts.c b/tools/perf/arch/x86/util/intel-bts.c
index 9b94ce520917..8d8150f1cf9b 100644
--- a/tools/perf/arch/x86/util/intel-bts.c
+++ b/tools/perf/arch/x86/util/intel-bts.c
@@ -327,7 +327,7 @@ static int intel_bts_snapshot_start(struct auxtrace_record *itr)
 
 	evlist__for_each(btsr->evlist, evsel) {
 		if (evsel->attr.type == btsr->intel_bts_pmu->type)
-			return perf_evlist__disable_event(btsr->evlist, evsel);
+			return perf_evsel__disable(evsel);
 	}
 	return -EINVAL;
 }
@@ -340,7 +340,7 @@ static int intel_bts_snapshot_finish(struct auxtrace_record *itr)
 
 	evlist__for_each(btsr->evlist, evsel) {
 		if (evsel->attr.type == btsr->intel_bts_pmu->type)
-			return perf_evlist__enable_event(btsr->evlist, evsel);
+			return perf_evsel__enable(evsel);
 	}
 	return -EINVAL;
 }
diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
index b64d46285ebb..f05daacc9e78 100644
--- a/tools/perf/arch/x86/util/intel-pt.c
+++ b/tools/perf/arch/x86/util/intel-pt.c
@@ -725,7 +725,7 @@ static int intel_pt_snapshot_start(struct auxtrace_record *itr)
 
 	evlist__for_each(ptr->evlist, evsel) {
 		if (evsel->attr.type == ptr->intel_pt_pmu->type)
-			return perf_evlist__disable_event(ptr->evlist, evsel);
+			return perf_evsel__disable(evsel);
 	}
 	return -EINVAL;
 }
@@ -738,7 +738,7 @@ static int intel_pt_snapshot_finish(struct auxtrace_record *itr)
 
 	evlist__for_each(ptr->evlist, evsel) {
 		if (evsel->attr.type == ptr->intel_pt_pmu->type)
-			return perf_evlist__enable_event(ptr->evlist, evsel);
+			return perf_evsel__enable(evsel);
 	}
 	return -EINVAL;
 }
diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c
index a337a6da1f39..7b27943ecfef 100644
--- a/tools/perf/tests/keep-tracking.c
+++ b/tools/perf/tests/keep-tracking.c
@@ -124,7 +124,7 @@ int test__keep_tracking(int subtest __maybe_unused)
 
 	evsel = perf_evlist__last(evlist);
 
-	CHECK__(perf_evlist__disable_event(evlist, evsel));
+	CHECK__(perf_evsel__disable(evsel));
 
 	comm = "Test COMM 2";
 	CHECK__(prctl(PR_SET_NAME, (unsigned long)comm, 0, 0, 0));
diff --git a/tools/perf/tests/switch-tracking.c b/tools/perf/tests/switch-tracking.c
index dfbd8d69ce89..ebd80168d51e 100644
--- a/tools/perf/tests/switch-tracking.c
+++ b/tools/perf/tests/switch-tracking.c
@@ -455,7 +455,7 @@ int test__switch_tracking(int subtest __maybe_unused)
 
 	perf_evlist__enable(evlist);
 
-	err = perf_evlist__disable_event(evlist, cpu_clocks_evsel);
+	err = perf_evsel__disable(cpu_clocks_evsel);
 	if (err) {
 		pr_debug("perf_evlist__disable_event failed!\n");
 		goto out_err;
@@ -474,7 +474,7 @@ int test__switch_tracking(int subtest __maybe_unused)
 		goto out_err;
 	}
 
-	err = perf_evlist__disable_event(evlist, cycles_evsel);
+	err = perf_evsel__disable(cycles_evsel);
 	if (err) {
 		pr_debug("perf_evlist__disable_event failed!\n");
 		goto out_err;
@@ -500,7 +500,7 @@ int test__switch_tracking(int subtest __maybe_unused)
 		goto out_err;
 	}
 
-	err = perf_evlist__enable_event(evlist, cycles_evsel);
+	err = perf_evsel__enable(cycles_evsel);
 	if (err) {
 		pr_debug("perf_evlist__disable_event failed!\n");
 		goto out_err;
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index b9eac0daa0b9..05efa910a090 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -365,48 +365,6 @@ void perf_evlist__toggle_enable(struct perf_evlist *evlist)
 	(evlist->enabled ? perf_evlist__disable : perf_evlist__enable)(evlist);
 }
 
-int perf_evlist__disable_event(struct perf_evlist *evlist,
-			       struct perf_evsel *evsel)
-{
-	int cpu, thread, err;
-	int nr_cpus = cpu_map__nr(evlist->cpus);
-	int nr_threads = perf_evlist__nr_threads(evlist, evsel);
-
-	if (!evsel->fd)
-		return 0;
-
-	for (cpu = 0; cpu < nr_cpus; cpu++) {
-		for (thread = 0; thread < nr_threads; thread++) {
-			err = ioctl(FD(evsel, cpu, thread),
-				    PERF_EVENT_IOC_DISABLE, 0);
-			if (err)
-				return err;
-		}
-	}
-	return 0;
-}
-
-int perf_evlist__enable_event(struct perf_evlist *evlist,
-			      struct perf_evsel *evsel)
-{
-	int cpu, thread, err;
-	int nr_cpus = cpu_map__nr(evlist->cpus);
-	int nr_threads = perf_evlist__nr_threads(evlist, evsel);
-
-	if (!evsel->fd)
-		return -EINVAL;
-
-	for (cpu = 0; cpu < nr_cpus; cpu++) {
-		for (thread = 0; thread < nr_threads; thread++) {
-			err = ioctl(FD(evsel, cpu, thread),
-				    PERF_EVENT_IOC_ENABLE, 0);
-			if (err)
-				return err;
-		}
-	}
-	return 0;
-}
-
 static int perf_evlist__enable_event_cpu(struct perf_evlist *evlist,
 					 struct perf_evsel *evsel, int cpu)
 {
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 139a50038097..25c6c824d870 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -152,10 +152,6 @@ 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);
 
-int perf_evlist__disable_event(struct perf_evlist *evlist,
-			       struct perf_evsel *evsel);
-int perf_evlist__enable_event(struct perf_evlist *evlist,
-			      struct perf_evsel *evsel);
 int perf_evlist__enable_event_idx(struct perf_evlist *evlist,
 				  struct perf_evsel *evsel, int idx);
 
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/6] perf tools: Make perf_evlist__open() open evsels with their cpus and threads (like perf record does)
  2015-12-17 20:26 [PATCH 0/6] perf tools: Various fixes Jiri Olsa
  2015-12-17 20:26 ` [PATCH 1/6] perf tools: Remove perf_evlist__(enable|disable)_event functions Jiri Olsa
@ 2015-12-17 20:26 ` Jiri Olsa
  2015-12-17 20:26 ` [PATCH 3/6] perf tools: Use find_map function in access_dso_mem Jiri Olsa
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Jiri Olsa @ 2015-12-17 20:26 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra,
	Noel Grandin

From: Adrian Hunter <adrian.hunter@intel.com>

'perf record' uses perf_evsel__open() to open events and passes the evsel->cpus
and evsel->threads.  Many tests and some tools instead use perf_evlist__open()
which passes instead evlist->cpus and evlist->threads.

Make perf_evlist__open() follow the 'perf record' behaviour so that a consistent
approach is taken.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 tools/perf/util/evlist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 05efa910a090..43f4c400a171 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1428,7 +1428,7 @@ int perf_evlist__open(struct perf_evlist *evlist)
 	perf_evlist__update_id_pos(evlist);
 
 	evlist__for_each(evlist, evsel) {
-		err = perf_evsel__open(evsel, evlist->cpus, evlist->threads);
+		err = perf_evsel__open(evsel, evsel->cpus, evsel->threads);
 		if (err < 0)
 			goto out_err;
 	}
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/6] perf tools: Use find_map function in access_dso_mem
  2015-12-17 20:26 [PATCH 0/6] perf tools: Various fixes Jiri Olsa
  2015-12-17 20:26 ` [PATCH 1/6] perf tools: Remove perf_evlist__(enable|disable)_event functions Jiri Olsa
  2015-12-17 20:26 ` [PATCH 2/6] perf tools: Make perf_evlist__open() open evsels with their cpus and threads (like perf record does) Jiri Olsa
@ 2015-12-17 20:26 ` Jiri Olsa
  2015-12-17 20:26 ` [PATCH 4/6] perf tools libunwind: Check for mmaps also in MAP__VARIABLE tree Jiri Olsa
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Jiri Olsa @ 2015-12-17 20:26 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra,
	Noel Grandin

The find_map helper is already there, so let's use it.

Also we're going to introduce wider search in following
patch, so it'll be easier to make this change on single
place.

Link: http://lkml.kernel.org/n/tip-9grtz49b9i4ysfzmuf9z5txj@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/unwind-libunwind.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
index 3c258a0e4092..f37859c04317 100644
--- a/tools/perf/util/unwind-libunwind.c
+++ b/tools/perf/util/unwind-libunwind.c
@@ -416,20 +416,19 @@ get_proc_name(unw_addr_space_t __maybe_unused as,
 static int access_dso_mem(struct unwind_info *ui, unw_word_t addr,
 			  unw_word_t *data)
 {
-	struct addr_location al;
+	struct map *map;
 	ssize_t size;
 
-	thread__find_addr_map(ui->thread, PERF_RECORD_MISC_USER,
-			      MAP__FUNCTION, addr, &al);
-	if (!al.map) {
+	map = find_map(addr, ui);
+	if (!map) {
 		pr_debug("unwind: no map for %lx\n", (unsigned long)addr);
 		return -1;
 	}
 
-	if (!al.map->dso)
+	if (!map->dso)
 		return -1;
 
-	size = dso__data_read_addr(al.map->dso, al.map, ui->machine,
+	size = dso__data_read_addr(map->dso, map, ui->machine,
 				   addr, (u8 *) data, sizeof(*data));
 
 	return !(size == sizeof(*data));
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/6] perf tools libunwind: Check for mmaps also in MAP__VARIABLE tree
  2015-12-17 20:26 [PATCH 0/6] perf tools: Various fixes Jiri Olsa
                   ` (2 preceding siblings ...)
  2015-12-17 20:26 ` [PATCH 3/6] perf tools: Use find_map function in access_dso_mem Jiri Olsa
@ 2015-12-17 20:26 ` Jiri Olsa
  2015-12-17 20:26 ` [PATCH 5/6] perf tools libdw: " Jiri Olsa
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Jiri Olsa @ 2015-12-17 20:26 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra,
	Noel Grandin

We've seen cases (softice) where DWARF unwinder went
through non executable mmaps, which we need to lookup
in MAP__VARIABLE tree.

Reported-by: Noel Grandin <noelgrandin@gmail.com>
Link: http://lkml.kernel.org/n/tip-@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/unwind-libunwind.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
index f37859c04317..ee7e372297e5 100644
--- a/tools/perf/util/unwind-libunwind.c
+++ b/tools/perf/util/unwind-libunwind.c
@@ -319,6 +319,15 @@ static struct map *find_map(unw_word_t ip, struct unwind_info *ui)
 
 	thread__find_addr_map(ui->thread, PERF_RECORD_MISC_USER,
 			      MAP__FUNCTION, ip, &al);
+	if (!al.map) {
+		/*
+		 * We've seen cases (softice) where DWARF unwinder went
+		 * through non executable mmaps, which we need to lookup
+		 * in MAP__VARIABLE tree.
+		 */
+		thread__find_addr_map(ui->thread, PERF_RECORD_MISC_USER,
+				      MAP__VARIABLE, ip, &al);
+	}
 	return al.map;
 }
 
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/6] perf tools libdw: Check for mmaps also in MAP__VARIABLE tree
  2015-12-17 20:26 [PATCH 0/6] perf tools: Various fixes Jiri Olsa
                   ` (3 preceding siblings ...)
  2015-12-17 20:26 ` [PATCH 4/6] perf tools libunwind: Check for mmaps also in MAP__VARIABLE tree Jiri Olsa
@ 2015-12-17 20:26 ` Jiri Olsa
  2015-12-17 20:26 ` [PATCH 6/6] perf record: Always store data mmaps Jiri Olsa
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Jiri Olsa @ 2015-12-17 20:26 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra,
	Noel Grandin

We've seen cases (softice) where DWARF unwinder went
through non executable mmaps, which we need to lookup
in MAP__VARIABLE tree.

Reported-by: Noel Grandin <noelgrandin@gmail.com>
Link: http://lkml.kernel.org/n/tip-pd37evgxxggiu5sfomog8gtw@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/unwind-libdw.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c
index db8142ba7cb9..cf5e250bc78e 100644
--- a/tools/perf/util/unwind-libdw.c
+++ b/tools/perf/util/unwind-libdw.c
@@ -96,6 +96,16 @@ static int access_dso_mem(struct unwind_info *ui, Dwarf_Addr addr,
 	thread__find_addr_map(ui->thread, PERF_RECORD_MISC_USER,
 			      MAP__FUNCTION, addr, &al);
 	if (!al.map) {
+		/*
+		 * We've seen cases (softice) where DWARF unwinder went
+		 * through non executable mmaps, which we need to lookup
+		 * in MAP__VARIABLE tree.
+		 */
+		thread__find_addr_map(ui->thread, PERF_RECORD_MISC_USER,
+				      MAP__VARIABLE, addr, &al);
+	}
+
+	if (!al.map) {
 		pr_debug("unwind: no map for %lx\n", (unsigned long)addr);
 		return -1;
 	}
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 6/6] perf record: Always store data mmaps
  2015-12-17 20:26 [PATCH 0/6] perf tools: Various fixes Jiri Olsa
                   ` (4 preceding siblings ...)
  2015-12-17 20:26 ` [PATCH 5/6] perf tools libdw: " Jiri Olsa
@ 2015-12-17 20:26 ` Jiri Olsa
  2016-01-05 11:16   ` Namhyung Kim
  2015-12-17 20:49 ` [PATCH 0/6] perf tools: Various fixes Jiri Olsa
  2015-12-18  9:06 ` Noel Grandin
  7 siblings, 1 reply; 13+ messages in thread
From: Jiri Olsa @ 2015-12-17 20:26 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra,
	Noel Grandin

Currently we don't synthesize data mmap by default. It depends
on -d option, that enables data address sampling.

But we've seen cases (softice) where DWARF unwinder went through
non executable mmaps, which we need to lookup in MAP__VARIABLE tree.

Given the discussion we had with Arnaldo, where he mentioned
he wanted to unify MAP__VARIABLE/MAP__FUNCTION anyway, I'm
making data mmaps to be synthesized unconditionally.

Reported-by: Noel Grandin <noelgrandin@gmail.com>
Link: http://lkml.kernel.org/n/tip-lh02yir6qfycn8zr892rmlgg@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/builtin-kvm.c              |  2 +-
 tools/perf/builtin-record.c           |  2 +-
 tools/perf/builtin-top.c              |  2 +-
 tools/perf/builtin-trace.c            |  2 +-
 tools/perf/tests/code-reading.c       |  2 +-
 tools/perf/tests/dwarf-unwind.c       |  2 +-
 tools/perf/tests/mmap-thread-lookup.c |  4 ++--
 tools/perf/util/event.c               | 16 ++++++----------
 tools/perf/util/event.h               |  5 ++---
 tools/perf/util/machine.c             |  6 +++---
 tools/perf/util/machine.h             |  6 +++---
 11 files changed, 22 insertions(+), 27 deletions(-)

diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 4418d9214872..20cc1b424212 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -1400,7 +1400,7 @@ static int kvm_events_live(struct perf_kvm_stat *kvm,
 	perf_session__set_id_hdr_size(kvm->session);
 	ordered_events__set_copy_on_queue(&kvm->session->ordered_events, true);
 	machine__synthesize_threads(&kvm->session->machines.host, &kvm->opts.target,
-				    kvm->evlist->threads, false, kvm->opts.proc_map_timeout);
+				    kvm->evlist->threads, kvm->opts.proc_map_timeout);
 	err = kvm_live_open_events(kvm);
 	if (err)
 		goto out;
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 9c5cdc2c4471..e37d9c40f05d 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -612,7 +612,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 	}
 
 	err = __machine__synthesize_threads(machine, tool, &opts->target, rec->evlist->threads,
-					    process_synthesized_event, opts->sample_address,
+					    process_synthesized_event,
 					    opts->proc_map_timeout);
 	if (err != 0)
 		goto out_child;
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 9ebd67a42ede..f252747ae45c 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -960,7 +960,7 @@ static int __cmd_top(struct perf_top *top)
 		goto out_delete;
 
 	machine__synthesize_threads(&top->session->machines.host, &opts->target,
-				    top->evlist->threads, false, opts->proc_map_timeout);
+				    top->evlist->threads, opts->proc_map_timeout);
 
 	if (sort__has_socket) {
 		ret = perf_env__read_cpu_topology_map(&perf_env);
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 20916dd77aac..59a96637bbe7 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1649,7 +1649,7 @@ static int trace__symbols_init(struct trace *trace, struct perf_evlist *evlist)
 		return -errno;
 
 	err = __machine__synthesize_threads(trace->host, &trace->tool, &trace->opts.target,
-					    evlist->threads, trace__tool_process, false,
+					    evlist->threads, trace__tool_process,
 					    trace->opts.proc_map_timeout);
 	if (err)
 		symbol__exit();
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 313a48c6b2bc..388c73d85180 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -495,7 +495,7 @@ static int do_test_code_reading(bool try_kcore)
 	}
 
 	ret = perf_event__synthesize_thread_map(NULL, threads,
-						perf_event__process, machine, false, 500);
+						perf_event__process, machine, 500);
 	if (ret < 0) {
 		pr_debug("perf_event__synthesize_thread_map failed\n");
 		goto out_err;
diff --git a/tools/perf/tests/dwarf-unwind.c b/tools/perf/tests/dwarf-unwind.c
index 1c5c0221cea2..8e413b88b2d9 100644
--- a/tools/perf/tests/dwarf-unwind.c
+++ b/tools/perf/tests/dwarf-unwind.c
@@ -32,7 +32,7 @@ static int init_live_machine(struct machine *machine)
 	pid_t pid = getpid();
 
 	return perf_event__synthesize_mmap_events(NULL, &event, pid, pid,
-						  mmap_handler, machine, true, 500);
+						  mmap_handler, machine, 500);
 }
 
 #define MAX_STACK 8
diff --git a/tools/perf/tests/mmap-thread-lookup.c b/tools/perf/tests/mmap-thread-lookup.c
index 0c5ce44f723f..5da977c5bda1 100644
--- a/tools/perf/tests/mmap-thread-lookup.c
+++ b/tools/perf/tests/mmap-thread-lookup.c
@@ -129,7 +129,7 @@ static int synth_all(struct machine *machine)
 {
 	return perf_event__synthesize_threads(NULL,
 					      perf_event__process,
-					      machine, 0, 500);
+					      machine, 500);
 }
 
 static int synth_process(struct machine *machine)
@@ -141,7 +141,7 @@ static int synth_process(struct machine *machine)
 
 	err = perf_event__synthesize_thread_map(NULL, map,
 						perf_event__process,
-						machine, 0, 500);
+						machine, 500);
 
 	thread_map__put(map);
 	return err;
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index cd61bb1f3917..3d648b335d45 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -229,7 +229,6 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool,
 				       pid_t pid, pid_t tgid,
 				       perf_event__handler_t process,
 				       struct machine *machine,
-				       bool mmap_data,
 				       unsigned int proc_map_timeout)
 {
 	char filename[PATH_MAX];
@@ -320,7 +319,7 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool,
 			event->mmap2.flags |= MAP_PRIVATE;
 
 		if (prot[2] != 'x') {
-			if (!mmap_data || prot[0] != 'r')
+			if (prot[0] != 'r')
 				continue;
 
 			event->header.misc |= PERF_RECORD_MISC_MMAP_DATA;
@@ -419,7 +418,6 @@ static int __event__synthesize_thread(union perf_event *comm_event,
 					  perf_event__handler_t process,
 				      struct perf_tool *tool,
 				      struct machine *machine,
-				      bool mmap_data,
 				      unsigned int proc_map_timeout)
 {
 	char filename[PATH_MAX];
@@ -437,7 +435,7 @@ static int __event__synthesize_thread(union perf_event *comm_event,
 			return -1;
 
 		return perf_event__synthesize_mmap_events(tool, mmap_event, pid, tgid,
-							  process, machine, mmap_data,
+							  process, machine,
 							  proc_map_timeout);
 	}
 
@@ -479,7 +477,7 @@ static int __event__synthesize_thread(union perf_event *comm_event,
 		if (_pid == pid) {
 			/* process the parent's maps too */
 			rc = perf_event__synthesize_mmap_events(tool, mmap_event, pid, tgid,
-						process, machine, mmap_data, proc_map_timeout);
+						process, machine, proc_map_timeout);
 			if (rc)
 				break;
 		}
@@ -493,7 +491,6 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool,
 				      struct thread_map *threads,
 				      perf_event__handler_t process,
 				      struct machine *machine,
-				      bool mmap_data,
 				      unsigned int proc_map_timeout)
 {
 	union perf_event *comm_event, *mmap_event, *fork_event;
@@ -517,7 +514,7 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool,
 					       fork_event,
 					       thread_map__pid(threads, thread), 0,
 					       process, tool, machine,
-					       mmap_data, proc_map_timeout)) {
+					       proc_map_timeout)) {
 			err = -1;
 			break;
 		}
@@ -543,7 +540,7 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool,
 						       fork_event,
 						       comm_event->comm.pid, 0,
 						       process, tool, machine,
-						       mmap_data, proc_map_timeout)) {
+						       proc_map_timeout)) {
 				err = -1;
 				break;
 			}
@@ -561,7 +558,6 @@ out:
 int perf_event__synthesize_threads(struct perf_tool *tool,
 				   perf_event__handler_t process,
 				   struct machine *machine,
-				   bool mmap_data,
 				   unsigned int proc_map_timeout)
 {
 	DIR *proc;
@@ -602,7 +598,7 @@ int perf_event__synthesize_threads(struct perf_tool *tool,
  		 * one thread couldn't be synthesized.
  		 */
 		__event__synthesize_thread(comm_event, mmap_event, fork_event, pid,
-					   1, process, tool, machine, mmap_data,
+					   1, process, tool, machine,
 					   proc_map_timeout);
 	}
 
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index b7ffb7ee9971..0561c7806690 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -514,7 +514,7 @@ typedef int (*perf_event__handler_t)(struct perf_tool *tool,
 int perf_event__synthesize_thread_map(struct perf_tool *tool,
 				      struct thread_map *threads,
 				      perf_event__handler_t process,
-				      struct machine *machine, bool mmap_data,
+				      struct machine *machine,
 				      unsigned int proc_map_timeout);
 int perf_event__synthesize_thread_map2(struct perf_tool *tool,
 				      struct thread_map *threads,
@@ -526,7 +526,7 @@ int perf_event__synthesize_cpu_map(struct perf_tool *tool,
 				   struct machine *machine);
 int perf_event__synthesize_threads(struct perf_tool *tool,
 				   perf_event__handler_t process,
-				   struct machine *machine, bool mmap_data,
+				   struct machine *machine,
 				   unsigned int proc_map_timeout);
 int perf_event__synthesize_kernel_mmap(struct perf_tool *tool,
 				       perf_event__handler_t process,
@@ -632,7 +632,6 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool,
 				       pid_t pid, pid_t tgid,
 				       perf_event__handler_t process,
 				       struct machine *machine,
-				       bool mmap_data,
 				       unsigned int proc_map_timeout);
 
 size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp);
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index ad79297c76c8..585c668519dc 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1991,13 +1991,13 @@ int machines__for_each_thread(struct machines *machines,
 
 int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool,
 				  struct target *target, struct thread_map *threads,
-				  perf_event__handler_t process, bool data_mmap,
+				  perf_event__handler_t process,
 				  unsigned int proc_map_timeout)
 {
 	if (target__has_task(target))
-		return perf_event__synthesize_thread_map(tool, threads, process, machine, data_mmap, proc_map_timeout);
+		return perf_event__synthesize_thread_map(tool, threads, process, machine, proc_map_timeout);
 	else if (target__has_cpu(target))
-		return perf_event__synthesize_threads(tool, process, machine, data_mmap, proc_map_timeout);
+		return perf_event__synthesize_threads(tool, process, machine, proc_map_timeout);
 	/* command specified */
 	return 0;
 }
diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h
index 2c2b443df5ba..91a93b2c2a3a 100644
--- a/tools/perf/util/machine.h
+++ b/tools/perf/util/machine.h
@@ -231,15 +231,15 @@ int machines__for_each_thread(struct machines *machines,
 
 int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool,
 				  struct target *target, struct thread_map *threads,
-				  perf_event__handler_t process, bool data_mmap,
+				  perf_event__handler_t process,
 				  unsigned int proc_map_timeout);
 static inline
 int machine__synthesize_threads(struct machine *machine, struct target *target,
-				struct thread_map *threads, bool data_mmap,
+				struct thread_map *threads,
 				unsigned int proc_map_timeout)
 {
 	return __machine__synthesize_threads(machine, NULL, target, threads,
-					     perf_event__process, data_mmap,
+					     perf_event__process,
 					     proc_map_timeout);
 }
 
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/6] perf tools: Various fixes
  2015-12-17 20:26 [PATCH 0/6] perf tools: Various fixes Jiri Olsa
                   ` (5 preceding siblings ...)
  2015-12-17 20:26 ` [PATCH 6/6] perf record: Always store data mmaps Jiri Olsa
@ 2015-12-17 20:49 ` Jiri Olsa
  2015-12-18  9:06 ` Noel Grandin
  7 siblings, 0 replies; 13+ messages in thread
From: Jiri Olsa @ 2015-12-17 20:49 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Arnaldo Carvalho de Melo, lkml, David Ahern, Ingo Molnar,
	Namhyung Kim, Peter Zijlstra, Noel Grandin, Adrian Hunter

On Thu, Dec 17, 2015 at 09:26:49PM +0100, Jiri Olsa wrote:
> hi,
> sending several changes together:
>   - leftover for the stat enable/disable changes with Adrian's patch
>   - fixes for issues Noel found with DWARF unwind
> 
> Noel, could you please rerun your test on this?
> 
> Also available in:
>   git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
>   perf/fixes
> 
> thanks,
> jirka
> 
> 
> ---
> Adrian Hunter (1):
>       perf tools: Make perf_evlist__open() open evsels with their cpus and threads (like perf record does)

argh, forgot to CC Adrian, sry.. adding him to the loop now

jirka

> 
> Jiri Olsa (5):
>       perf tools: Remove perf_evlist__(enable|disable)_event functions
>       perf tools: Use find_map function in access_dso_mem
>       perf tools libunwind: Check for mmaps also in MAP__VARIABLE tree
>       perf tools libdw: Check for mmaps also in MAP__VARIABLE tree
>       perf record: Always store data mmaps
> 
>  tools/perf/arch/x86/util/intel-bts.c  |  4 ++--
>  tools/perf/arch/x86/util/intel-pt.c   |  4 ++--
>  tools/perf/builtin-kvm.c              |  2 +-
>  tools/perf/builtin-record.c           |  2 +-
>  tools/perf/builtin-top.c              |  2 +-
>  tools/perf/builtin-trace.c            |  2 +-
>  tools/perf/tests/code-reading.c       |  2 +-
>  tools/perf/tests/dwarf-unwind.c       |  2 +-
>  tools/perf/tests/keep-tracking.c      |  2 +-
>  tools/perf/tests/mmap-thread-lookup.c |  4 ++--
>  tools/perf/tests/switch-tracking.c    |  6 +++---
>  tools/perf/util/event.c               | 16 ++++++----------
>  tools/perf/util/event.h               |  5 ++---
>  tools/perf/util/evlist.c              | 44 +-------------------------------------------
>  tools/perf/util/evlist.h              |  4 ----
>  tools/perf/util/machine.c             |  6 +++---
>  tools/perf/util/machine.h             |  6 +++---
>  tools/perf/util/unwind-libdw.c        | 10 ++++++++++
>  tools/perf/util/unwind-libunwind.c    | 20 ++++++++++++++------
>  19 files changed, 55 insertions(+), 88 deletions(-)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/6] perf tools: Various fixes
  2015-12-17 20:26 [PATCH 0/6] perf tools: Various fixes Jiri Olsa
                   ` (6 preceding siblings ...)
  2015-12-17 20:49 ` [PATCH 0/6] perf tools: Various fixes Jiri Olsa
@ 2015-12-18  9:06 ` Noel Grandin
  2015-12-27 11:57   ` Jiri Olsa
  7 siblings, 1 reply; 13+ messages in thread
From: Noel Grandin @ 2015-12-18  9:06 UTC (permalink / raw)
  To: Jiri Olsa, Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra

This series is

Tested-By: Noel Grandin <noelgrandin@gmail.com>

On 2015-12-17 10:26 PM, Jiri Olsa wrote:
> hi,
> sending several changes together:
>    - leftover for the stat enable/disable changes with Adrian's patch
>    - fixes for issues Noel found with DWARF unwind
>
> Noel, could you please rerun your test on this?
>
> Also available in:
>    git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
>    perf/fixes
>
> thanks,
> jirka
>
>
> ---
> Adrian Hunter (1):
>        perf tools: Make perf_evlist__open() open evsels with their cpus and threads (like perf record does)
>
> Jiri Olsa (5):
>        perf tools: Remove perf_evlist__(enable|disable)_event functions
>        perf tools: Use find_map function in access_dso_mem
>        perf tools libunwind: Check for mmaps also in MAP__VARIABLE tree
>        perf tools libdw: Check for mmaps also in MAP__VARIABLE tree
>        perf record: Always store data mmaps
>
>   tools/perf/arch/x86/util/intel-bts.c  |  4 ++--
>   tools/perf/arch/x86/util/intel-pt.c   |  4 ++--
>   tools/perf/builtin-kvm.c              |  2 +-
>   tools/perf/builtin-record.c           |  2 +-
>   tools/perf/builtin-top.c              |  2 +-
>   tools/perf/builtin-trace.c            |  2 +-
>   tools/perf/tests/code-reading.c       |  2 +-
>   tools/perf/tests/dwarf-unwind.c       |  2 +-
>   tools/perf/tests/keep-tracking.c      |  2 +-
>   tools/perf/tests/mmap-thread-lookup.c |  4 ++--
>   tools/perf/tests/switch-tracking.c    |  6 +++---
>   tools/perf/util/event.c               | 16 ++++++----------
>   tools/perf/util/event.h               |  5 ++---
>   tools/perf/util/evlist.c              | 44 +-------------------------------------------
>   tools/perf/util/evlist.h              |  4 ----
>   tools/perf/util/machine.c             |  6 +++---
>   tools/perf/util/machine.h             |  6 +++---
>   tools/perf/util/unwind-libdw.c        | 10 ++++++++++
>   tools/perf/util/unwind-libunwind.c    | 20 ++++++++++++++------
>   19 files changed, 55 insertions(+), 88 deletions(-)
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/6] perf tools: Various fixes
  2015-12-18  9:06 ` Noel Grandin
@ 2015-12-27 11:57   ` Jiri Olsa
  2016-01-05 10:23     ` Jiri Olsa
  0 siblings, 1 reply; 13+ messages in thread
From: Jiri Olsa @ 2015-12-27 11:57 UTC (permalink / raw)
  To: Noel Grandin
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, lkml, David Ahern,
	Ingo Molnar, Namhyung Kim, Peter Zijlstra

On Fri, Dec 18, 2015 at 11:06:56AM +0200, Noel Grandin wrote:
> This series is
> 
> Tested-By: Noel Grandin <noelgrandin@gmail.com>
> 
> On 2015-12-17 10:26 PM, Jiri Olsa wrote:
> >hi,
> >sending several changes together:
> >   - leftover for the stat enable/disable changes with Adrian's patch
> >   - fixes for issues Noel found with DWARF unwind
> >
> >Noel, could you please rerun your test on this?
> >
> >Also available in:
> >   git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
> >   perf/fixes

I updated perf/fixes branch woth Noel's tag

thanks,
jirka

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/6] perf tools: Various fixes
  2015-12-27 11:57   ` Jiri Olsa
@ 2016-01-05 10:23     ` Jiri Olsa
  0 siblings, 0 replies; 13+ messages in thread
From: Jiri Olsa @ 2016-01-05 10:23 UTC (permalink / raw)
  To: Noel Grandin
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, lkml, David Ahern,
	Ingo Molnar, Namhyung Kim, Peter Zijlstra

On Sun, Dec 27, 2015 at 12:57:16PM +0100, Jiri Olsa wrote:
> On Fri, Dec 18, 2015 at 11:06:56AM +0200, Noel Grandin wrote:
> > This series is
> > 
> > Tested-By: Noel Grandin <noelgrandin@gmail.com>
> > 
> > On 2015-12-17 10:26 PM, Jiri Olsa wrote:
> > >hi,
> > >sending several changes together:
> > >   - leftover for the stat enable/disable changes with Adrian's patch
> > >   - fixes for issues Noel found with DWARF unwind
> > >
> > >Noel, could you please rerun your test on this?
> > >
> > >Also available in:
> > >   git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
> > >   perf/fixes
> 
> I updated perf/fixes branch woth Noel's tag

perf/fixes rebased to latest acme/perf/core

FYI it contains couple more small fixes on top, which I'll send out later

thanks,
jirka

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 6/6] perf record: Always store data mmaps
  2015-12-17 20:26 ` [PATCH 6/6] perf record: Always store data mmaps Jiri Olsa
@ 2016-01-05 11:16   ` Namhyung Kim
  2016-01-05 14:11     ` Jiri Olsa
  0 siblings, 1 reply; 13+ messages in thread
From: Namhyung Kim @ 2016-01-05 11:16 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Arnaldo Carvalho de Melo, lkml, David Ahern, Ingo Molnar,
	Peter Zijlstra, Noel Grandin

On Thu, Dec 17, 2015 at 09:26:55PM +0100, Jiri Olsa wrote:
> Currently we don't synthesize data mmap by default. It depends
> on -d option, that enables data address sampling.
> 
> But we've seen cases (softice) where DWARF unwinder went through
> non executable mmaps, which we need to lookup in MAP__VARIABLE tree.
> 
> Given the discussion we had with Arnaldo, where he mentioned
> he wanted to unify MAP__VARIABLE/MAP__FUNCTION anyway, I'm
> making data mmaps to be synthesized unconditionally.

But I'm afraid of increased data size.  Could you check how much is it?

Thanks,
Namhyung


> 
> Reported-by: Noel Grandin <noelgrandin@gmail.com>
> Link: http://lkml.kernel.org/n/tip-lh02yir6qfycn8zr892rmlgg@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  tools/perf/builtin-kvm.c              |  2 +-
>  tools/perf/builtin-record.c           |  2 +-
>  tools/perf/builtin-top.c              |  2 +-
>  tools/perf/builtin-trace.c            |  2 +-
>  tools/perf/tests/code-reading.c       |  2 +-
>  tools/perf/tests/dwarf-unwind.c       |  2 +-
>  tools/perf/tests/mmap-thread-lookup.c |  4 ++--
>  tools/perf/util/event.c               | 16 ++++++----------
>  tools/perf/util/event.h               |  5 ++---
>  tools/perf/util/machine.c             |  6 +++---
>  tools/perf/util/machine.h             |  6 +++---
>  11 files changed, 22 insertions(+), 27 deletions(-)
> 
> diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
> index 4418d9214872..20cc1b424212 100644
> --- a/tools/perf/builtin-kvm.c
> +++ b/tools/perf/builtin-kvm.c
> @@ -1400,7 +1400,7 @@ static int kvm_events_live(struct perf_kvm_stat *kvm,
>  	perf_session__set_id_hdr_size(kvm->session);
>  	ordered_events__set_copy_on_queue(&kvm->session->ordered_events, true);
>  	machine__synthesize_threads(&kvm->session->machines.host, &kvm->opts.target,
> -				    kvm->evlist->threads, false, kvm->opts.proc_map_timeout);
> +				    kvm->evlist->threads, kvm->opts.proc_map_timeout);
>  	err = kvm_live_open_events(kvm);
>  	if (err)
>  		goto out;
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index 9c5cdc2c4471..e37d9c40f05d 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -612,7 +612,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
>  	}
>  
>  	err = __machine__synthesize_threads(machine, tool, &opts->target, rec->evlist->threads,
> -					    process_synthesized_event, opts->sample_address,
> +					    process_synthesized_event,
>  					    opts->proc_map_timeout);
>  	if (err != 0)
>  		goto out_child;
> diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
> index 9ebd67a42ede..f252747ae45c 100644
> --- a/tools/perf/builtin-top.c
> +++ b/tools/perf/builtin-top.c
> @@ -960,7 +960,7 @@ static int __cmd_top(struct perf_top *top)
>  		goto out_delete;
>  
>  	machine__synthesize_threads(&top->session->machines.host, &opts->target,
> -				    top->evlist->threads, false, opts->proc_map_timeout);
> +				    top->evlist->threads, opts->proc_map_timeout);
>  
>  	if (sort__has_socket) {
>  		ret = perf_env__read_cpu_topology_map(&perf_env);
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index 20916dd77aac..59a96637bbe7 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -1649,7 +1649,7 @@ static int trace__symbols_init(struct trace *trace, struct perf_evlist *evlist)
>  		return -errno;
>  
>  	err = __machine__synthesize_threads(trace->host, &trace->tool, &trace->opts.target,
> -					    evlist->threads, trace__tool_process, false,
> +					    evlist->threads, trace__tool_process,
>  					    trace->opts.proc_map_timeout);
>  	if (err)
>  		symbol__exit();
> diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
> index 313a48c6b2bc..388c73d85180 100644
> --- a/tools/perf/tests/code-reading.c
> +++ b/tools/perf/tests/code-reading.c
> @@ -495,7 +495,7 @@ static int do_test_code_reading(bool try_kcore)
>  	}
>  
>  	ret = perf_event__synthesize_thread_map(NULL, threads,
> -						perf_event__process, machine, false, 500);
> +						perf_event__process, machine, 500);
>  	if (ret < 0) {
>  		pr_debug("perf_event__synthesize_thread_map failed\n");
>  		goto out_err;
> diff --git a/tools/perf/tests/dwarf-unwind.c b/tools/perf/tests/dwarf-unwind.c
> index 1c5c0221cea2..8e413b88b2d9 100644
> --- a/tools/perf/tests/dwarf-unwind.c
> +++ b/tools/perf/tests/dwarf-unwind.c
> @@ -32,7 +32,7 @@ static int init_live_machine(struct machine *machine)
>  	pid_t pid = getpid();
>  
>  	return perf_event__synthesize_mmap_events(NULL, &event, pid, pid,
> -						  mmap_handler, machine, true, 500);
> +						  mmap_handler, machine, 500);
>  }
>  
>  #define MAX_STACK 8
> diff --git a/tools/perf/tests/mmap-thread-lookup.c b/tools/perf/tests/mmap-thread-lookup.c
> index 0c5ce44f723f..5da977c5bda1 100644
> --- a/tools/perf/tests/mmap-thread-lookup.c
> +++ b/tools/perf/tests/mmap-thread-lookup.c
> @@ -129,7 +129,7 @@ static int synth_all(struct machine *machine)
>  {
>  	return perf_event__synthesize_threads(NULL,
>  					      perf_event__process,
> -					      machine, 0, 500);
> +					      machine, 500);
>  }
>  
>  static int synth_process(struct machine *machine)
> @@ -141,7 +141,7 @@ static int synth_process(struct machine *machine)
>  
>  	err = perf_event__synthesize_thread_map(NULL, map,
>  						perf_event__process,
> -						machine, 0, 500);
> +						machine, 500);
>  
>  	thread_map__put(map);
>  	return err;
> diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
> index cd61bb1f3917..3d648b335d45 100644
> --- a/tools/perf/util/event.c
> +++ b/tools/perf/util/event.c
> @@ -229,7 +229,6 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool,
>  				       pid_t pid, pid_t tgid,
>  				       perf_event__handler_t process,
>  				       struct machine *machine,
> -				       bool mmap_data,
>  				       unsigned int proc_map_timeout)
>  {
>  	char filename[PATH_MAX];
> @@ -320,7 +319,7 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool,
>  			event->mmap2.flags |= MAP_PRIVATE;
>  
>  		if (prot[2] != 'x') {
> -			if (!mmap_data || prot[0] != 'r')
> +			if (prot[0] != 'r')
>  				continue;
>  
>  			event->header.misc |= PERF_RECORD_MISC_MMAP_DATA;
> @@ -419,7 +418,6 @@ static int __event__synthesize_thread(union perf_event *comm_event,
>  					  perf_event__handler_t process,
>  				      struct perf_tool *tool,
>  				      struct machine *machine,
> -				      bool mmap_data,
>  				      unsigned int proc_map_timeout)
>  {
>  	char filename[PATH_MAX];
> @@ -437,7 +435,7 @@ static int __event__synthesize_thread(union perf_event *comm_event,
>  			return -1;
>  
>  		return perf_event__synthesize_mmap_events(tool, mmap_event, pid, tgid,
> -							  process, machine, mmap_data,
> +							  process, machine,
>  							  proc_map_timeout);
>  	}
>  
> @@ -479,7 +477,7 @@ static int __event__synthesize_thread(union perf_event *comm_event,
>  		if (_pid == pid) {
>  			/* process the parent's maps too */
>  			rc = perf_event__synthesize_mmap_events(tool, mmap_event, pid, tgid,
> -						process, machine, mmap_data, proc_map_timeout);
> +						process, machine, proc_map_timeout);
>  			if (rc)
>  				break;
>  		}
> @@ -493,7 +491,6 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool,
>  				      struct thread_map *threads,
>  				      perf_event__handler_t process,
>  				      struct machine *machine,
> -				      bool mmap_data,
>  				      unsigned int proc_map_timeout)
>  {
>  	union perf_event *comm_event, *mmap_event, *fork_event;
> @@ -517,7 +514,7 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool,
>  					       fork_event,
>  					       thread_map__pid(threads, thread), 0,
>  					       process, tool, machine,
> -					       mmap_data, proc_map_timeout)) {
> +					       proc_map_timeout)) {
>  			err = -1;
>  			break;
>  		}
> @@ -543,7 +540,7 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool,
>  						       fork_event,
>  						       comm_event->comm.pid, 0,
>  						       process, tool, machine,
> -						       mmap_data, proc_map_timeout)) {
> +						       proc_map_timeout)) {
>  				err = -1;
>  				break;
>  			}
> @@ -561,7 +558,6 @@ out:
>  int perf_event__synthesize_threads(struct perf_tool *tool,
>  				   perf_event__handler_t process,
>  				   struct machine *machine,
> -				   bool mmap_data,
>  				   unsigned int proc_map_timeout)
>  {
>  	DIR *proc;
> @@ -602,7 +598,7 @@ int perf_event__synthesize_threads(struct perf_tool *tool,
>   		 * one thread couldn't be synthesized.
>   		 */
>  		__event__synthesize_thread(comm_event, mmap_event, fork_event, pid,
> -					   1, process, tool, machine, mmap_data,
> +					   1, process, tool, machine,
>  					   proc_map_timeout);
>  	}
>  
> diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
> index b7ffb7ee9971..0561c7806690 100644
> --- a/tools/perf/util/event.h
> +++ b/tools/perf/util/event.h
> @@ -514,7 +514,7 @@ typedef int (*perf_event__handler_t)(struct perf_tool *tool,
>  int perf_event__synthesize_thread_map(struct perf_tool *tool,
>  				      struct thread_map *threads,
>  				      perf_event__handler_t process,
> -				      struct machine *machine, bool mmap_data,
> +				      struct machine *machine,
>  				      unsigned int proc_map_timeout);
>  int perf_event__synthesize_thread_map2(struct perf_tool *tool,
>  				      struct thread_map *threads,
> @@ -526,7 +526,7 @@ int perf_event__synthesize_cpu_map(struct perf_tool *tool,
>  				   struct machine *machine);
>  int perf_event__synthesize_threads(struct perf_tool *tool,
>  				   perf_event__handler_t process,
> -				   struct machine *machine, bool mmap_data,
> +				   struct machine *machine,
>  				   unsigned int proc_map_timeout);
>  int perf_event__synthesize_kernel_mmap(struct perf_tool *tool,
>  				       perf_event__handler_t process,
> @@ -632,7 +632,6 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool,
>  				       pid_t pid, pid_t tgid,
>  				       perf_event__handler_t process,
>  				       struct machine *machine,
> -				       bool mmap_data,
>  				       unsigned int proc_map_timeout);
>  
>  size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp);
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index ad79297c76c8..585c668519dc 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -1991,13 +1991,13 @@ int machines__for_each_thread(struct machines *machines,
>  
>  int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool,
>  				  struct target *target, struct thread_map *threads,
> -				  perf_event__handler_t process, bool data_mmap,
> +				  perf_event__handler_t process,
>  				  unsigned int proc_map_timeout)
>  {
>  	if (target__has_task(target))
> -		return perf_event__synthesize_thread_map(tool, threads, process, machine, data_mmap, proc_map_timeout);
> +		return perf_event__synthesize_thread_map(tool, threads, process, machine, proc_map_timeout);
>  	else if (target__has_cpu(target))
> -		return perf_event__synthesize_threads(tool, process, machine, data_mmap, proc_map_timeout);
> +		return perf_event__synthesize_threads(tool, process, machine, proc_map_timeout);
>  	/* command specified */
>  	return 0;
>  }
> diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h
> index 2c2b443df5ba..91a93b2c2a3a 100644
> --- a/tools/perf/util/machine.h
> +++ b/tools/perf/util/machine.h
> @@ -231,15 +231,15 @@ int machines__for_each_thread(struct machines *machines,
>  
>  int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool,
>  				  struct target *target, struct thread_map *threads,
> -				  perf_event__handler_t process, bool data_mmap,
> +				  perf_event__handler_t process,
>  				  unsigned int proc_map_timeout);
>  static inline
>  int machine__synthesize_threads(struct machine *machine, struct target *target,
> -				struct thread_map *threads, bool data_mmap,
> +				struct thread_map *threads,
>  				unsigned int proc_map_timeout)
>  {
>  	return __machine__synthesize_threads(machine, NULL, target, threads,
> -					     perf_event__process, data_mmap,
> +					     perf_event__process,
>  					     proc_map_timeout);
>  }
>  
> -- 
> 2.4.3
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 6/6] perf record: Always store data mmaps
  2016-01-05 11:16   ` Namhyung Kim
@ 2016-01-05 14:11     ` Jiri Olsa
  0 siblings, 0 replies; 13+ messages in thread
From: Jiri Olsa @ 2016-01-05 14:11 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, lkml, David Ahern,
	Ingo Molnar, Peter Zijlstra, Noel Grandin

On Tue, Jan 05, 2016 at 08:16:34PM +0900, Namhyung Kim wrote:
> On Thu, Dec 17, 2015 at 09:26:55PM +0100, Jiri Olsa wrote:
> > Currently we don't synthesize data mmap by default. It depends
> > on -d option, that enables data address sampling.
> > 
> > But we've seen cases (softice) where DWARF unwinder went through
> > non executable mmaps, which we need to lookup in MAP__VARIABLE tree.
> > 
> > Given the discussion we had with Arnaldo, where he mentioned
> > he wanted to unify MAP__VARIABLE/MAP__FUNCTION anyway, I'm
> > making data mmaps to be synthesized unconditionally.
> 
> But I'm afraid of increased data size.  Could you check how much is it?

I'll check

jirka

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-01-05 14:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-17 20:26 [PATCH 0/6] perf tools: Various fixes Jiri Olsa
2015-12-17 20:26 ` [PATCH 1/6] perf tools: Remove perf_evlist__(enable|disable)_event functions Jiri Olsa
2015-12-17 20:26 ` [PATCH 2/6] perf tools: Make perf_evlist__open() open evsels with their cpus and threads (like perf record does) Jiri Olsa
2015-12-17 20:26 ` [PATCH 3/6] perf tools: Use find_map function in access_dso_mem Jiri Olsa
2015-12-17 20:26 ` [PATCH 4/6] perf tools libunwind: Check for mmaps also in MAP__VARIABLE tree Jiri Olsa
2015-12-17 20:26 ` [PATCH 5/6] perf tools libdw: " Jiri Olsa
2015-12-17 20:26 ` [PATCH 6/6] perf record: Always store data mmaps Jiri Olsa
2016-01-05 11:16   ` Namhyung Kim
2016-01-05 14:11     ` Jiri Olsa
2015-12-17 20:49 ` [PATCH 0/6] perf tools: Various fixes Jiri Olsa
2015-12-18  9:06 ` Noel Grandin
2015-12-27 11:57   ` Jiri Olsa
2016-01-05 10:23     ` Jiri Olsa

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).