Skip to contentSkip to conversation

perf/core improvements and fixes

GIT PULL In review Arnaldo Carvalho de Melo 3 participants 11 messages Oct 20, 2015 – Oct 21, 2015

Subsystems (2)
lore
Share & tools
lore

Arnaldo Carvalho de Melo

author maintainer
#0 lore raw

Hi Ingo,

Please consider pulling,

- Arnaldo

The following changes since commit 43e41adc9e8c36545888d78fed2ef8d102a938dc:

perf record: Add ability to sample call branches (2015-10-20 10:30:55 +0200)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo

for you to fetch changes up to bab84928dfadf8cba4d3fadcea0890de4da37be8:

perf evsel: Print branch filter state with -vv (2015-10-20 15:54:21 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

- Print branch filter state with verbose mode (Andi Kleen)

- Fix core dump caused by per-socket/core system-wide stat (Kan Liang)

- Update libtraceevent KVM plugin (Paolo Bonzini)

Developer stuff:

- Add fixdep to 'tools/build' .gitignore (Yunlong Song)

----------------------------------------------------------------
Andi Kleen (1):
perf evsel: Print branch filter state with -vv

Kan Liang (1):
perf cpu_map: Fix core dump caused by per-socket/core system-wide stat

Paolo Bonzini (1):
tools lib traceevent: update KVM plugin

Yunlong Song (1):
perf build: Add fixdep to .gitignore

 tools/build/.gitignore            |  1 +
 tools/lib/traceevent/plugin_kvm.c | 25 +++++++++++++++++--------
 tools/perf/util/cpumap.c          |  2 +-
 tools/perf/util/evsel.c           |  1 +
 4 files changed, 20 insertions(+), 9 deletions(-)
 create mode 100644 tools/build/.gitignore
author maintainer
#1 lore raw

PATCH 1/4 perf build: Add fixdep to .gitignore

From: Yunlong Song <[email protected]>

Commit 7c422f5572667fef0db38d2046ecce69dcf0afc8 ("tools build: Build fixdep helper from perf and basic libs") dynamically creates fixdep during the perf building. Add it to .gitignore.

Cc Adrian Hunter <[email protected]>
Cc Alexei Starovoitov <[email protected]>
Cc David Ahern <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Kan Liang <[email protected]>
Cc Masami Hiramatsu <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Wang Nan <[email protected]>
Fixes 7c422f557266 ("tools build: Build fixdep helper from perf and basic libs")
---
 tools/build/.gitignore | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 tools/build/.gitignore
tools/build/.gitignore new file +1 -0
new file mode 100644
index 000000000000..a776371a3502
@@ -0,0 +1 @@
+fixdep
Signature · 1 line
2.1.0
author maintainer
#2 lore raw

PATCH 2/4 tools lib traceevent: update KVM plugin

In reply to Arnaldo Carvalho de Melo

From: Paolo Bonzini <[email protected]>

The format of the role word has changed through the years and the plugin was never updated; some VMX exit reasons were missing too.

---
 tools/lib/traceevent/plugin_kvm.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)
tools/lib/traceevent/plugin_kvm.c +17 -8
index 88fe83dff7cd..18536f756577 100644
@@ -124,7 +124,10 @@ static const char *disassemble(unsigned char *insn, int len, uint64_t rip,
 	_ER(WBINVD,		 54)		\
 	_ER(XSETBV,		 55)		\
 	_ER(APIC_WRITE,		 56)		\
-	_ER(INVPCID,		 58)
+	_ER(INVPCID,		 58)		\
+	_ER(PML_FULL,		 62)		\
+	_ER(XSAVES,		 63)		\
+	_ER(XRSTORS,		 64)
 
 #define SVM_EXIT_REASONS \
 	_ER(EXIT_READ_CR0,	0x000)		\
@@ -352,15 +355,18 @@ static int kvm_nested_vmexit_handler(struct trace_seq *s, struct pevent_record *
 union kvm_mmu_page_role {
 	unsigned word;
 	struct {
-		unsigned glevels:4;
 		unsigned level:4;
+		unsigned cr4_pae:1;
 		unsigned quadrant:2;
-		unsigned pad_for_nice_hex_output:6;
 		unsigned direct:1;
 		unsigned access:3;
 		unsigned invalid:1;
-		unsigned cr4_pge:1;
 		unsigned nxe:1;
+		unsigned cr0_wp:1;
+		unsigned smep_and_not_wp:1;
+		unsigned smap_and_not_wp:1;
+		unsigned pad_for_nice_hex_output:8;
+		unsigned smm:8;
 	};
 };
 
@@ -385,15 +391,18 @@ static int kvm_mmu_print_role(struct trace_seq *s, struct pevent_record *record,
 	if (pevent_is_file_bigendian(event->pevent) ==
 	    pevent_is_host_bigendian(event->pevent)) {
 
-		trace_seq_printf(s, "%u/%u q%u%s %s%s %spge %snxe",
+		trace_seq_printf(s, "%u q%u%s %s%s %spae %snxe %swp%s%s%s",
 				 role.level,
-				 role.glevels,
 				 role.quadrant,
 				 role.direct ? " direct" : "",
 				 access_str[role.access],
 				 role.invalid ? " invalid" : "",
-				 role.cr4_pge ? "" : "!",
-				 role.nxe ? "" : "!");
+				 role.cr4_pae ? "" : "!",
+				 role.nxe ? "" : "!",
+				 role.cr0_wp ? "" : "!",
+				 role.smep_and_not_wp ? " smep" : "",
+				 role.smap_and_not_wp ? " smap" : "",
+				 role.smm ? " smm" : "");
 	} else
 		trace_seq_printf(s, "WORD: %08x", role.word);
 
Signature · 1 line
2.1.0
author maintainer
#3 lore raw

PATCH 3/4 perf cpu_map: Fix core dump caused by per-socket/core system-wide stat

In reply to Arnaldo Carvalho de Melo

From: Kan Liang <[email protected]>

Perf will core dump if --per-socket/core -a are applied for perf stat.

The root cause is that cpu_map__build_map set refcnt of evlist's cpu_map to 1. It should set refcnt for the newly created cpu_map, not evlist's cpu_map.

Here is the example:

  # perf stat -e cycles --per-socket -a sleep 1

Performance counter stats for 'system wide':

  S0       36         30,196,257      cycles
  S1       28         15,823,536      cycles
       1.001126828 seconds time elapsed

*** Error in `./perf': corrupted double-linked list: 0x00000000021f9090 *** ======= Backtrace: =========
/lib64/libc.so.6[0x3002e7bbe7]
/lib64/libc.so.6[0x3002e7d2b5] ./perf(perf_evsel__delete+0x28)[0x485bdd]
./perf[0x4800e8]
./perf(perf_evlist__delete+0x5e)[0x482cd5] ./perf(cmd_stat+0xf25)[0x432328]
./perf[0x4768e0]
./perf[0x476ad6]
./perf[0x476b41]
./perf(main+0x1d0)[0x476db2] /lib64/libc.so.6(__libc_start_main+0xf5)[0x3002e21b45] ./perf[0x4202c5]

---
 tools/perf/util/cpumap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/cpumap.c +1 -1
index b36845347f01..aa6b490aa471 100644
@@ -285,7 +285,7 @@ int cpu_map__build_map(struct cpu_map *cpus, struct cpu_map **res,
 	/* ensure we process id in increasing order */
 	qsort(c->map, c->nr, sizeof(int), cmp_ids);
 
-	atomic_set(&cpus->refcnt, 1);
+	atomic_set(&c->refcnt, 1);
 	*res = c;
 	return 0;
 }
Signature · 1 line
2.1.0
author maintainer
#4 lore raw

PATCH 4/4 perf evsel: Print branch filter state with -vv

In reply to Arnaldo Carvalho de Melo

From: Andi Kleen <[email protected]>

Add a missing field to the perf_event_attr debug output.

---
 tools/perf/util/evsel.c | 1 +
 1 file changed, 1 insertion(+)
tools/perf/util/evsel.c +1 -0
index 8be867ccefe9..11bf3f2c51cd 100644
@@ -1229,6 +1229,7 @@ int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr,
 	PRINT_ATTRf(config, p_hex);
 	PRINT_ATTRn("{ sample_period, sample_freq }", sample_period, p_unsigned);
 	PRINT_ATTRf(sample_type, p_sample_type);
+	PRINT_ATTRf(branch_sample_type, p_unsigned);
 	PRINT_ATTRf(read_format, p_read_format);
 
 	PRINT_ATTRf(disabled, p_unsigned);
Signature · 1 line
2.1.0
maintainer
#5 lore raw

Re: [PATCH 4/4] perf evsel: Print branch filter state with -vv

Quoted 18 lines · Arnaldo Carvalho de Melo

From: Andi Kleen <[email protected]>

Add a missing field to the perf_event_attr debug output.

---
 tools/perf/util/evsel.c | 1 +
 1 file changed, 1 insertion(+)
tools/perf/util/evsel.c +0 -0
index 8be867ccefe9..11bf3f2c51cd 100644

tools/perf/util/evsel.c int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr, · line 1233

Quoted 5 lines
tools/perf/util/evsel.c +1 -0
@@ -1229,6 +1229,7 @@ int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr,
 	PRINT_ATTRf(config, p_hex);
 	PRINT_ATTRn("{ sample_period, sample_freq }", sample_period, p_unsigned);
 	PRINT_ATTRf(sample_type, p_sample_type);
+	PRINT_ATTRf(branch_sample_type, p_unsigned);
 	PRINT_ATTRf(read_format, p_read_format);

As said in the original thread, this is the wrong place, it should be between config2 and sample_regs_user.

#6 lore raw

Re: [PATCH 4/4] perf evsel: Print branch filter state with -vv

Quoted 14 lines · Peter Zijlstra
Quoted 13 lines · Arnaldo Carvalho de Melo

From: Andi Kleen <[email protected]>

Add a missing field to the perf_event_attr debug output.

---
 tools/perf/util/evsel.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 13 lines

tools/perf/util/evsel.c int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr, · line 1233

Quoted 10 lines
tools/perf/util/evsel.c +1 -0
index 8be867ccefe9..11bf3f2c51cd 100644
@@ -1229,6 +1229,7 @@ int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr,
 	PRINT_ATTRf(config, p_hex);
 	PRINT_ATTRn("{ sample_period, sample_freq }", sample_period, p_unsigned);
 	PRINT_ATTRf(sample_type, p_sample_type);
+	PRINT_ATTRf(branch_sample_type, p_unsigned);
 	PRINT_ATTRf(read_format, p_read_format);

As said in the original thread, this is the wrong place, it should be between config2 and sample_regs_user.

Ok, I've unpulled these updates, since I haven't pushed these bits out yet.

Thanks,

Ingo

author maintainer
#7 lore raw

Re: [PATCH 4/4] perf evsel: Print branch filter state with -vv

Em Wed, Oct 21, 2015 at 11:25:25AM +0200, Ingo Molnar escreveu:

Quoted 17 lines · Peter Zijlstra
Quoted 5 lines · Arnaldo Carvalho de Melo
Quoted 3 lines

From: Andi Kleen <[email protected]>

Add a missing field to the perf_event_attr debug output.

Quoted 10 lines

tools/perf/util/evsel.c int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr, · line 1233

Quoted 7 lines

+++ b/tools/perf/util/evsel.c

tools/perf/util/evsel.c +1 -0
@@ -1229,6 +1229,7 @@ int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr,
 	PRINT_ATTRf(config, p_hex);
 	PRINT_ATTRn("{ sample_period, sample_freq }", sample_period, p_unsigned);
 	PRINT_ATTRf(sample_type, p_sample_type);
+	PRINT_ATTRf(branch_sample_type, p_unsigned);
 	PRINT_ATTRf(read_format, p_read_format);

As said in the original thread, this is the wrong place, it should be between config2 and sample_regs_user.

Quoted 1 line

Ok, I've unpulled these updates, since I haven't pushed these bits out yet.

I'll fix this as pointed out by Peter and resubmit.

- Arnaldo

author maintainer
#8 lore raw

Re: [PATCH 4/4] perf evsel: Print branch filter state with -vv

In reply to Peter Zijlstra

Em Wed, Oct 21, 2015 at 10:32:15AM +0200, Peter Zijlstra escreveu:

Quoted 14 lines · Arnaldo Carvalho de Melo
Quoted 13 lines

From: Andi Kleen <[email protected]>

Add a missing field to the perf_event_attr debug output.

---
 tools/perf/util/evsel.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 13 lines

tools/perf/util/evsel.c int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr, · line 1233

Quoted 10 lines
tools/perf/util/evsel.c +1 -0
index 8be867ccefe9..11bf3f2c51cd 100644
@@ -1229,6 +1229,7 @@ int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr,
 	PRINT_ATTRf(config, p_hex);
 	PRINT_ATTRn("{ sample_period, sample_freq }", sample_period, p_unsigned);
 	PRINT_ATTRf(sample_type, p_sample_type);
+	PRINT_ATTRf(branch_sample_type, p_unsigned);
 	PRINT_ATTRf(read_format, p_read_format);

As said in the original thread, this is the wrong place, it should be between config2 and sample_regs_user.

Like below, right? Acked?

commit 528946c2fcb5cdd3b75b691b316b5bdeaa7d46d0

Author: Andi Kleen <[email protected]>
Date:   Tue Oct 20 11:46:36 2015 -0700

perf evsel: Print branch filter state with -vv

Add a missing field to the perf_event_attr debug output.

Cc Jiri Olsa <[email protected]>
Cc Peter Zijlstra <[email protected]>
[ Print it between config2 and sample_regs_user (peterz)]
tools/perf/util/evsel.c +1 -0
index 8be867ccefe9..ab05fa52a5cd 100644
@@ -1262,6 +1262,7 @@ int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr,
 	PRINT_ATTRf(bp_type, p_unsigned);
 	PRINT_ATTRn("{ bp_addr, config1 }", bp_addr, p_hex);
 	PRINT_ATTRn("{ bp_len, config2 }", bp_len, p_hex);
+	PRINT_ATTRf(branch_sample_type, p_unsigned);
 	PRINT_ATTRf(sample_regs_user, p_hex);
 	PRINT_ATTRf(sample_stack_user, p_unsigned);
 	PRINT_ATTRf(clockid, p_signed);
maintainer Acked-by
#9 lore raw

Re: [PATCH 4/4] perf evsel: Print branch filter state with -vv

Quoted 20 lines · Arnaldo Carvalho de Melo

commit 528946c2fcb5cdd3b75b691b316b5bdeaa7d46d0

Author: Andi Kleen <[email protected]>
Date:   Tue Oct 20 11:46:36 2015 -0700

perf evsel: Print branch filter state with -vv

Add a missing field to the perf_event_attr debug output.

Cc Jiri Olsa <[email protected]>
Cc Peter Zijlstra <[email protected]>
[ Print it between config2 and sample_regs_user (peterz)]
tools/perf/util/evsel.c +0 -0
index 8be867ccefe9..ab05fa52a5cd 100644

tools/perf/util/evsel.c int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr, · line 1268

Quoted 7 lines
tools/perf/util/evsel.c +1 -0
@@ -1262,6 +1262,7 @@ int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr,
 	PRINT_ATTRf(bp_type, p_unsigned);
 	PRINT_ATTRn("{ bp_addr, config1 }", bp_addr, p_hex);
 	PRINT_ATTRn("{ bp_len, config2 }", bp_len, p_hex);
+	PRINT_ATTRf(branch_sample_type, p_unsigned);
 	PRINT_ATTRf(sample_regs_user, p_hex);
 	PRINT_ATTRf(sample_stack_user, p_unsigned);
 	PRINT_ATTRf(clockid, p_signed);
#10 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 48 lines · Arnaldo Carvalho de Melo

Hi Ingo,

Please consider pulling,

- Arnaldo

The following changes since commit 43e41adc9e8c36545888d78fed2ef8d102a938dc:

perf record: Add ability to sample call branches (2015-10-20 10:30:55 +0200)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo

for you to fetch changes up to bab84928dfadf8cba4d3fadcea0890de4da37be8:

perf evsel: Print branch filter state with -vv (2015-10-20 15:54:21 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

- Print branch filter state with verbose mode (Andi Kleen)

- Fix core dump caused by per-socket/core system-wide stat (Kan Liang)

- Update libtraceevent KVM plugin (Paolo Bonzini)

Developer stuff:

- Add fixdep to 'tools/build' .gitignore (Yunlong Song)

----------------------------------------------------------------
Andi Kleen (1):
perf evsel: Print branch filter state with -vv

Kan Liang (1):
perf cpu_map: Fix core dump caused by per-socket/core system-wide stat

Paolo Bonzini (1):
tools lib traceevent: update KVM plugin

Yunlong Song (1):
perf build: Add fixdep to .gitignore

Quoted 6 lines
 tools/build/.gitignore            |  1 +
 tools/lib/traceevent/plugin_kvm.c | 25 +++++++++++++++++--------
 tools/perf/util/cpumap.c          |  2 +-
 tools/perf/util/evsel.c           |  1 +
 4 files changed, 20 insertions(+), 9 deletions(-)
 create mode 100644 tools/build/.gitignore

Pulled, thanks a lot Arnaldo!

Ingo