Skip to contentSkip to conversation

perf events fixes

GIT PULL Ingo Molnar 1 participant 1 message Sep 26, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest perf-fixes-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git perf-fixes-for-linus

Thanks,

Ingo

------------------>
Anton Blanchard (1):
perf_event: Update PERF_EVENT_FORK header definition

Eric Dumazet (2):
perf tools: Fix buffer allocation
perf tools: Dont use openat()

Ingo Molnar (1):
perf stat: Fix zero total printouts

Kirill Smelkov (1):

      perf tools: .gitignore += perf*.html

Mike Galbraith (2):
perf tools: Fix module symbol loading bug
perf tools: Handle relative paths while loading module symbols

Peter Zijlstra (1):
perf_event, x86: Fix 'perf sched record' crashing the machine

 arch/x86/kernel/cpu/perf_event.c |    3 +
 include/linux/perf_counter.h     |    2 +-
 include/linux/perf_event.h       |    2 +-
 tools/perf/.gitignore            |    1 +
 tools/perf/builtin-stat.c        |   18 ++++++--
 tools/perf/util/module.c         |   96 ++++++++++++++++++++++++++------------
 tools/perf/util/parse-events.c   |   49 ++++++++-----------
 tools/perf/util/symbol.c         |   17 +++++--
 8 files changed, 119 insertions(+), 69 deletions(-)
arch/x86/kernel/cpu/perf_event.c +3 -0
index a3c7adb..b5801c3 100644
@@ -1790,6 +1790,9 @@ void smp_perf_pending_interrupt(struct pt_regs *regs)
 void set_perf_event_pending(void)
 {
 #ifdef CONFIG_X86_LOCAL_APIC
+	if (!x86_pmu.apic || !x86_pmu_initialized())
+		return;
+
 	apic->send_IPI_self(LOCAL_PENDING_VECTOR);
 #endif
 }
include/linux/perf_counter.h +1 -1
index 368bd70..7b7fbf4 100644
@@ -361,7 +361,7 @@ enum perf_event_type {
 	 *	struct perf_event_header	header;
 	 *	u32				pid, ppid;
 	 *	u32				tid, ptid;
-	 *	{ u64				time;     } && PERF_SAMPLE_TIME
+	 *	u64				time;
 	 * };
 	 */
 	PERF_EVENT_FORK			= 7,
include/linux/perf_event.h +1 -1
index acefaf7..3a9d36d 100644
@@ -357,7 +357,7 @@ enum perf_event_type {
 	 *	struct perf_event_header	header;
 	 *	u32				pid, ppid;
 	 *	u32				tid, ptid;
-	 *	{ u64				time;     } && PERF_SAMPLE_TIME
+	 *	u64				time;
 	 * };
 	 */
 	PERF_RECORD_FORK			= 7,
tools/perf/.gitignore +1 -0
index d69a759..0854f11 100644
@@ -10,6 +10,7 @@ perf-stat
 perf-top
 perf*.1
 perf*.xml
+perf*.html
 common-cmds.h
 tags
 TAGS
tools/perf/builtin-stat.c +14 -4
index 16af2d8..e5f6ece 100644
@@ -338,14 +338,24 @@ static void nsec_printout(int counter, double avg)
 
 static void abs_printout(int counter, double avg)
 {
+	double total, ratio = 0.0;
+
 	fprintf(stderr, " %14.0f  %-24s", avg, event_name(counter));
 
 	if (MATCH_EVENT(HARDWARE, HW_INSTRUCTIONS, counter)) {
-		fprintf(stderr, " # %10.3f IPC  ",
-				avg / avg_stats(&runtime_cycles_stats));
+		total = avg_stats(&runtime_cycles_stats);
+
+		if (total)
+			ratio = avg / total;
+
+		fprintf(stderr, " # %10.3f IPC  ", ratio);
 	} else {
-		fprintf(stderr, " # %10.3f M/sec",
-				1000.0 * avg / avg_stats(&runtime_nsecs_stats));
+		total = avg_stats(&runtime_nsecs_stats);
+
+		if (total)
+			ratio = 1000.0 * avg / total;
+
+		fprintf(stderr, " # %10.3f M/sec", ratio);
 	}
 }
 
tools/perf/util/module.c +66 -30

163 lines not on this page · raw message

tools/perf/util/parse-events.c +20 -29

96 lines not on this page · raw message

tools/perf/util/symbol.c +13 -4
index fd3d9c8..559fb06 100644
@@ -833,7 +833,7 @@ int dso__load_modules(struct dso *self, symbol_filter_t filter, int v)
 	struct mod_dso *mods = mod_dso__new_dso("modules");
 	struct module *pos;
 	struct rb_node *next;
-	int err;
+	int err, count = 0;
 
 	err = mod_dso__load_modules(mods);
 
@@ -852,14 +852,16 @@ int dso__load_modules(struct dso *self, symbol_filter_t filter, int v)
 			break;
 
 		next = rb_next(&pos->rb_node);
+		count += err;
 	}
 
 	if (err < 0) {
 		mod_dso__delete_modules(mods);
 		mod_dso__delete_self(mods);
+		return err;
 	}
 
-	return err;
+	return count;
 }
 
 static inline void dso__fill_symbol_holes(struct dso *self)
@@ -913,8 +915,15 @@ int dso__load_kernel(struct dso *self, const char *vmlinux,
 
 	if (vmlinux) {
 		err = dso__load_vmlinux(self, vmlinux, filter, v);
-		if (err > 0 && use_modules)
-			err = dso__load_modules(self, filter, v);
+		if (err > 0 && use_modules) {
+			int syms = dso__load_modules(self, filter, v);
+
+			if (syms < 0) {
+				fprintf(stderr, "dso__load_modules failed!\n");
+				return syms;
+			}
+			err += syms;
+		}
 	}
 
 	if (err <= 0)