Skip to contentSkip to conversation

perf/core improvements and fixes

GIT PULL New Arnaldo Carvalho de Melo 2 participants 7 messages Oct 21, 2015 – Oct 22, 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 e3d006ce8180a0c025ce66bdc89bbc125f85be57:

perf annotate: Add debug message for out of bounds sample (2015-10-21 18:12:37 -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

Arnaldo Carvalho de Melo (1):
perf annotate: Add debug message for out of bounds sample

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/annotate.c        |  5 ++++-
 tools/perf/util/cpumap.c          |  2 +-
 tools/perf/util/evsel.c           |  1 +
 5 files changed, 24 insertions(+), 10 deletions(-)
 create mode 100644 tools/build/.gitignore
author maintainer
#1 lore raw

PATCH 1/5 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/5 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/5 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/5 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..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);
Signature · 1 line
2.1.0
author maintainer
#5 lore raw

PATCH 5/5 perf annotate: Add debug message for out of bounds sample

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Cc Adrian Hunter <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc Wang Nan <[email protected]>
---
 tools/perf/util/annotate.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/perf/util/annotate.c +4 -1
index d1eece70b84d..0fc8d7a2fea5 100644
@@ -548,8 +548,11 @@ static int __symbol__inc_addr_samples(struct symbol *sym, struct map *map,
 
 	pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr));
 
-	if (addr < sym->start || addr >= sym->end)
+	if (addr < sym->start || addr >= sym->end) {
+		pr_debug("%s(%d): ERANGE! sym->name=%s, start=%#" PRIx64 ", addr=%#" PRIx64 ", end=%#" PRIx64 "\n",
+		       __func__, __LINE__, sym->name, sym->start, addr, sym->end);
 		return -ERANGE;
+	}
 
 	offset = addr - sym->start;
 	h = annotation__histogram(notes, evidx);
Signature · 1 line
2.1.0
#6 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 51 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 e3d006ce8180a0c025ce66bdc89bbc125f85be57:

perf annotate: Add debug message for out of bounds sample (2015-10-21 18:12:37 -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

Arnaldo Carvalho de Melo (1):
perf annotate: Add debug message for out of bounds sample

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 7 lines
 tools/build/.gitignore            |  1 +
 tools/lib/traceevent/plugin_kvm.c | 25 +++++++++++++++++--------
 tools/perf/util/annotate.c        |  5 ++++-
 tools/perf/util/cpumap.c          |  2 +-
 tools/perf/util/evsel.c           |  1 +
 5 files changed, 24 insertions(+), 10 deletions(-)
 create mode 100644 tools/build/.gitignore

Pulled, thanks a lot Arnaldo!

Ingo