Skip to contentSkip to conversation

perf test: Fixes

PATCH In review Jiri Olsa 4 participants 19 messages Dec 3, 2015 – Dec 8, 2015 perf events

lore
Share & tools
lore

Jiri Olsa

author reviewer
#0 lore raw

cover perf test: Fixes

hi,
we've got many failing tests, mainly due to commit:
ebe9729c8c31 perf machine: Fix to destroy kernel maps when machine exits

and recent bpf changes, sending fixes.

I think we should force running 'perf test' little more ;-)

thanks,
jirka

---
Jiri Olsa (7):
perf test: Use machine__new_host in dwarf unwind test perf test: Use machine__new_host in mma thread lookup test perf test: Use machine__new_host in mma thread code reading test perf test: Fix cpus and thread maps refference in error path perf test: Prevent using bpf-output event in round trip name test perf test: Use machine__new_host in thread mg sharing test perf test: Create kernel maps properly for hist entries test

 tools/perf/tests/code-reading.c         | 14 +++++++++-----
 tools/perf/tests/dwarf-unwind.c         |  8 ++------
 tools/perf/tests/evsel-roundtrip-name.c | 11 +++++------
 tools/perf/tests/hists_common.c         |  7 +++++++
 tools/perf/tests/mmap-thread-lookup.c   |  6 ++----
 tools/perf/tests/thread-mg-share.c      |  7 +++----
 6 files changed, 28 insertions(+), 25 deletions(-)
author reviewer
#1 lore raw

PATCH 1/7 perf test: Use machine__new_host in dwarf unwind test

This is more straightforward than what we have now.

It also fixes segfault within machine__exit, that's caused but not creating kernel maps for machine.. We're calling machine__destroy_kernel_maps in machine__exit since commit:

ebe9729c8c31 perf machine: Fix to destroy kernel maps when machine exits

---
 tools/perf/tests/dwarf-unwind.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
tools/perf/tests/dwarf-unwind.c +2 -6
index 3cce13b19cbb..1c5c0221cea2 100644
@@ -160,14 +160,11 @@ static int krava_1(struct thread *thread)
 
 int test__dwarf_unwind(int subtest __maybe_unused)
 {
-	struct machines machines;
 	struct machine *machine;
 	struct thread *thread;
 	int err = -1;
 
-	machines__init(&machines);
-
-	machine = machines__find(&machines, HOST_KERNEL_ID);
+	machine = machine__new_host();
 	if (!machine) {
 		pr_err("Could not get machine\n");
 		return -1;
@@ -199,7 +196,6 @@ int test__dwarf_unwind(int subtest __maybe_unused)
 
  out:
 	machine__delete_threads(machine);
-	machine__exit(machine);
-	machines__exit(&machines);
+	machine__delete(machine);
 	return err;
 }
Signature · 1 line
2.4.3
#2 lore raw

[tip:perf/core] perf test: Use machine__new_host in dwarf unwind test

perf test: Use machine__new_host in dwarf unwind test
Commit-ID:  bdaba8aee5c3806d78ee4f130048b2238c636d47
Gitweb:     http://git.kernel.org/tip/bdaba8aee5c3806d78ee4f130048b2238c636d47
Author:     Jiri Olsa <[email protected]>
AuthorDate: Thu, 3 Dec 2015 09:34:12 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 7 Dec 2015 18:12:54 -0300

perf test: Use machine__new_host in dwarf unwind test

This is more straightforward than what we have now.

It also fixes a segfault within machine__exit, that's caused by not creating kernel maps for machine.. We're calling machine__destroy_kernel_maps in machine__exit since commit:

ebe9729c8c31 perf machine: Fix to destroy kernel maps when machine exits

---
 tools/perf/tests/dwarf-unwind.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
tools/perf/tests/dwarf-unwind.c +2 -6
index 3cce13b1..1c5c022 100644
@@ -160,14 +160,11 @@ static int krava_1(struct thread *thread)
 
 int test__dwarf_unwind(int subtest __maybe_unused)
 {
-	struct machines machines;
 	struct machine *machine;
 	struct thread *thread;
 	int err = -1;
 
-	machines__init(&machines);
-
-	machine = machines__find(&machines, HOST_KERNEL_ID);
+	machine = machine__new_host();
 	if (!machine) {
 		pr_err("Could not get machine\n");
 		return -1;
@@ -199,7 +196,6 @@ int test__dwarf_unwind(int subtest __maybe_unused)
 
  out:
 	machine__delete_threads(machine);
-	machine__exit(machine);
-	machines__exit(&machines);
+	machine__delete(machine);
 	return err;
 }
author reviewer
#3 lore raw

PATCH 2/7 perf test: Use machine__new_host in mma thread lookup test

In reply to Jiri Olsa

This is more straightforward than what we have now.

It also fixes segfault within machine__exit, that's caused but not creating kernel maps for machine.. We're calling machine__destroy_kernel_maps in machine__exit since commit:

ebe9729c8c31 perf machine: Fix to destroy kernel maps when machine exits

---
 tools/perf/tests/mmap-thread-lookup.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
tools/perf/tests/mmap-thread-lookup.c +2 -4
index 6cdb97579c45..0c5ce44f723f 100644
@@ -149,7 +149,6 @@ static int synth_process(struct machine *machine)
 
 static int mmap_events(synth_cb synth)
 {
-	struct machines machines;
 	struct machine *machine;
 	int err, i;
 
@@ -162,8 +161,7 @@ static int mmap_events(synth_cb synth)
 	 */
 	TEST_ASSERT_VAL("failed to create threads", !threads_create());
 
-	machines__init(&machines);
-	machine = &machines.host;
+	machine = machine__new_host();
 
 	dump_trace = verbose > 1 ? 1 : 0;
 
@@ -203,7 +201,7 @@ static int mmap_events(synth_cb synth)
 	}
 
 	machine__delete_threads(machine);
-	machines__exit(&machines);
+	machine__delete(machine);
 	return err;
 }
 
Signature · 1 line
2.4.3
maintainer
#4 lore raw

Re: [PATCH 2/7] perf test: Use machine__new_host in mma thread lookup test

Hi Jiri,

In the subject, please do 's/mma/mmap/'. Ditto for 3/7.

Thanks,
Namhyung

Quoted 48 lines · Jiri Olsa

This is more straightforward than what we have now.

It also fixes segfault within machine__exit, that's caused but not creating kernel maps for machine.. We're calling machine__destroy_kernel_maps in machine__exit since commit:

ebe9729c8c31 perf machine: Fix to destroy kernel maps when machine exits

---
 tools/perf/tests/mmap-thread-lookup.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
tools/perf/tests/mmap-thread-lookup.c +2 -4
index 6cdb97579c45..0c5ce44f723f 100644
@@ -149,7 +149,6 @@ static int synth_process(struct machine *machine)
 
 static int mmap_events(synth_cb synth)
 {
-	struct machines machines;
 	struct machine *machine;
 	int err, i;
 
@@ -162,8 +161,7 @@ static int mmap_events(synth_cb synth)
 	 */
 	TEST_ASSERT_VAL("failed to create threads", !threads_create());
 
-	machines__init(&machines);
-	machine = &machines.host;
+	machine = machine__new_host();
 
 	dump_trace = verbose > 1 ? 1 : 0;
 
@@ -203,7 +201,7 @@ static int mmap_events(synth_cb synth)
 	}
 
 	machine__delete_threads(machine);
-	machines__exit(&machines);
+	machine__delete(machine);
 	return err;
 }
 
Signature · 1 line
2.4.3
#5 lore raw

Re: [PATCH 2/7] perf test: Use machine__new_host in mma thread lookup test

Quoted 3 lines · Namhyung Kim

Hi Jiri,

In the subject, please do 's/mma/mmap/'. Ditto for 3/7.

I updated that in the perf/fixes branch

Arnaldo please let me know if you need me to resend those again

thanks,
jirka

#6 lore raw

[tip:perf/core] perf test: Use machine__new_host in mmap thread lookup test

In reply to Jiri Olsa
perf test: Use machine__new_host in mmap thread lookup test
Commit-ID:  046847935754f27c2e8334ff15abda0b733a1fd4
Gitweb:     http://git.kernel.org/tip/046847935754f27c2e8334ff15abda0b733a1fd4
Author:     Jiri Olsa <[email protected]>
AuthorDate: Thu, 3 Dec 2015 09:34:13 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 7 Dec 2015 18:12:54 -0300

perf test: Use machine__new_host in mmap thread lookup test

This is more straightforward than what we have now.

It also fixes a segfault within machine__exit, that's caused by not creating kernel maps for machine.. We're calling machine__destroy_kernel_maps in machine__exit since commit:

ebe9729c8c31 perf machine: Fix to destroy kernel maps when machine exits

---
 tools/perf/tests/mmap-thread-lookup.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
tools/perf/tests/mmap-thread-lookup.c +2 -4
index 6cdb975..0c5ce44 100644
@@ -149,7 +149,6 @@ static int synth_process(struct machine *machine)
 
 static int mmap_events(synth_cb synth)
 {
-	struct machines machines;
 	struct machine *machine;
 	int err, i;
 
@@ -162,8 +161,7 @@ static int mmap_events(synth_cb synth)
 	 */
 	TEST_ASSERT_VAL("failed to create threads", !threads_create());
 
-	machines__init(&machines);
-	machine = &machines.host;
+	machine = machine__new_host();
 
 	dump_trace = verbose > 1 ? 1 : 0;
 
@@ -203,7 +201,7 @@ static int mmap_events(synth_cb synth)
 	}
 
 	machine__delete_threads(machine);
-	machines__exit(&machines);
+	machine__delete(machine);
 	return err;
 }
 
author reviewer
#7 lore raw

PATCH 3/7 perf test: Use machine__new_host in mma thread code reading test

In reply to Jiri Olsa

This is more straightforward than what we have now.

It also fixes segfault within machine__exit, that's caused but not creating kernel maps for machine.. We're calling machine__destroy_kernel_maps in machine__exit since commit:

ebe9729c8c31 perf machine: Fix to destroy kernel maps when machine exits

---
 tools/perf/tests/code-reading.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
tools/perf/tests/code-reading.c +2 -5
index 4417b6a079f0..26182ffcea75 100644
@@ -433,7 +433,6 @@ enum {
 
 static int do_test_code_reading(bool try_kcore)
 {
-	struct machines machines;
 	struct machine *machine;
 	struct thread *thread;
 	struct record_opts opts = {
@@ -459,8 +458,7 @@ static int do_test_code_reading(bool try_kcore)
 
 	pid = getpid();
 
-	machines__init(&machines);
-	machine = &machines.host;
+	machine = machine__new_host();
 
 	ret = machine__create_kernel_maps(machine);
 	if (ret < 0) {
@@ -594,9 +592,8 @@ out_err:
 		cpu_map__put(cpus);
 		thread_map__put(threads);
 	}
-	machines__destroy_kernel_maps(&machines);
 	machine__delete_threads(machine);
-	machines__exit(&machines);
+	machine__delete(machine);
 
 	return err;
 }
Signature · 1 line
2.4.3
#8 lore raw

[tip:perf/core] perf test: Use machine__new_host in mmap thread code reading test

perf test: Use machine__new_host in mmap thread code reading test
Commit-ID:  0fd4008ed755c52d85117302a3c2c108b2958420
Gitweb:     http://git.kernel.org/tip/0fd4008ed755c52d85117302a3c2c108b2958420
Author:     Jiri Olsa <[email protected]>
AuthorDate: Thu, 3 Dec 2015 09:34:14 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 7 Dec 2015 18:12:55 -0300

perf test: Use machine__new_host in mmap thread code reading test

This is more straightforward than what we have now.

It also fixes a segfault within machine__exit, that's caused by not creating kernel maps for machine.. We're calling machine__destroy_kernel_maps in machine__exit since commit:

ebe9729c8c31 perf machine: Fix to destroy kernel maps when machine exits

---
 tools/perf/tests/code-reading.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
tools/perf/tests/code-reading.c +2 -5
index 4417b6a..26182ff 100644
@@ -433,7 +433,6 @@ enum {
 
 static int do_test_code_reading(bool try_kcore)
 {
-	struct machines machines;
 	struct machine *machine;
 	struct thread *thread;
 	struct record_opts opts = {
@@ -459,8 +458,7 @@ static int do_test_code_reading(bool try_kcore)
 
 	pid = getpid();
 
-	machines__init(&machines);
-	machine = &machines.host;
+	machine = machine__new_host();
 
 	ret = machine__create_kernel_maps(machine);
 	if (ret < 0) {
@@ -594,9 +592,8 @@ out_err:
 		cpu_map__put(cpus);
 		thread_map__put(threads);
 	}
-	machines__destroy_kernel_maps(&machines);
 	machine__delete_threads(machine);
-	machines__exit(&machines);
+	machine__delete(machine);
 
 	return err;
 }
author reviewer
#9 lore raw

PATCH 4/7 perf test: Fix cpus and thread maps refference in error path

In reply to Jiri Olsa

In error path to try user space event, both cpus and threads map now owned by evlist and freed by perf_evlist__set_maps call. Getting reference to keep them alive.

---
 tools/perf/tests/code-reading.c | 7 +++++++
 1 file changed, 7 insertions(+)
tools/perf/tests/code-reading.c +7 -0
index 26182ffcea75..313a48c6b2bc 100644
@@ -547,6 +547,13 @@ static int do_test_code_reading(bool try_kcore)
 		if (ret < 0) {
 			if (!excl_kernel) {
 				excl_kernel = true;
+				/*
+				 * Both cpus and threads are now owned by evlist
+				 * and will be freed by following perf_evlist__set_maps
+				 * call. Getting refference to keep them alive.
+				 */
+				cpu_map__get(cpus);
+				thread_map__get(threads);
 				perf_evlist__set_maps(evlist, NULL, NULL);
 				perf_evlist__delete(evlist);
 				evlist = NULL;
Signature · 1 line
2.4.3
#10 lore raw

[tip:perf/core] perf test: Fix cpus and thread maps reference in error path

perf test: Fix cpus and thread maps reference in error path
Commit-ID:  7320b1b3d9e6af30adcbead64568be3c40b50e59
Gitweb:     http://git.kernel.org/tip/7320b1b3d9e6af30adcbead64568be3c40b50e59
Author:     Jiri Olsa <[email protected]>
AuthorDate: Thu, 3 Dec 2015 09:34:15 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 7 Dec 2015 18:12:55 -0300

perf test: Fix cpus and thread maps reference in error path

In error path to try user space event, both cpus and threads map now owned by evlist and freed by perf_evlist__set_maps call. Getting reference to keep them alive.

---
 tools/perf/tests/code-reading.c | 7 +++++++
 1 file changed, 7 insertions(+)
tools/perf/tests/code-reading.c +7 -0
index 26182ff..313a48c 100644
@@ -547,6 +547,13 @@ static int do_test_code_reading(bool try_kcore)
 		if (ret < 0) {
 			if (!excl_kernel) {
 				excl_kernel = true;
+				/*
+				 * Both cpus and threads are now owned by evlist
+				 * and will be freed by following perf_evlist__set_maps
+				 * call. Getting refference to keep them alive.
+				 */
+				cpu_map__get(cpus);
+				thread_map__get(threads);
 				perf_evlist__set_maps(evlist, NULL, NULL);
 				perf_evlist__delete(evlist);
 				evlist = NULL;
author reviewer
#11 lore raw

PATCH 5/7 perf test: Prevent using bpf-output event in round trip name test

In reply to Jiri Olsa

The bpf-output is added under software events, but is not parse-able within parse_events, which is what round trip test is expecting.

Checking software events only until dummy event.

---
 tools/perf/tests/evsel-roundtrip-name.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
tools/perf/tests/evsel-roundtrip-name.c +5 -6
index 1da92e1159ee..97f3b7268a85 100644
@@ -61,7 +61,7 @@ static int perf_evsel__roundtrip_cache_name_test(void)
 	return ret;
 }
 
-static int __perf_evsel__name_array_test(const char *names[], int nr_names)
+static int perf_evsel__name_array_test(const char *names[], int nr_names)
 {
 	int i, err;
 	struct perf_evsel *evsel;
@@ -92,18 +92,17 @@ out_delete_evlist:
 	return err;
 }
 
-#define perf_evsel__name_array_test(names) \
-	__perf_evsel__name_array_test(names, ARRAY_SIZE(names))
-
 int test__perf_evsel__roundtrip_name_test(int subtest __maybe_unused)
 {
 	int err = 0, ret = 0;
 
-	err = perf_evsel__name_array_test(perf_evsel__hw_names);
+	err = perf_evsel__name_array_test(perf_evsel__hw_names,
+					  ARRAY_SIZE(perf_evsel__hw_names));
 	if (err)
 		ret = err;
 
-	err = perf_evsel__name_array_test(perf_evsel__sw_names);
+	err = perf_evsel__name_array_test(perf_evsel__sw_names,
+					  PERF_COUNT_SW_DUMMY + 1);
 	if (err)
 		ret = err;
 
Signature · 1 line
2.4.3
#12 lore raw

[tip:perf/core] perf test: Prevent using bpf-output event in round trip name test

perf test: Prevent using bpf-output event in round trip name test
Commit-ID:  c0651c41e45dee1d6abb83fd5b25e7097aeac141
Gitweb:     http://git.kernel.org/tip/c0651c41e45dee1d6abb83fd5b25e7097aeac141
Author:     Jiri Olsa <[email protected]>
AuthorDate: Thu, 3 Dec 2015 09:34:16 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 7 Dec 2015 18:12:56 -0300

perf test: Prevent using bpf-output event in round trip name test

The bpf-output is added under software events, but is not parse-able within parse_events, which is what round trip test is expecting.

Checking software events only until dummy event.

Cc Adrian Hunter <[email protected]>
Cc David Ahern <[email protected]>
Cc Masami Hiramatsu <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Wang Nan <[email protected]>
[ Make it a one liner by keeping __perf_evsel__name_array_test() around ]
---
 tools/perf/tests/evsel-roundtrip-name.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/tests/evsel-roundtrip-name.c +2 -1
index 1da92e1..2de4a4f 100644
@@ -103,7 +103,8 @@ int test__perf_evsel__roundtrip_name_test(int subtest __maybe_unused)
 	if (err)
 		ret = err;
 
-	err = perf_evsel__name_array_test(perf_evsel__sw_names);
+	err = __perf_evsel__name_array_test(perf_evsel__sw_names,
+					    PERF_COUNT_SW_DUMMY + 1);
 	if (err)
 		ret = err;
 
author reviewer
#13 lore raw

PATCH 6/7 perf test: Use machine__new_host in thread mg sharing test

In reply to Jiri Olsa

This is more straightforward than what we have now.

It also fixes segfault within machine__exit, that's caused but not creating kernel maps for machine.. We're calling machine__destroy_kernel_maps in machine__exit since commit:

ebe9729c8c31 perf machine: Fix to destroy kernel maps when machine exits

---
 tools/perf/tests/thread-mg-share.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
tools/perf/tests/thread-mg-share.c +3 -4
index 188b63140fc8..3e926e06fbd7 100644
@@ -6,7 +6,6 @@
 
 int test__thread_mg_share(int subtest __maybe_unused)
 {
-	struct machines machines;
 	struct machine *machine;
 
 	/* thread group */
@@ -27,8 +26,7 @@ int test__thread_mg_share(int subtest __maybe_unused)
 	 * other  group (pid: 4, tids: 4, 5)
 	*/
 
-	machines__init(&machines);
-	machine = &machines.host;
+	machine = machine__new_host();
 
 	/* create process with 4 threads */
 	leader = machine__findnew_thread(machine, 0, 0);
@@ -93,6 +91,7 @@ int test__thread_mg_share(int subtest __maybe_unused)
 
 	thread__put(other);
 
-	machines__exit(&machines);
+	machine__delete_threads(machine);
+	machine__delete(machine);
 	return 0;
 }
Signature · 1 line
2.4.3
author reviewer
#14 lore raw

PATCH 7/7 perf test: Create kernel maps properly for hist entries test

In reply to Jiri Olsa

It fixes segfault within machine__exit, that's caused but not creating kernel maps for machine.. We're calling machine__destroy_kernel_maps in machine__exit since commit:

ebe9729c8c31 perf machine: Fix to destroy kernel maps when machine exits

---
 tools/perf/tests/hists_common.c | 7 +++++++
 1 file changed, 7 insertions(+)
tools/perf/tests/hists_common.c +7 -0
index ce80b274b097..6ccdc8ac9578 100644
@@ -87,6 +87,11 @@ struct machine *setup_fake_machine(struct machines *machines)
 		return NULL;
 	}
 
+	if (machine__create_kernel_maps(machine)) {
+		pr_debug("Not enough memory for machine setup\n");
+		goto out_maps;
+	}
+
 	for (i = 0; i < ARRAY_SIZE(fake_threads); i++) {
 		struct thread *thread;
 
@@ -149,6 +154,8 @@ struct machine *setup_fake_machine(struct machines *machines)
 
 out:
 	pr_debug("Not enough memory for machine setup\n");
+
+out_maps:
 	machine__delete_threads(machine);
 	machine__delete(machine);
 	return NULL;
Signature · 1 line
2.4.3
maintainer
#15 lore raw

Re: [PATCH 7/7] perf test: Create kernel maps properly for hist entries test

Quoted 17 lines · Jiri Olsa

It fixes segfault within machine__exit, that's caused but not creating kernel maps for machine.. We're calling machine__destroy_kernel_maps in machine__exit since commit:

ebe9729c8c31 perf machine: Fix to destroy kernel maps when machine exits

---
 tools/perf/tests/hists_common.c | 7 +++++++
 1 file changed, 7 insertions(+)
tools/perf/tests/hists_common.c +0 -0
index ce80b274b097..6ccdc8ac9578 100644

tools/perf/tests/hists_common.c struct machine *setup_fake_machine(struct machines *machines) · line 92

Quoted 6 lines
tools/perf/tests/hists_common.c +3 -0
@@ -87,6 +87,11 @@ struct machine *setup_fake_machine(struct machines *machines)
 		return NULL;
 	}
 
+	if (machine__create_kernel_maps(machine)) {
+		pr_debug("Not enough memory for machine setup\n");
+		goto out_maps;

Why not just doing 'goto out'?

Quoted 17 lines
tools/perf/tests/hists_common.c +4 -0
+	}
+
 	for (i = 0; i < ARRAY_SIZE(fake_threads); i++) {
 		struct thread *thread;
 
@@ -149,6 +154,8 @@ struct machine *setup_fake_machine(struct machines *machines)
 
 out:
 	pr_debug("Not enough memory for machine setup\n");
+
+out_maps:
 	machine__delete_threads(machine);
 	machine__delete(machine);
 	return NULL;
Signature · 1 line
2.4.3
#16 lore raw

PATCH v2 7/7 perf test: Create kernel maps properly for hist entries test

Quoted 21 lines · Namhyung Kim
Quoted 20 lines · Jiri Olsa

It fixes segfault within machine__exit, that's caused but not creating kernel maps for machine.. We're calling machine__destroy_kernel_maps in machine__exit since commit:

ebe9729c8c31 perf machine: Fix to destroy kernel maps when machine exits

---
 tools/perf/tests/hists_common.c | 7 +++++++
 1 file changed, 7 insertions(+)
tools/perf/tests/hists_common.c +0 -0
index ce80b274b097..6ccdc8ac9578 100644
@@ -87,6 +87,11 @@ struct machine *setup_fake_machine(struct machines *machines)
 		return NULL;
 	}
 
Quoted 6 lines

tools/perf/tests/hists_common.c struct machine *setup_fake_machine(struct machines *machines) · line 92

Quoted 3 lines
tools/perf/tests/hists_common.c +3 -0
+	if (machine__create_kernel_maps(machine)) {
+		pr_debug("Not enough memory for machine setup\n");
+		goto out_maps;

Why not just doing 'goto out'?

right.. v2 attached, perf-fixes branch updated

thanks,
jirka

---
Subject: [PATCH] perf test: Create kernel maps properly for hist entries test

It fixes segfault within machine__exit, that's caused but not creating kernel maps for machine.. We're calling machine__destroy_kernel_maps in machine__exit since commit:

ebe9729c8c31 perf machine: Fix to destroy kernel maps when machine exits

---
 tools/perf/tests/hists_common.c | 5 +++++
 1 file changed, 5 insertions(+)
tools/perf/tests/hists_common.c +5 -0
index ce80b274b097..46f453b1de60 100644
@@ -87,6 +87,11 @@ struct machine *setup_fake_machine(struct machines *machines)
 		return NULL;
 	}
 
+	if (machine__create_kernel_maps(machine)) {
+		pr_debug("Not enough memory for machine setup\n");
+		goto out;
+	}
+
 	for (i = 0; i < ARRAY_SIZE(fake_threads); i++) {
 		struct thread *thread;
 
Signature · 1 line
2.4.3
#17 lore raw
In reply to Jiri Olsa
Quoted 7 lines · Jiri Olsa

hi,
we've got many failing tests, mainly due to commit:
ebe9729c8c31 perf machine: Fix to destroy kernel maps when machine exits

and recent bpf changes, sending fixes.

I think we should force running 'perf test' little more ;-)

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

jirka

maintainer Acked-by on the v1 series
#18 lore raw
In reply to Jiri Olsa
Quoted 5 lines · Jiri Olsa

hi,
we've got many failing tests, mainly due to commit:
ebe9729c8c31 perf machine: Fix to destroy kernel maps when machine exits

and recent bpf changes, sending fixes.

I replied to each patch if I had something to say. With that fixed,

Quoted 2 lines

I think we should force running 'perf test' little more ;-)

Agreed.

Thanks,
Namhyung

Quoted 19 lines

---
Jiri Olsa (7):
perf test: Use machine__new_host in dwarf unwind test perf test: Use machine__new_host in mma thread lookup test perf test: Use machine__new_host in mma thread code reading test perf test: Fix cpus and thread maps refference in error path perf test: Prevent using bpf-output event in round trip name test perf test: Use machine__new_host in thread mg sharing test perf test: Create kernel maps properly for hist entries test

 tools/perf/tests/code-reading.c         | 14 +++++++++-----
 tools/perf/tests/dwarf-unwind.c         |  8 ++------
 tools/perf/tests/evsel-roundtrip-name.c | 11 +++++------
 tools/perf/tests/hists_common.c         |  7 +++++++
 tools/perf/tests/mmap-thread-lookup.c   |  6 ++----
 tools/perf/tests/thread-mg-share.c      |  7 +++----
 6 files changed, 28 insertions(+), 25 deletions(-)